| @@ -1,5 +1,5 @@ | ||
| 1 | -var rf=Object.defineProperty;var df=(e,t,a)=>t in e?rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Oe=(e,t,a)=>df(e,typeof t!="symbol"?t+"":t,a);import{r as B,c as $,o as r,w as d,a as n,u as A,b as k,d as o,e as h,f as R,t as f,F as O,g as ae,h as V,i as Qe,j as Ct,k as zt,l as K,m as Ca,n as de,p as ta,q as Ne,s as xn,T as Gl,v as Ce,x as Se,y as Pr,z as $a,A as _l,B as Sl,C as uf,D as ga,E as Cl,G as na,H as cf,I as jl,J as gn,K as vl,L as Xo,M as Af,N as Cc,V as Bc,O as Ss,P as pf,Q as Nr,R as Va,S as jt,U as Vl,W as ff,X as mf,Y as hf,Z as Gs,_ as _f,$ as vf,a0 as gf,a1 as Kr,a2 as yf}from"./chunks/vue.esm-bundler.js?ver=1.5.1";import{u as tl,a as al,o as kc,c as bf,b as wf}from"./chunks/vue-router.js?ver=1.5.1";import{_ as ee,a as qt}from"./chunks/DynamicIcon.js?ver=1.5.1";import{T as Fs,_ as $s,a as Gr,F as Co,b as Za,B as Aa,P as Vn,c as xc,d as Cf,e as Bf,m as kf}from"./chunks/Badge.js?ver=1.5.1";import{t as u,a as Xt,A as ze,p as Bo}from"./chunks/Translator.js?ver=1.5.1";import{_ as _t,P as ll}from"./chunks/Empty.js?ver=1.5.1";import{_ as jr,a as Fa,b as Sc,c as Fc,L as zr,d as Jo,O as $c,e as Zo,P as qr,C as Yl}from"./chunks/OrderCustomerInformation.js?ver=1.5.1";import{_ as Pt,p as Sn}from"./chunks/UserCan.js?ver=1.5.1";import{C as Je}from"./chunks/CurrencyFormatter.js?ver=1.5.1";import{_ as Pa,a as Yr,b as Wr,c as xf,S as Ec,d as Uc,e as Sf,A as Ic,f as Qc}from"./chunks/CancelSubscription.js?ver=1.5.1";import{_ as wa,C as Ve,a as ke,b as xe}from"./chunks/CardBody.js?ver=1.5.1";import{_ as lt}from"./chunks/_plugin-vue_export-helper.js?ver=1.5.1";import{S as Lt}from"./chunks/Storage.js?ver=1.5.1";import{c as Ff,h as Xs,a as ar,g as Dc,f as $f,b as ks,$ as il,d as Ef}from"./chunks/common.js?ver=1.5.1";import{I as Xe}from"./chunks/IconButton.js?ver=1.5.1";import{M as sl}from"./chunks/Model.js?ver=1.5.1";import{R as ce}from"./chunks/Rest.js?ver=1.5.1";import{d as at,g as Uf}from"./chunks/dayjs.min.js?ver=1.5.1";import{a as ei,E as Ja,m as If,b as rl,d as gs,i as nl,c as Qf,s as Vc,e as ko,f as Xr,r as Jr,g as Tc,p as $d,w as Df,h as ti,l as Vf,j as qs,k as Tf,n as Mf,o as xo,t as Lf,q as Rf,u as Of,v as Hf,x as Pf,y as Nf,z as Kf,A as Gf}from"./chunks/index.js?ver=1.5.1";import{n as z}from"./chunks/Notify.js?ver=1.5.1";import{_ as _a}from"./chunks/Animation.js?ver=1.5.1";import{_ as Wl,T as Te,m as Ha,a as Rl,i as Jt,r as jf,L as lr,b as Mc,d as Lc,c as Rc}from"./chunks/dateShortCuts.js?ver=1.5.1";import{S as Ea,_ as Ua,u as ps,a as zf,b as qf,c as Yf}from"./chunks/countries.js?ver=1.5.1";import{u as fs,L as ca,_ as ai}from"./chunks/NotFound.js?ver=1.5.1";import{A as cs}from"./chunks/Asset.js?ver=1.5.1";import{E as Wf}from"./chunks/index2.js?ver=1.5.1";import{S as oa}from"./chunks/Str.js?ver=1.5.1";import{A as rt}from"./chunks/Arr.js?ver=1.5.1";import{C as hs,V as Js,_ as la,c as Fn,a as ho,b as Xf,d as Jf}from"./chunks/AttrGroups.js?ver=1.5.1";import{U as Zs}from"./chunks/Url.js?ver=1.5.1";import{u as li,t as Oc}from"./chunks/timezone.js?ver=1.5.1";import{e as $n,i as Zr,U as ed,p as Zf}from"./chunks/Utils.js?ver=1.5.1";import{_ as an,P as Hc}from"./chunks/ProductVariationSelector.js?ver=1.5.1";import{f as ha,a as em,p as tm,b as am,g as lm,c as sm,d as nm}from"./chunks/productService.js?ver=1.5.1";import{B as So}from"./chunks/BundleProducts.js?ver=1.5.1";import{E as Ed}from"./chunks/index3.js?ver=1.5.1";import{T as Ud}from"./chunks/TransitionAccordion.js?ver=1.5.1";import{_ as Pc}from"./chunks/FileUploaderDialog.js?ver=1.5.1";import{E as Qs,v as om,i as im}from"./chunks/defaults.js?ver=1.5.1";import rm from"./chunks/Screenshot.js?ver=1.5.1";import{u as dm}from"./chunks/useElementPlusComponents.js?ver=1.5.1";import"./chunks/AddressComponent2.js?ver=1.5.1";import"./chunks/index4.js?ver=1.5.1";class um extends Fs{getTabs(){return{}}getToggleableColumns(){return[{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Customer Since"),value:"customer_since"},{label:u("Last Purchase Date"),value:"last_purchase_date"}]}getSortableColumns(){return[{label:u("Customer ID"),value:"id"},{label:u("Name"),value:"first_name"},{label:u("Purchases"),value:"purchase_count"},{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Last Purchase Date"),value:"last_purchase_date"},{label:u("Customer Since"),value:"created_at"}]}getSearchHint(){return u("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function Nc(e){return um.init(e)}const cm={class:"table-cell"},Am={class:"fct-product-info-card w-full"},pm={class:"fct-product-info-media"},fm={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},mm={class:"fct-product-info-name flex flex-col items-start gap-3"},hm={class:"table-cell"},_m={class:"table-cell"},vm={class:"table-cell"},gm={class:"table-cell"};const ym={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=B("el-table-column"),c=B("el-skeleton-item"),p=B("el-table"),m=B("el-skeleton");return r(),$(m,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive"},{empty:d(()=>s[0]||(s[0]=[])),default:d(()=>[k("",!0),n(i,{label:l.$t("Customer"),width:"300"},{default:d(()=>[o("div",cm,[o("div",Am,[o("div",pm,[n(c,{varient:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",fm,[o("div",mm,[n(c,{varient:"p",class:"max-w-[190px]"}),n(c,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),n(i,{label:l.$t("Address"),width:"300"},{default:d(()=>[o("div",hm,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(i,{label:l.$t("Purchases"),width:"150"},{default:d(()=>[o("div",_m,[n(c,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("last_purchase_date")?(r(),$(i,{key:1,label:l.$t("Last Purchase Date"),width:"200"},{default:d(()=>[o("div",vm,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),$(i,{key:2,label:l.$t("Customer Since"),width:"150"},{default:d(()=>[o("div",gm,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),(e.customerTable.isColumnVisible("actions"),k("",!0))]),_:1},8,["data"])]),_:1})}}},bm={key:0,class:"fct-customer-card"},wm={class:"fct-customer-avatar"},Cm=["src"],Bm={class:"fct-customer-details"},km={class:"fct-customer-name"},xm={class:"fct-customer-id"},Sm={class:"fct-customer-email"},Fm=["innerHTML"],$m={key:1},Em={__name:"CustomersTable",props:{table:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=B("el-table-column"),s=B("el-table");return r(),$(s,{data:e.table.getTableData(),class:"w-full compact-table"},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No customer found!")},null,8,["text"])]),default:d(()=>[k("",!0),n(l,{label:A(u)("Customer"),width:"300"},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>{var p,m,_,g,y;return[(p=i.row)!=null&&p.id?(r(),h("div",bm,[o("div",wm,[o("span",null,[o("img",{src:(m=i.row)==null?void 0:m.photo,alt:"avatar"},null,8,Cm)])]),o("div",Bm,[o("div",km,[R(f(((_=i.row)==null?void 0:_.full_name)||A(u)("No Name"))+" ",1),o("span",xm,"#"+f(A(Xt)((g=i.row)==null?void 0:g.id)),1)]),o("div",Sm,f((y=i.row)==null?void 0:y.email),1)])])):k("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),n(l,{label:A(u)("Address"),width:"300"},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[R(f(t.getOrderAddress(i.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(l,{label:A(u)("Purchases"),width:90},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[R(f(A(Xt)(i.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),$(l,{key:1,label:A(u)("LTV"),width:100},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[o("span",{innerHTML:A(Je).formatNumber(i.row.ltv,!0,!1)},null,8,Fm)]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),$(l,{key:2,label:A(u)("Last Purchase Date"),width:"200"},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[i.row.last_purchase_date?(r(),$(Pa,{key:0,"date-time":i.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",$m,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0),e.table.isColumnVisible("customer_since")?(r(),$(l,{key:3,label:A(u)("Customer Since"),width:"150"},{default:d(i=>{var c;return[n(wa,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(c=i.row)==null?void 0:c.id}}},{default:d(()=>[n(Pa,{"date-time":i.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},Um={class:"fct-customer-table-mobile-wrap"},Im=["onClick"],Qm={class:"fct-customer-table-mobile-header"},Dm={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Vm={class:"fct-customer-avatar"},Tm=["src"],Mm={class:"fct-customer-details"},Lm={class:"fct-customer-name"},Rm={class:"fct-customer-id"},Om={class:"fct-customer-email"},Hm={class:"fct-customer-table-purchases-col"},Pm={class:"fct-customer-table-mobile-body"},Nm={class:"fct-customer-table-mobile-body-list"},Km={key:0,class:"fct-customer-table-ltv-col"},Gm={class:"label"},jm=["innerHTML"],zm={key:1,class:"fct-customer-table-last-purchase-date-col"},qm={class:"label"},Ym={class:"value"},Wm={key:2,class:"fct-customer-table-customer-since-col"},Xm={class:"label"},Jm={class:"value"},Zm={class:"fct-customer-table-mobile-footer"},eh={class:"fct-customer-table-address-col"},th={key:0,class:"py-6 text-center"},ah={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",Um,[(r(!0),h(O,null,ae(e.table.getTableData(),(l,s)=>(r(),h("div",{key:l.id,class:"fct-customer-table-mobile-row",onClick:i=>t.$router.push({name:"view_customer",params:{customer_id:l.id}})},[o("div",Qm,[l!=null&&l.id?(r(),h("div",Dm,[o("div",Vm,[o("img",{src:l==null?void 0:l.photo,alt:"avatar"},null,8,Tm)]),o("div",Mm,[o("div",Lm,[R(f((l==null?void 0:l.full_name)||A(u)("No Name"))+" ",1),o("span",Rm,"#"+f(l==null?void 0:l.id),1)]),o("div",Om,f(l==null?void 0:l.email),1)])])):k("",!0),o("div",Hm,f(l.purchase_count)+" "+f(l.purchase_count>1?A(u)("Purchases"):A(u)("Purchase")),1)]),o("div",Pm,[o("ul",Nm,[e.table.isColumnVisible("ltv")?(r(),h("li",Km,[o("div",Gm,f(A(u)("LTV:")),1),o("div",{class:"value",innerHTML:A(Je).formatNumber(l.ltv,!0,!1)},null,8,jm)])):k("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",zm,[o("div",qm,f(A(u)("Last Purchase Date:")),1),o("div",Ym,[n(Pa,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):k("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",Wm,[o("div",Xm,f(A(u)("Customer Since:")),1),o("div",Jm,[n(Pa,{"date-time":l.created_at},null,8,["date-time"])])])):k("",!0)])]),o("div",Zm,[o("div",eh,[n(ee,{name:"LocationPin"}),R(" "+f(t.getOrderAddress(l)),1)])])],8,Im))),128)),e.table.getTableData().length===0?(r(),h("div",th,[n(_t,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):k("",!0)]))}},lh={},sh={class:"px-4 py-3"},nh={class:"flex items-center justify-between mb-3"},oh={class:"flex items-center justify-between mb-3"},ih={class:"flex items-center justify-between mb-3"},rh={class:"flex items-center justify-between mb-3"};function dh(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),$(l,{animated:""},{template:d(()=>[o("div",sh,[o("div",nh,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",oh,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",ih,[n(a,{varient:"p",class:"w-[120px]"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",rh,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const uh=lt(lh,[["render",dh]]),ch={class:"fct-all-customers-page fct-layout-width"},Ah={class:"fct-all-customers-wrap"},ph={key:1},fh={__name:"AllCustomers",setup(e){const t=Nc(),a=V({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),l=V(!1),s=()=>{l.value=window.innerWidth<768};return Qe(()=>{s(),window.addEventListener("resize",s)}),Ct(()=>{window.removeEventListener("resize",s)}),(i,c)=>{const p=B("el-button");return r(),h("div",ch,[n(Pt,{permission:"customers/manage"},{default:d(()=>[n(ll,{title:A(u)("Customers")},{action:d(()=>[n(p,{type:"primary",onClick:c[0]||(c[0]=m=>a.value.showModal=!0)},{default:d(()=>[R(f(A(u)("Add Customer")),1)]),_:1})]),_:1},8,["title"])]),_:1}),n(Pt,{permission:"customers/view"},{default:d(()=>[o("div",Ah,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),$(uh,{key:0})):k("",!0),n(ah,{table:A(t)},null,8,["table"])]),default:d(()=>[A(t).isLoading()?(r(),$(ym,{key:0,customerTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",ph,[n(Em,{table:A(t)},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Pt,{permission:"customers/manage"},{default:d(()=>[n(jr,{"onUpdate:customerModal":c[1]||(c[1]=()=>{a.value.showModal=!1,a.value.customer={},A(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:c[2]||(c[2]=m=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1})])}}};class mh extends Fs{getTabs(){return{all:u("All"),completed:u("Completed"),processing:u("Processing"),"on-hold":u("On Hold"),paid:u("Paid"),subscription:u("Subscription"),renewal:u("Renewal"),refunded:u("Refunded"),partially_refunded:u("Partially Refunded"),upgraded_from:{title:u("Upgraded From"),description:u("Orders upgraded from another order")},upgraded_to:{title:u("Upgraded To"),description:u("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:u("Customer"),value:"customer"},{label:u("Items"),value:"order_items"},{label:u("Order Status"),value:"status"},{label:u("Order Type"),value:"type"},{label:u("Actions"),value:"actions"}]}getSortableColumns(){return[{label:u("Order ID"),value:"id"},{label:u("Total"),value:"total_amount"},{label:u("Payment Status"),value:"payment_status"},{label:u("Order Status"),value:"status"}]}getSearchHint(){return u("Search by invoice no, customer name, or customer email.")}getFetchUrl(){return"orders"}parseResponse(t){return t.orders}getTableName(){return"order_table"}with(){return["customer.primary_billing_address","order_items"]}}function Kc(e){return mh.init(e)}const hh={class:"fct-order-stats-card"},_h={class:"fct-order-stats-card-head"},vh={class:"fct-order-stats-card-head-content"},gh={class:"text"},yh={key:0,class:"value"},bh={class:"fct-order-stats-card-body"},wh={key:0,class:"change-wrap"},Ch={key:0,class:"change-title"},Bh={key:1,class:"change-title"},kh={key:1,class:"change-wrap"},xh={class:"change-title"},Sh={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=zt().ctx,a=e,l=K(()=>{switch(a.statKey){case"total_orders":return"warning";case"paid_orders":return"blue";case"total_paid_order_items":return"danger";case"total_paid_amounts":return"secondary";default:return"info"}}),s=K(()=>c.value===0?"":c.value>0?"success":"danger"),i=m=>m.is_cents?t.formatNumber(m.current_count):Xt(m.current_count),c=K(()=>{let m=Ff(a.stat.current_count,a.stat.compare_count)??0;return m===""?0:m}),p=K(()=>a.statRanges[a.currentRange].label);return(m,_)=>{const g=B("el-skeleton"),y=B("el-skeleton-item");return r(),h("div",hh,[o("div",_h,[n(Xe,{size:"large",bg:l.value,soft:""},{default:d(()=>[Ca(m.$slots,"icon")]),_:3},8,["bg"]),o("div",vh,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",gh,f(e.stat.title),1),e.loading?k("",!0):(r(),h("div",yh,f(i(e.stat)),1))])]),o("div",bh,[n(g,{loading:e.loading,animated:""},{template:d(()=>[n(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",wh,[o("span",{class:de("change "+s.value)},[c.value!==0?(r(),$(ee,{key:0,name:c.value>0?"CaretUp":"CaretDown"},null,8,["name"])):k("",!0),R(" "+f(c.value===0?m.$t("Same as previous"):Math.abs(c.value)+"%"),1)],2),c.value>0?(r(),h("span",Ch,f(A(u)("More than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):c.value<0?(r(),h("span",Bh,f(A(u)("Less than %s",p.value==="Today"?m.$t("Yesterday"):m.$t(p.value))),1)):k("",!0)])):k("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",kh,[o("span",xh,f(m.$t("All Time")),1)])):k("",!0)])])}}},Fh={name:"CardFooter"},$h={class:"fct-card-footer"};function Eh(e,t,a,l,s,i){return r(),h("div",$h,[Ca(e.$slots,"default")])}const td=lt(Fh,[["render",Eh]]);class Gc{constructor(){Oe(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class rs{static install(t,a,l={},s=!1){const i=new a(...Object.values(l));Object.keys(i).forEach(c=>{(s||!t.hasOwnProperty(c))&&(t[c]=i[c])}),Object.getOwnPropertyNames(a.prototype).forEach(c=>{c!=="constructor"&&typeof i[c]=="function"&&(s||typeof t[c]!="function")&&(t[c]=i[c].bind(t))})}}class Uh extends sl{constructor(){super(...arguments);Oe(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:ze.get("shop.currency_sign"),isBusy:{recentActivities:!1,fluctuations:!1,dashBoardStats:!1,recentOrders:!1,countryHeatMap:!1,salesGrowthChart:!0,topSoldProducts:!0}})}get controllerKey(){return"ReportingController"}beforeInit(){}makeRequest(a,l,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}getSalesGrowthChart(a={}){return this.makeRequest("sales-growth-chart",a,"salesGrowthChart","salesGrowthChart")}getCountryHeatMap(a={}){return this.makeRequest("country-heat-map",a,"countryHeatMap","countryHeatMap")}getRecentOrders(a={}){return this.makeRequest("get-recent-orders",a,"recentOrders","recentOrders")}getRecentActivities(a={}){return this.makeRequest("get-recent-activities",a,"recentActivities","recentActivities")}getSummary(a={}){return this.makeRequest("get-dashboard-summary",a,"summaryData","summaryData")}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const Ka=Uh.init(),Ih={},Qh={class:"fct-order-stats-row"},Dh={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},Vh={class:"flex items-center gap-2 mb-3"},Th={class:"right flex flex-col flex-1 gap-2"};function Mh(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),h("div",Qh,[(r(),h(O,null,ae(4,s=>n(l,{animated:"",key:s},{template:d(()=>[o("div",Dh,[o("div",Vh,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",Th,[n(a,{variant:"p",class:"rounded w-4/5 block"}),n(a,{variant:"p",class:"rounded w-1/2 block"})])]),o("div",null,[n(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const Lh=lt(Ih,[["render",Mh]]),Rh={class:"fct-order-stats-wrap"},Oh={class:"fct-order-stats-actions flex items-center gap-2.5"},Hh={class:"fct-order-stats-body"},Ph={key:1,class:"fct-order-stats-row"},Nh={class:"flex justify-end mt-2"},Kh=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=V(Lt.get("order_stat_collapse",!1)),a=V(""),l=zt().ctx,s=V(!1),i=V(!0),c=V(!1),p=V("-7 days"),m=tl(),_=V({"-0 days":{label:u("Today"),desc:u("Compared to yesterday")},"-7 days":{label:u("Last 7 days"),desc:u("Compared to the previous 7 days")},"-30 days":{label:u("Last 30 days"),desc:u("Compared to the previous 30 days")},this_month:{label:u("This Month"),desc:u("Compared to the previous Month")},all_time:{label:u("All Time"),desc:u("See All time Sales Stat")}}),g=async v=>{if(p.value!==v)try{p.value=v,a.value="collapse",t.value===!0&&(t.value=!1,Lt.set("order_stat_collapse",t.value)),await Promise.all([l.Storage().set("order_quick_stat_bar_range",p.value),y()])}catch{}},y=()=>{c.value=!1,i.value=!0;const v={"-0 days":[at().startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-7 days":[at().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],"-30 days":[at().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],this_month:[at().startOf("month").format("YYYY-MM-DD"),at().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[C,b]=v[p.value]||[at().startOf("month"),at().endOf("day")],w={startDate:C,endDate:b,paymentStatus:"all"};Ka.getDashboardStats({params:{...w}}).then(()=>{s.value=Ka.data.dashBoardStats}).catch(x=>{}).finally(()=>{i.value=!1})};return Qe(()=>{p.value=Lt.get("order_quick_stat_bar_range","-0 days");let v=Lt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,C)=>{const b=B("el-button");return r(),h("div",Rh,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[o("div",Oh,[n(Gr,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(O,null,ae(_.value,(w,x)=>(r(),$(Co,{title:`${A(u)("Order Stats Overview of")} ${w.label}`,tabindex:"0",key:x,onClick:F=>g(x),class:de(x===p.value?"active":"")},{default:d(()=>[R(f(w.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[o("div",Hh,[i.value?(r(),$(Lh,{key:0})):(r(),h("div",Ph,[(r(!0),h(O,null,ae(s.value,(w,x)=>(r(),h("div",{key:x,class:"fct-order-stats-col cursor-pointer",onClick:C[0]||(C[0]=F=>A(m).push({name:"reports_orders"}))},[(r(),$(Sh,{key:x,stat:w,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":x},{icon:d(()=>[n(ee,{name:w.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",Nh,[n(b,{text:"",class:"underline-link-button",onClick:C[1]||(C[1]=w=>A(m).push({name:"reports_orders"}))},{default:d(()=>[R(f(A(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),Gh={class:"table-cell"},jh={class:"table-cell"},zh={class:"table-cell"},qh={class:"table-cell"},Yh={class:"table-cell items-center gap-1"},Wh={class:"table-cell"},Xh={class:"table-cell"},Jh={class:"table-cell"},Zh={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=s=>t.orderTable.columns.includes(s),l=Array.from({length:t.nextPageCount},(s,i)=>i+1);return(s,i)=>{const c=B("el-table-column"),p=B("el-skeleton-item"),m=B("el-table"),_=B("el-skeleton");return r(),$(_,{animated:""},{template:d(()=>[n(m,{data:A(l),class:"w-full compact-table responsive"},{empty:d(()=>i[0]||(i[0]=[])),default:d(()=>[k("",!0),n(c,{label:s.$t("# Date"),width:140},{default:d(()=>[o("div",Gh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),$(c,{key:1,width:"100",label:s.$t("Customer")},{default:d(()=>[o("div",jh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("order_items")?(r(),$(c,{key:2,label:s.$t("Items"),width:"250"},{default:d(()=>[o("div",zh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),n(c,{width:"100",label:s.$t("Total")},{default:d(()=>[o("div",qh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{width:"150",label:s.$t("Payment Status")},{default:d(()=>[o("div",Yh,[n(p,{varient:"p",class:"w-4/5"}),n(p,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),$(c,{key:3,width:"150",label:s.$t("Status")},{default:d(()=>[o("div",Wh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("type")?(r(),$(c,{key:4,width:"110",label:s.$t("Order Type")},{default:d(()=>[o("div",Xh,[n(p,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),a("actions")?(r(),$(c,{key:5,width:"60",label:""},{default:d(()=>[o("div",Jh,[n(p,{varient:"p",class:"w-3/5"})])]),_:1})):k("",!0)]),_:1},8,["data"])]),_:1})}}},e_={},t_={class:"px-4 py-3"},a_={class:"grid grid-cols-3 gap-5 mt-5"};function l_(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),$(l,{animated:""},{template:d(()=>[o("div",t_,[(r(),h(O,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",a_,[(r(),h(O,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const s_=lt(e_,[["render",l_]]),n_={class:"fct-all-orders-page fct-layout-width"},o_={class:"fct-delete-test-orders-content"},i_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},r_={class:"fct-delete-test-orders-meta"},d_={class:"fct-delete-test-orders-text"},u_={key:0,class:"fct-delete-test-orders-loading"},c_={class:"fct-test-orders-loading-content"},A_={class:"fct-loading-bars"},p_=["id"],f_={class:"fct-delete-test-orders-percentage"},m_={class:"fct-delete-test-orders-stats"},h_={class:"fct-delete-test-orders-stat-row"},__={class:"fct-delete-test-orders-stat-label"},v_={class:"fct-delete-test-orders-stat-value"},g_={class:"fct-delete-test-orders-stat-row"},y_={class:"fct-delete-test-orders-stat-label"},b_={class:"fct-delete-test-orders-stat-value is-success"},w_={class:"fct-delete-test-orders-stat-row"},C_={class:"fct-delete-test-orders-stat-label"},B_={class:"fct-delete-test-orders-stat-value is-danger"},k_={key:1,class:"fct-delete-test-orders-message"},x_={key:0,class:"dialog-footer"},S_={class:"fct-all-orders-wrap"},F_={__name:"AllOrders",setup(e){const t=Kc({instance:zt()}),a=V(!1),l=V(!1),s=V(!1),i=V(!1),c=V({total:0,processed:0,deleted:0,failed:0}),p=V(""),m=K(()=>c.value.total?Math.min(100,Math.round(c.value.processed/c.value.total*100)):0),_=K(()=>{if(!c.value.total)return"";const F=Math.min(c.value.processed,c.value.total);return s.value?u("Deleting %1$s of %2$s Test Orders",F,c.value.total):u("Deleted %1$s of %2$s Test Orders",F,c.value.total)}),g=K(()=>c.value.total?s.value?u("Deleting... %s%",m.value):u("Completed"):""),y=()=>{l.value=window.innerWidth<768},v=()=>{c.value={total:0,processed:0,deleted:0,failed:0},p.value=""},C=F=>{F==="show_order_stats"&&(Lt.set("show_order_stats",!a.value),a.value=!a.value),F==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),F==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),F==="delete_test_orders"&&b()},b=async()=>{var F,L;if(!s.value){try{await Ja.confirm(u("Are you sure you want to delete all test orders? This action cannot be undone."),u("Confirm Delete!"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}s.value=!0,i.value=!0,v();try{let U=0,S=0,M=0;for(;;){const T=await ce.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:U}),Q=T||{};if(S=S||Number(Q.total_count||0),M+=Number(Q.batch_count||0),c.value={total:S,processed:M,deleted:c.value.deleted+Number(Q.deleted_count||0),failed:c.value.failed+Number(Q.failed_count||0)},p.value=Q.has_more?u("Processed %1$s of %2$s test orders...",Math.min(M,S),S):(T==null?void 0:T.message)||"",!Q.has_more)break;U=Number(Q.last_attempted_order_id||0),await new Promise(E=>setTimeout(E,100))}if(!c.value.total){i.value=!1,z.info(u("No test orders found to delete"));return}const I=c.value.failed?u("Deleted %1$s test orders. %2$s test orders could not be deleted.",c.value.deleted,c.value.failed):u("Deleted %s test orders successfully",c.value.deleted);p.value=I,z.success(I),t.fetch()}catch(U){p.value=((F=U==null?void 0:U.data)==null?void 0:F.message)||u("Failed to delete test orders"),z.error(((L=U==null?void 0:U.data)==null?void 0:L.message)||u("Failed to delete test orders"))}finally{s.value=!1}}},w=()=>{i.value=!1},x=()=>{const F=Lt.get("show_order_stats");F&&(a.value=F)};return Qe(()=>{x(),y(),window.addEventListener("resize",y)}),Ct(()=>{window.removeEventListener("resize",y)}),(F,L)=>{const U=B("el-icon"),S=B("el-button"),M=B("el-dropdown-item"),I=B("el-dropdown-menu"),T=B("el-dropdown"),Q=B("el-tag"),E=B("el-progress"),D=B("el-dialog");return r(),h("div",n_,[n(ll,{title:A(u)("Orders")},{action:d(()=>[n(Pt,{permission:["reports/view","orders/manage"]},{default:d(()=>[n(T,{trigger:"click","popper-class":"fct-dropdown",onCommand:C,placement:"bottom-end"},{dropdown:d(()=>[n(I,null,{default:d(()=>[n(Pt,{permission:"reports/view"},{default:d(()=>[n(M,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(O,{key:1},[n(ee,{name:"EyeOff"}),R(" "+f(A(u)("Hide Order Stats")),1)],64)):(r(),h(O,{key:0},[n(ee,{name:"Eye"}),R(" "+f(A(u)("Show Order Stats")),1)],64))]),_:1}),A(t).data.showDeleteBulkAction?k("",!0):(r(),$(M,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[n(ee,{name:"Eye"}),R(" "+f(A(u)("Show Bulk Actions")),1)]),_:1})),A(t).data.showDeleteBulkAction?(r(),$(M,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[n(ee,{name:"EyeOff"}),R(" "+f(A(u)("Hide Bulk Actions")),1)]),_:1})):k("",!0)]),_:1}),n(Pt,{permission:"orders/manage"},{default:d(()=>[n(M,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(s.value?A(u)("Deleting Test Orders..."):A(u)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),default:d(()=>[n(S,null,{default:d(()=>[R(f(A(u)("More actions"))+" ",1),n(U,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1})]),_:1}),n(Pt,{permission:"orders/create"},{default:d(()=>[n(S,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:d(()=>[R(f(A(u)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(D,{modelValue:i.value,"onUpdate:modelValue":L[0]||(L[0]=H=>i.value=H),title:A(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:w,class:"fct-delete-test-orders-modal"},{footer:d(()=>[s.value?k("",!0):(r(),h("div",x_,[n(S,{type:"primary",onClick:w},{default:d(()=>[R(f(A(u)("Done")),1)]),_:1})]))]),default:d(()=>[o("div",o_,[o("div",i_,f(_.value),1),o("div",r_,[o("div",d_,f(s.value?A(u)("You can close this — deletion will continue in the background"):A(u)("Test order deletion completed.")),1),g.value?(r(),$(Q,{key:0,type:"success",class:de(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:d(()=>[R(f(g.value),1)]),_:1},8,["class"])):k("",!0)]),s.value?(r(),h("div",u_,[o("div",c_,[o("div",A_,[(r(),h(O,null,ae(8,H=>o("div",{key:H,class:"bar-block",id:`bar-block-${H+1}`},null,8,p_)),64))]),R(" "+f(A(u)("Deleting...")),1)]),o("span",f_,f(m.value)+"% ",1)])):k("",!0),n(_a,{visible:s.value,fade:"",duration:300},{default:d(()=>[n(E,{percentage:m.value,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,status:s.value?void 0:"success",class:"fct-delete-test-orders-progress"},null,8,["percentage","status"])]),_:1},8,["visible"]),o("div",m_,[o("div",h_,[L[1]||(L[1]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M13.66 1.1333C13.3741 1.09487 13.0575 1.0716 12.7083 1.05762V1.66146V1.70461C12.7083 2.25782 12.7084 2.73471 12.6567 3.11653C12.6017 3.52616 12.4775 3.91865 12.1592 4.23714C11.8409 4.55563 11.4483 4.68009 11.0383 4.73518C10.6566 4.78653 10.18 4.78649 9.62663 4.78646H9.58329H8.74996H8.70662C8.15333 4.78649 7.67666 4.78653 7.29499 4.73518C6.88499 4.68009 6.49249 4.55563 6.17416 4.23714C5.85583 3.91865 5.73166 3.52616 5.67666 3.11653C5.62333 2.72482 5.625 2.23304 5.625 1.66146V1.05762C5.27583 1.0716 4.95917 1.09487 4.67333 1.1333C3.92333 1.23414 3.2925 1.45038 2.79083 1.95198C2.28917 2.45358 2.07249 3.08503 1.97166 3.83513C1.87499 4.55588 1.875 5.47186 1.875 6.60774V13.3818C1.875 14.5178 1.87499 15.4337 1.97166 16.1544C2.07249 16.9046 2.28917 17.536 2.79083 18.0376C3.2925 18.5392 3.92333 18.7554 4.67333 18.8563C5.39417 18.9532 6.31 18.9532 7.44667 18.9531H10.8866C11.0791 18.9532 11.2641 18.9519 11.4433 18.9515C11.2358 18.5378 11.0666 18.3449 10.9875 18.2671C10.18 18.0578 9.58329 17.3269 9.58329 16.4539C9.58329 15.4184 10.4225 14.5789 11.4583 14.5789C11.6941 14.5789 11.9733 14.6359 12.1158 14.6766C12.31 14.7322 12.52 14.8165 12.7383 14.9346C13.1533 14.298 13.6958 13.5629 14.3133 12.9367C14.8741 12.3678 15.5933 11.7846 16.4583 11.432V6.60774C16.4583 5.47186 16.4583 4.55588 16.3616 3.83513C16.2608 3.08503 16.0441 2.45358 15.5425 1.95198C15.0408 1.45038 14.41 1.23414 13.66 1.1333Z",fill:"#017EF3"}),o("path",{d:"M17.012 12.3361C17.4462 12.1825 17.922 12.4094 18.0753 12.8431C18.2295 13.2768 18.002 13.753 17.5687 13.9068C17.1453 14.0568 16.6945 14.3786 16.2395 14.8393C15.7912 15.2944 15.3778 15.845 15.022 16.3897C14.6687 16.9317 14.3828 17.4519 14.1853 17.8374C14.087 18.0296 13.9387 18.3456 13.8879 18.4534C13.7587 18.7501 13.4695 18.9462 13.1453 18.9548C12.822 18.9633 12.5228 18.7836 12.3778 18.4942C12.0112 17.7597 11.6821 17.4672 11.5154 17.3564C11.4421 17.3074 11.3937 17.2895 11.3762 17.284C10.9537 17.2435 10.6237 16.8878 10.6237 16.4548C10.6237 15.9945 10.997 15.6214 11.457 15.6214C11.5645 15.6214 11.7428 15.6547 11.8287 15.6792C12.002 15.7287 12.2112 15.8173 12.4403 15.9698C12.6295 16.0958 12.8245 16.2633 13.0228 16.48C13.1945 16.1726 13.3971 15.8302 13.6271 15.4782C14.0187 14.8772 14.5003 14.2296 15.0528 13.6691C15.6003 13.1143 16.2595 12.6028 17.012 12.3361ZM9.16532 11.8714C9.51032 11.8714 9.79032 12.1513 9.79032 12.4964C9.79032 12.8416 9.51032 13.1214 9.16532 13.1214H5.83203C5.48703 13.1214 5.20703 12.8416 5.20703 12.4964C5.20703 12.1513 5.48703 11.8714 5.83203 11.8714H9.16532ZM12.4987 8.53809C12.8437 8.53809 13.1237 8.81793 13.1237 9.16309C13.1237 9.50826 12.8437 9.78809 12.4987 9.78809H5.83203C5.48703 9.78809 5.20703 9.50826 5.20703 9.16309C5.20703 8.81793 5.48703 8.53809 5.83203 8.53809H12.4987ZM11.457 1.0389V1.66309C11.457 2.26994 11.4562 2.66228 11.417 2.95134C11.3803 3.22242 11.3212 3.3074 11.2737 3.35498C11.2262 3.40256 11.1412 3.46176 10.8704 3.49821C10.5812 3.53706 10.1887 3.53809 9.58199 3.53809H8.74866C8.14203 3.53809 7.74952 3.53706 7.46036 3.49821C7.18952 3.46176 7.10453 3.40256 7.05703 3.35498C7.00953 3.3074 6.95036 3.22242 6.9137 2.95134C6.87453 2.66228 6.8737 2.26994 6.8737 1.66309V1.0389C7.05786 1.03839 7.24786 1.03808 7.44536 1.03809H10.8853C11.0828 1.03808 11.2728 1.03839 11.457 1.0389Z",fill:"#017EF3"})])],-1)),o("span",__,f(A(u)("Processed")),1),o("span",v_,f(c.value.processed)+" / "+f(c.value.total),1)]),o("div",g_,[L[2]||(L[2]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M16.9433 13.0463C16.88 14.0913 16.8292 14.9197 16.725 15.5813C16.6183 16.2605 16.4475 16.8263 16.1067 17.3205C15.7942 17.773 15.3917 18.1547 14.9258 18.4413C14.4158 18.7555 13.8467 18.8922 13.1692 18.958H8.06417C7.38667 18.8922 6.81667 18.7547 6.30667 18.4405C5.84 18.153 5.4375 17.7705 5.125 17.3172C4.78417 16.8222 4.61417 16.2563 4.50833 15.5763C4.405 14.913 4.355 14.083 4.2925 13.0372L3.75 3.95801H17.5L16.9433 13.0463Z",fill:"#189877"}),o("path",{d:"M11.7488 1.06879C12.2196 1.11046 12.6621 1.25462 13.043 1.53796C13.3238 1.74712 13.5188 2.00379 13.6855 2.28212C13.8405 2.53962 13.9963 2.86046 14.173 3.22462L14.528 3.95879H18.1263C18.5863 3.95879 18.9596 4.33129 18.9596 4.79212C18.9596 5.25212 18.5863 5.62546 18.1263 5.62546H3.1263C2.6663 5.62546 2.29297 5.25212 2.29297 4.79212C2.29297 4.33129 2.6663 3.95879 3.1263 3.95879H6.8013L7.09797 3.30796C7.26964 2.93046 7.4213 2.59796 7.5738 2.33129C7.73797 2.04296 7.93214 1.77629 8.21714 1.55796C8.6013 1.26296 9.05297 1.11379 9.53464 1.06962C9.86213 1.03962 10.193 1.04046 10.5221 1.04129C10.5571 1.04129 10.5913 1.04212 10.6263 1.04212C10.6605 1.04212 10.6955 1.04212 10.7288 1.04212C11.1138 1.04212 11.4605 1.04296 11.7488 1.06879ZM8.63297 3.95879H12.6763C12.4871 3.56879 12.3663 3.32212 12.2571 3.13962C12.0963 2.87296 11.9046 2.75546 11.6005 2.72879C11.3846 2.70962 11.103 2.70879 10.6555 2.70879C10.1963 2.70879 9.90714 2.70962 9.68547 2.72962C9.3738 2.75796 9.17964 2.87962 9.0213 3.15712C8.91714 3.33879 8.80464 3.58212 8.63297 3.95879Z",fill:"#189877"})])],-1)),o("span",y_,f(A(u)("Deleted")),1),o("span",b_,f(c.value.deleted),1)]),o("div",w_,[L[3]||(L[3]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M10.0013 1.04004C14.9488 1.04004 18.9596 5.05082 18.9596 9.99833C18.9596 14.9459 14.9488 18.9567 10.0013 18.9567C5.0538 18.9567 1.04297 14.9459 1.04297 9.99833C1.04297 9.54867 1.40778 9.18392 1.85677 9.18375C2.30677 9.18375 2.6722 9.54858 2.6722 9.99833C2.6722 14.0463 5.95297 17.3282 10.0013 17.3282C14.0496 17.3282 17.3304 14.0463 17.3304 9.99833C17.3304 5.95037 14.0496 2.66846 10.0013 2.66846C9.55138 2.66846 9.18764 2.30434 9.18747 1.85466C9.18747 1.40488 9.5513 1.04004 10.0013 1.04004ZM2.80566 4.66634C3.08066 4.35891 3.55043 4.30436 3.89209 4.55241C4.25514 4.81714 4.33519 5.32656 4.07031 5.69011L3.90674 5.92448C3.53507 6.47876 3.23784 7.08712 3.02784 7.73356C2.88857 8.16094 2.42904 8.39483 2.00163 8.25602C1.57424 8.11701 1.33924 7.65747 1.47835 7.22982C1.77169 6.32508 2.20608 5.48362 2.75358 4.73145L2.80566 4.66634ZM7.3125 1.45345C7.71574 1.36659 8.12817 1.59791 8.25814 1.9987C8.39722 2.42644 8.16233 2.88598 7.73486 3.02491L7.46061 3.12011C6.82564 3.35476 6.23137 3.67519 5.69222 4.06738L5.62224 4.11214C5.26557 4.32003 4.80286 4.22905 4.55453 3.88835C4.29044 3.52472 4.37034 3.01452 4.73356 2.74984L5.02084 2.55046C5.69734 2.09692 6.44048 1.7332 7.23194 1.47624L7.3125 1.45345Z",fill:"#F04438"}),o("path",{d:"M11.9754 6.85201C12.3029 6.58506 12.7854 6.6039 13.0904 6.90897C13.3954 7.21407 13.4145 7.69657 13.147 8.02388L13.0904 8.08736L11.1787 9.99808L13.0895 11.9089L13.147 11.9724C13.4137 12.2997 13.3945 12.7823 13.0895 13.0873C12.7845 13.3923 12.302 13.4113 11.9745 13.1442L11.9112 13.0873L10.0012 11.1765L8.09122 13.0873C7.76538 13.4127 7.23789 13.4127 6.91289 13.0873C6.58706 12.7619 6.58706 12.2344 6.91289 11.9089L8.82288 9.99808L6.91206 8.08736L6.85456 8.02388C6.58789 7.69657 6.60706 7.21407 6.91206 6.90897C7.21706 6.6039 7.69955 6.58506 8.02705 6.85201L8.09039 6.90897L10.0012 8.81975L11.912 6.90897L11.9754 6.85201Z",fill:"#F04438"})])],-1)),o("span",C_,f(A(u)("Failed")),1),o("span",B_,f(c.value.failed),1)])]),p.value&&!s.value?(r(),h("p",k_,f(p.value),1)):k("",!0)])]),_:1},8,["modelValue","title"]),n(Pt,{permission:"reports/view"},{default:d(()=>[a.value?(r(),$(Kh,{key:0})):k("",!0)]),_:1}),n(Pt,{permission:"orders/view"},{default:d(()=>[o("div",S_,[n($s,{table:A(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[A(t).isLoading()?(r(),$(s_,{key:0})):k("",!0),A(t).isLoading()?k("",!0):(r(),$(Wr,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:d(()=>[A(t).isLoading()?(r(),$(Zh,{key:0,orderTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),$(Yr,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1})])}}},$_={class:"setting-wrap"},E_={class:"setting-wrap-inner"},U_={class:"setting-confirmation-content"},I_={class:"custom-wp-editor-wrapper"},Q_={class:"setting-save-action"},D_={__name:"InvoicePacking",setup(e){const t=V([]),a=V([]),l=V(!1),s=V(!1);fs().onSave(()=>{_()});const c=V([u("Invoice Template"),u("Packing Slip Template"),u("Delivery Slip Template"),u("Shipping Slip Template"),u("Dispatch Slip Template")]),p=()=>{l.value=!0,ce.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{z.error(g)}).finally(()=>{l.value=!1})},m=()=>{l.value=!0,ce.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{z.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,ce.put("templates/print-templates",{templates:t.value}).then(g=>{z.success(g.message)}).catch(g=>{z.error(g)}).finally(()=>{s.value=!1})};return Qe(()=>{p(),m()}),(g,y)=>{const v=B("el-skeleton");return B("el-button"),r(),h("div",$_,[n(Ea,{heading:A(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",E_,[n(Ua),n(Za,{class:"mb-5",type:"information",content:A(u)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(O,{key:0},ae(c.value,(C,b)=>(r(),$(xe,{key:b},{default:d(()=>[n(Ve,{title:C,border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[n(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):k("",!0),!l.value&&t.value.length>0?(r(),h(O,{key:1},[(r(!0),h(O,null,ae(t.value,(C,b)=>(r(),$(xe,{key:b},{default:d(()=>[n(Ve,{title:C.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",U_,[o("div",I_,[n(Wl,{"short-codes":a.value,modelValue:C.content,"onUpdate:modelValue":w=>C.content=w,onUpdate:w=>{C.content=w}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",Q_,[k("",!0)])],64)):k("",!0)])])}}},V_={class:"fct-pdf-pro-gate"},T_={class:"fct-pdf-pro-gate-inner"},M_={class:"fct-pdf-pro-heading"},L_={class:"fct-pdf-pro-icon"},R_={class:"fct-pdf-pro-label"},O_={class:"fct-pdf-pro-badge"},H_={class:"fct-pdf-pro-desc"},P_={__name:"PdfTemplateProGate",setup(e){return(t,a)=>{const l=B("el-button");return r(),h("div",V_,[o("div",T_,[o("div",M_,[o("div",L_,[n(ee,{name:"Crown"})]),o("span",R_,f(A(u)("PDF Templates")),1),o("span",O_,f(A(u)("Pro")),1)]),o("p",H_,f(A(u)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")),1),n(l,{type:"primary",size:"small",tag:"a",href:"https://fluentcart.com/pricing/",target:"_blank"},{default:d(()=>[n(ee,{name:"Crown"}),R(" "+f(A(u)("Upgrade to Pro")),1)]),_:1})])])}}},N_=lt(P_,[["__scopeId","data-v-83e6a503"]]),K_={__name:"PdfTemplateRoute",setup(e){const t=ze.get("app_config.isProActive");return(a,l)=>{const s=B("router-view");return A(t)?(r(),$(s,{key:1})):(r(),$(N_,{key:0}))}}},G_={class:"setting-wrap"},j_={class:"setting-wrap-inner"},z_={class:"flex gap-5"},q_={class:"flex flex-col items-center justify-center py-12 text-center"},Y_={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},W_={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},X_={class:"fct-pdf-template-desc"},J_={class:"fct-pdf-template-grid"},Z_={class:"fct-pdf-template-preview"},ev={class:"fct-pdf-template-preview-placeholder"},tv={class:"fct-pdf-placeholder-text"},av={class:"fct-pdf-template-overlay"},lv={class:"fct-pdf-template-footer"},sv={class:"fct-pdf-template-name-row"},nv={class:"fct-pdf-template-title"},ov={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},iv={__name:"PdfTemplateIndex",setup(e){const t=tl(),a=V(!0),l=V(!1),s=V({}),i=V(!1),c=V(""),p=V(!1),m=V(""),_=V(null),g=V(!1),y=V(!1),v=ze.get("app_config.isProActive"),C=()=>{a.value=!0,ce.get("settings/pdf-templates/receipt").then(U=>{s.value=U.templates||{},l.value=U.has_fluent_pdf||!1,_.value=U.addon_info||null}).catch(U=>{var S;z.error(((S=U.data)==null?void 0:S.message)||u("Failed to load templates"))}).finally(()=>{a.value=!1})},b=()=>{if(_.value){if(!v&&_.value.repo_link){window.open(_.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,ce.post("settings/modules/plugin-addons/install",{plugin_slug:_.value.plugin_slug,source_type:_.value.source_type||"wordpress",source_link:_.value.source_link||"",asset_path:_.value.asset_path||""}).then(U=>{z.success(U.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(U=>{var S;z.error(((S=U.data)==null?void 0:S.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},w=()=>{_.value&&(y.value=!0,ce.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then(U=>{z.success(U.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(U=>{var S;z.error(((S=U.data)==null?void 0:S.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},x=()=>{c.value="",i.value=!0},F=()=>{if(!c.value.trim()){z.error(u("Please enter a template name"));return}p.value=!0,ce.post("settings/pdf-templates/create",{title:c.value.trim()}).then(U=>{i.value=!1,z.success(U.message||u("Template created")),U.slug?t.push({name:"edit-pdf-template",params:{template:U.slug}}):C()}).catch(U=>{var S;z.error(((S=U.data)==null?void 0:S.message)||u("Failed to create template"))}).finally(()=>{p.value=!1})},L=U=>{m.value=U,ce.delete("settings/pdf-templates/delete/"+U).then(S=>{z.success(S.message||u("Template deleted")),C()}).catch(S=>{var M;z.error(((M=S.data)==null?void 0:M.message)||u("Failed to delete template"))}).finally(()=>{m.value=""})};return Qe(()=>{C()}),(U,S)=>{const M=B("el-button"),I=B("el-skeleton-item"),T=B("el-skeleton"),Q=B("el-popconfirm"),E=B("el-input"),D=B("el-form-item"),H=B("el-form"),P=B("el-dialog");return r(),h("div",G_,[n(Ea,{heading:A(u)("PDF Templates"),"show-save-button":!1},ta({_:2},[l.value?{name:"action",fn:d(()=>[n(M,{type:"primary",size:"small",onClick:x},{default:d(()=>[R(f(A(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",j_,[n(Ua),a.value?(r(),$(xe,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(T,{animated:""},{template:d(()=>[n(I,{variant:"text",class:"w-[300px] mb-4"}),o("div",z_,[n(I,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),n(I,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):k("",!0),!a.value&&!l.value&&_.value?(r(),$(xe,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[o("div",q_,[S[3]||(S[3]=o("svg",{class:"mb-4",width:"48",height:"48",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("h3",Y_,f(A(u)("Fluent PDF Required")),1),o("p",W_,f(A(u)("To use PDF receipt templates, you need to install and activate the Fluent PDF plugin.")),1),_.value.is_installed?_.value.is_installed&&!_.value.is_active?(r(),$(M,{key:1,type:"success",loading:y.value,onClick:w},{default:d(()=>[R(f(A(u)("Activate Plugin")),1)]),_:1},8,["loading"])):k("",!0):(r(),$(M,{key:0,type:"primary",loading:g.value,onClick:b},{default:d(()=>[R(f(A(v)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):k("",!0),!a.value&&l.value?(r(),$(xe,{key:2},{default:d(()=>[n(ke,null,{default:d(()=>[o("p",X_,f(A(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",J_,[(r(!0),h(O,null,ae(s.value,(G,J)=>(r(),h("div",{key:J,class:"fct-pdf-template-card"},[o("div",Z_,[o("div",ev,[S[4]||(S[4]=o("svg",{width:"40",height:"40",viewBox:"0 0 32 32",fill:"none",stroke:"#525866","stroke-width":"1.2"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("span",tv,f(G.title||A(u)("Receipt Template")),1)]),o("div",av,[n(M,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:J}}},{default:d(()=>[R(f(A(u)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",lv,[o("div",sv,[o("span",nv,f(G.title||J),1),G.is_default?(r(),h("span",ov,f(A(u)("Built-in")),1)):k("",!0)]),G.is_default?k("",!0):(r(),$(Q,{key:0,title:A(u)("Delete this template?"),"confirm-button-text":A(u)("Delete"),"cancel-button-text":A(u)("Cancel"),"confirm-button-type":"danger",onConfirm:oe=>L(J)},{reference:d(()=>[n(M,{type:"danger",size:"small",text:"",loading:m.value===J,class:"fct-pdf-delete-btn"},{default:d(()=>S[5]||(S[5]=[o("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M3 6h18"}),o("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])),_:2,__:[5]},1032,["loading"])]),_:2},1032,["title","confirm-button-text","cancel-button-text","onConfirm"]))])]))),128))])]),_:1})]),_:1})):k("",!0)]),n(P,{modelValue:i.value,"onUpdate:modelValue":S[2]||(S[2]=G=>i.value=G),title:A(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[n(M,{onClick:S[1]||(S[1]=G=>i.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(M,{type:"primary",onClick:F,loading:p.value},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(H,{onSubmit:Ne(F,["prevent"]),"label-position":"top"},{default:d(()=>[n(D,{label:A(u)("Template Name")},{default:d(()=>[n(E,{modelValue:c.value,"onUpdate:modelValue":S[0]||(S[0]=G=>c.value=G),placeholder:A(u)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},rv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},dv={class:"fct-email-body-skeleton"},uv={class:"fct-email-body-skeleton__page"},cv={key:0,class:"fct-ebs__badge"},Av={class:"fct-ebs__badge-text"};function pv(e,t,a,l,s,i){return r(),h("div",dv,[o("div",uv,[t[3]||(t[3]=xn('<div class="fct-ebs__skel fct-ebs__header"></div><div style="height:8px;"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div><div style="flex:1;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__grid"><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div></div><div class="fct-ebs__row" style="margin-top:2px;"><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="flex:1;height:12px;"></div></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div></div>',9)),a.showLoadingBadge?(r(),h("div",cv,[t[0]||(t[0]=o("span",{class:"fct-ebs__dot"},null,-1)),t[1]||(t[1]=o("span",{class:"fct-ebs__dot"},null,-1)),t[2]||(t[2]=o("span",{class:"fct-ebs__dot"},null,-1)),o("span",Av,f(e.$t("Loading block editor…")),1)])):k("",!0)])])}const sr=lt(rv,[["render",pv]]),fv={name:"NewEditorFrame",components:{EmailBodySkeleton:sr},props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""}},emits:["update:modelValue","titleUpdated","contentUpdated","editorFullscreenToggle","featuredMediaUpdated","previewRequest","autosaveState"],data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,dataSent:!1,isFailing:!1,iframeReady:!1,pendingDataSend:!1,sendRetries:0,editorReadyReceived:!1,editorContentReady:!1,isFullscreen:!1,_timers:[]}},computed:{editorFailed(){return!this.dataSent&&this.isFailing&&!this.editorReadyReceived}},mounted(){this._setTimeout(()=>{this.editorReadyReceived||(this.isFailing=!0)},3e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){this._timers.forEach(e=>clearTimeout(e)),this._timers=[],window.removeEventListener("message",this.handleEditorMessage),this.isFullscreen&&this.toggleFullScreen(!1),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{_setTimeout(e,t){const a=setTimeout(e,t);return this._timers.push(a),a},createEditorIframe(){this.editorFrame=document.createElement("iframe");let e=this.appVars.fct_editor_frame;if(this.editorParams){const t=new URLSearchParams(this.editorParams);e+="&"+t.toString()}try{this.editorOrigin=new URL(e,window.location.origin).origin}catch{this.editorOrigin=window.location.origin}this.editorFrame.src=e,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.editorFrame.onload=()=>{this.iframeReady=!0,this.pendingDataSend&&(this.pendingDataSend=!1,this._setTimeout(()=>{this.sendDataToEditor()},1e3)),this._setTimeout(()=>{!this.editorReadyReceived&&this.iframeReady&&this.sendDataToEditor()},1e4)},this.$refs.iframeContainer.appendChild(this.editorFrame)},sendDataToEditor(){if(!this.iframeReady||!this.editorFrame||!this.editorFrame.contentWindow){this.pendingDataSend=!0;return}try{const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({action:"UPDATE_EDITOR",data:e},this.editorOrigin),this.dataSent=!0,this.sendRetries=0,this._setTimeout(()=>{this.editorContentReady||(this.editorContentReady=!0)},5e3)}catch{this.sendRetries++,this.sendRetries<=3&&this._setTimeout(()=>{this.sendDataToEditor()},500)}},handleEditorMessage(e){if(e&&e.origin&&this.editorOrigin&&e.origin!==this.editorOrigin)return;const{action:t,content:a}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorContentReady||this._setTimeout(()=>{this.editorContentReady=!0},1500),this.editorData.content=a,this.$emit("update:modelValue",a),this.$emit("contentUpdated",a)):t==="TITLE_UPDATED"?(this.editorData.title=a,this.$emit("titleUpdated",a)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",a):t==="EDITOR_FULLSCREEN_TOGGLE"?this.toggleFullScreen(a):t==="EMAIL_PREVIEW_REQUEST"?this.$emit("previewRequest"):t==="AUTOSAVE_STATE"?this.$emit("autosaveState",a):t==="EDITOR_READY"&&(this.editorReadyReceived=!0,this.isFailing=!1,this.sendDataToEditor())},forceAutosave(){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({action:"FORCE_SAVE"},this.editorOrigin)},toggleFullScreen(e){this.isFullscreen=e;const t=this.editorFrame;if(e){if(document.documentElement.classList.add("fct-editor-fullscreen"),document.body.style.overflow="hidden",t){t.classList.add("fct-fullscreen-iframe"),this._fullscreenAncestors=[];let a=t.parentElement;for(;a&&a!==document.documentElement;)a.classList.add("fct-fullscreen-ancestor"),this._fullscreenAncestors.push(a),a=a.parentElement}}else document.documentElement.classList.remove("fct-editor-fullscreen"),document.body.style.overflow="",t&&t.classList.remove("fct-fullscreen-iframe"),this._fullscreenAncestors&&(this._fullscreenAncestors.forEach(function(a){a.classList.remove("fct-fullscreen-ancestor")}),this._fullscreenAncestors=null);this.$emit("editorFullscreenToggle",e)}}},mv={style:{width:"100%"}},hv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},_v={class:"editor-container",style:{position:"relative"}},vv={key:0,class:"fct-editor-skeleton"},gv={ref:"iframeContainer",class:"iframe-container"};function yv(e,t,a,l,s,i){const c=B("EmailBodySkeleton");return r(),h("div",mv,[i.editorFailed?(r(),h("div",hv,[o("p",null,f(e.$t("Problem with loading the editor. Please reload the page.")),1)])):k("",!0),o("div",_v,[n(Gl,{name:"fct-skeleton-fade"},{default:d(()=>[s.editorContentReady?k("",!0):(r(),h("div",vv,[t[0]||(t[0]=o("div",{class:"fct-skel-menubar"},[o("div",{class:"fct-skel fct-skel-logo"}),o("div",{class:"fct-skel-slash"}),o("div",{class:"fct-skel fct-skel-name"}),o("div",{class:"fct-skel-spacer"}),o("div",{class:"fct-skel fct-skel-btn-wide"}),o("div",{class:"fct-skel-dot"}),o("div",{class:"fct-skel-dot"})],-1)),t[1]||(t[1]=o("div",{class:"fct-skel-toolbar"},[o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"})],-1)),n(c,{"show-loading-badge":!0})]))]),_:1}),o("div",gv,null,512)])])}const jc=lt(fv,[["render",yv],["__scopeId","data-v-e5dae537"]]),bv={class:"setting-wrap fct-pdf-template-edit-wrapper"},wv={class:"capitalize"},Cv={class:"setting-wrap-inner"},Bv={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},kv={class:"setting-save-action"},xv={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=tl(),l=V(!0),s=V(!1),i=V(!1),c=V(!1),p=V(null),m=V(null),_=V(""),g=S=>{const M=atob(S),I=new Array(M.length);for(let T=0;T<M.length;T++)I[T]=M.charCodeAt(T);return new Blob([new Uint8Array(I)],{type:"application/pdf"})},y=async()=>{const S=await ce.post("settings/pdf-templates/download",{template_id:t.template});if(!(S!=null&&S.pdf_base64))throw new Error(u("Failed to generate PDF"));return S},v=()=>{l.value=!0,ce.get("settings/pdf-templates/receipt/"+t.template).then(S=>{var I,T,Q;p.value=S.template;const M=(Q=(T=(I=S.template)==null?void 0:I.pdf_settings)==null?void 0:T[0])==null?void 0:Q.pdf_structure;M&&(_.value=M.content||"")}).catch(S=>{var M;z.error(((M=S.data)==null?void 0:M.message)||u("Failed to load template"))}).finally(()=>{l.value=!1})},C=async({showSuccess:S=!0}={})=>{var I,T,Q,E;s.value=!0,m.value&&await m.value.forceAutosave();const M=((Q=(T=(I=p.value)==null?void 0:I.pdf_settings)==null?void 0:T[0])==null?void 0:Q.pdf_structure)||{};M.content=_.value;try{const D=await ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:M});return S&&z.success(D.message||u("Template saved")),!0}catch(D){return z.error(((E=D.data)==null?void 0:E.message)||u("Failed to save template")),!1}finally{s.value=!1}},b=()=>{i.value=!0,y().then(S=>{const M=g(S.pdf_base64),I=URL.createObjectURL(M),T=document.createElement("a");T.href=I,T.download=S.filename||"receipt-test.pdf",document.body.appendChild(T),T.click(),document.body.removeChild(T),URL.revokeObjectURL(I),z.success(u("PDF downloaded"))}).catch(S=>{var M;z.error(((M=S.data)==null?void 0:M.message)||S.message||u("Failed to generate PDF"))}).finally(()=>{i.value=!1})},w=async()=>{var S;c.value=!0;try{const M=await y(),I=g(M.pdf_base64),T=URL.createObjectURL(I),Q=document.createElement("a");Q.href=T,Q.target="_blank",Q.rel="noopener",document.body.appendChild(Q),Q.click(),document.body.removeChild(Q),setTimeout(()=>{URL.revokeObjectURL(T)},1e4)}catch(M){z.error(((S=M.data)==null?void 0:S.message)||M.message||u("Failed to generate PDF"))}finally{c.value=!1}},x=async()=>{s.value||i.value||c.value||!await C({showSuccess:!1})||await w()},F=()=>p.value&&!p.value.is_default,L=()=>{ce.delete("settings/pdf-templates/delete/"+t.template).then(S=>{z.success(S.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(S=>{var M;z.error(((M=S.data)==null?void 0:M.message)||u("Failed to delete template"))})},U=()=>{ce.get("settings/pdf-templates/factory-default").then(S=>{var T,Q,E;const M=(T=S.templates)==null?void 0:T[t.template];if(!M)return;const I=((E=(Q=M.pdf_settings)==null?void 0:Q[0])==null?void 0:E.pdf_structure)||{};return ce.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:I}).then(()=>{z.success(u("Reverted to default template")),v()})}).catch(S=>{var M;z.error(((M=S.data)==null?void 0:M.message)||u("Failed to revert template"))})};return Qe(()=>{v()}),(S,M)=>{const I=B("el-breadcrumb-item"),T=B("el-breadcrumb"),Q=B("el-icon"),E=B("el-button"),D=B("el-dropdown-item"),H=B("el-dropdown-menu"),P=B("el-dropdown"),G=B("el-skeleton-item"),J=B("el-skeleton");return r(),h("div",bv,[n(Ea,{loading:s.value,"loading-text":A(u)("Saving"),"save-button-text":A(u)("Save Template"),onOnSave:C},{heading:d(()=>[n(T,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[n(I,{to:{path:"/settings/pdf-template"}},{default:d(()=>[R(f(A(u)("PDF Templates")),1)]),_:1}),n(I,null,{default:d(()=>{var oe;return[o("span",wv,f(((oe=p.value)==null?void 0:oe.title)||A(u)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:d(()=>[n(P,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(H,null,{default:d(()=>[n(D,{onClick:b,disabled:i.value},{default:d(()=>[R(f(i.value?A(u)("Downloading..."):A(u)("Test Download")),1)]),_:1},8,["disabled"]),n(D,{onClick:U},{default:d(()=>[R(f(A(u)("Revert to Default")),1)]),_:1}),F()?(r(),$(D,{key:0,divided:"",onClick:L,style:{color:"#F56C6C"}},{default:d(()=>[R(f(A(u)("Delete Template")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[n(E,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[n(Q,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[n(A(If))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",Cv,[n(Ua),n(J,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:d(()=>[n(G,{variant:"h3",class:"w-[200px] mb-5"}),n(G,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(O,{key:0},[o("div",Bv,[n(jc,{ref_key:"editorFrameRef",ref:m,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||A(u)("Receipt Template"),onPreviewRequest:x,modelValue:_.value,"onUpdate:modelValue":M[0]||(M[0]=oe=>_.value=oe)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",kv,[n(E,{onClick:C,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(f(A(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(E,{onClick:b,disabled:i.value,loading:i.value},{default:d(()=>[R(f(A(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):k("",!0)])])}}},Sv={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},fl=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),h("div",Sv,[(r(!0),h(O,null,ae(e.validationErrors,(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))]))}}),_o={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const l=B("el-alert");return r(),$(l,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:d(()=>[Ca(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},Fv={class:"setting-wrap"},$v={class:"setting-wrap-inner"},Ev={class:"grid gap-3 mb-6"},Uv={class:"grid gap-3 mb-6"},Iv={class:"grid gap-3 mb-6"},Qv={class:"grid gap-3"},Dv={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},Vv=["href"],Tv={class:"form-note"},Mv={class:"form-note"},Lv=["href"],Rv={class:"mb-4"},Ov={class:"mb-4"},Hv={class:"form-note"},Pv={class:"form-note"},Nv={class:"form-note"},Kv={class:"form-note"},Gv={class:"setting-save-action"},jv={__name:"PdfTemplateSettings",setup(e){const t=V(!0),a=V(!1),l=V({}),s=V(!0),i=V(""),c=V({zugferd_enabled:"0",zugferd_profile:"en16931",seller_legal_registration_scheme:"",seller_contact_name:"",seller_contact_email:"",seller_contact_phone:"",seller_bank_iban:"",seller_bank_bic:"",seller_bank_account_name:"",seller_electronic_address:""}),p=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],m=[{value:"",label:u("None")},{value:"0002",label:"0002 — SIRENE (France)"},{value:"0009",label:"0009 — SIRET (France)"},{value:"0021",label:"0021 — SWIFT"},{value:"0060",label:"0060 — DUNS"},{value:"0088",label:"0088 — EAN / GS1 GLN"},{value:"0096",label:"0096 — Danish P number"},{value:"0130",label:"0130 — EU Directorates"},{value:"0183",label:"0183 — Swiss UID"},{value:"0184",label:"0184 — Danish CVR"},{value:"0190",label:"0190 — Dutch OIN"},{value:"0191",label:"0191 — Dutch KvK"},{value:"0192",label:"0192 — Dutch Organisation ID"},{value:"0195",label:"0195 — Singapore UEN"},{value:"0196",label:"0196 — Icelandic kennitala"},{value:"0198",label:"0198 — Danish SE"},{value:"0199",label:"0199 — LEI"},{value:"0200",label:"0200 — Lithuanian legal entity"},{value:"0204",label:"0204 — German Leitweg-ID"},{value:"0208",label:"0208 — Belgian CBE / KBO"},{value:"0210",label:"0210 — Italian Codice Fiscale"},{value:"0211",label:"0211 — Italian Partita IVA"},{value:"0213",label:"0213 — Finnish OVT"}];fs().onSave(()=>{y()});const g=()=>{t.value=!0,ce.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(c.value).forEach(C=>{v.seller_details[C]!==void 0&&(c.value[C]=v.seller_details[C])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var C;z.error(((C=v.data)==null?void 0:C.message)||u("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,l.value={},ce.post("settings/pdf-templates/seller-details",c.value).then(v=>{z.success(v.message||u("Settings saved"))}).catch(v=>{var C,b;v.status_code===422&&((C=v.data)!=null&&C.data)&&(l.value=v.data.data),z.error(((b=v.data)==null?void 0:b.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return Qe(()=>{g()}),(v,C)=>{const b=B("el-skeleton-item"),w=B("el-skeleton"),x=B("el-switch"),F=B("el-option"),L=B("el-select"),U=B("el-form-item"),S=B("el-col"),M=B("el-row"),I=B("el-input"),T=B("el-divider"),Q=B("el-button");return r(),h("div",Fv,[n(Ea,{heading:A(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",$v,[n(Ua),t.value?(r(),$(xe,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(w,{animated:""},{template:d(()=>[o("div",Ev,[n(b,{variant:"p",class:"w-[20%]"}),n(b,{variant:"p"})]),o("div",Uv,[n(b,{variant:"p",class:"w-[20%]"}),n(b,{variant:"p"})]),o("div",Iv,[n(b,{variant:"p",class:"w-[20%]"}),n(b,{variant:"p"})]),o("div",Qv,[n(b,{variant:"p",class:"w-[20%]"}),n(b,{variant:"p"})])]),_:1})]),_:1})]),_:1})):k("",!0),t.value?k("",!0):(r(),h(O,{key:1},[c.value.zugferd_enabled==="1"&&!s.value?(r(),h("div",Dv,[o("strong",null,f(A(u)("Store country is not configured.")),1),R(" "+f(A(u)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,class:"underline ml-1"},f(A(u)("Go to Store Settings")),9,Vv)):k("",!0)])):k("",!0),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("E-Invoice Configuration"),text:A(u)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:d(()=>[n(x,{modelValue:c.value.zugferd_enabled,"onUpdate:modelValue":C[0]||(C[0]=E=>c.value.zugferd_enabled=E),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[n(M,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[n(L,{modelValue:c.value.zugferd_profile,"onUpdate:modelValue":C[1]||(C[1]=E=>c.value.zugferd_profile=E)},{default:d(()=>[(r(),h(O,null,ae(p,E=>n(F,{key:E.value,label:E.label,value:E.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",Tv,[o("p",null,f(A(u)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[n(L,{modelValue:c.value.seller_legal_registration_scheme,"onUpdate:modelValue":C[2]||(C[2]=E=>c.value.seller_legal_registration_scheme=E),placeholder:A(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(O,null,ae(m,E=>n(F,{key:E.value,label:E.label,value:E.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",Mv,[o("p",null,f(A(u)("ISO 6523 ICD code for the legal registration identifier")),1)]),n(fl,{"validation-errors":l.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(_o,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:d(()=>[R(f(A(u)("Company Name, VAT ID, Tax ID, and Legal Registration ID are managed in"))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,target:"_blank",class:""},f(A(u)("Store Settings → Business Details")),9,Lv)):k("",!0)]),_:1}),o("h4",Rv,f(A(u)("Seller Contact")),1),n(M,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Contact Name"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_name,"onUpdate:modelValue":C[3]||(C[3]=E=>c.value.seller_contact_name=E)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Contact Email"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_email,"onUpdate:modelValue":C[4]||(C[4]=E=>c.value.seller_contact_email=E),type:"email"},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(M,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_contact_phone,"onUpdate:modelValue":C[5]||(C[5]=E=>c.value.seller_contact_phone=E)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(T),o("h4",Ov,f(A(u)("Seller Bank Details")),1),n(M,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_bank_iban,"onUpdate:modelValue":C[6]||(C[6]=E=>c.value.seller_bank_iban=E)},null,8,["modelValue"]),n(fl,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Hv,[o("p",null,f(A(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_bank_bic,"onUpdate:modelValue":C[7]||(C[7]=E=>c.value.seller_bank_bic=E)},null,8,["modelValue"]),o("div",Pv,[o("p",null,f(A(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(M,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Bank Account Name"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_bank_account_name,"onUpdate:modelValue":C[8]||(C[8]=E=>c.value.seller_bank_account_name=E)},null,8,["modelValue"]),o("div",Nv,[o("p",null,f(A(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(U,{label:A(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[n(I,{modelValue:c.value.seller_electronic_address,"onUpdate:modelValue":C[9]||(C[9]=E=>c.value.seller_electronic_address=E)},null,8,["modelValue"]),o("div",Kv,[o("p",null,f(A(u)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",Gv,[n(Q,{type:"primary",onClick:C[10]||(C[10]=E=>y()),loading:a.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},zv={name:"CustomersRoute"},qv={class:"fca_customers_route"};function Yv(e,t,a,l,s,i){const c=B("router-view");return r(),h("div",qv,[n(c)])}const Wv=lt(zv,[["render",Yv]]);/*! | |
| 1 | +var Nf=Object.defineProperty;var Kf=(e,t,a)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var Pe=(e,t,a)=>Kf(e,typeof t!="symbol"?t+"":t,a);import{r as C,c as E,o as r,w as d,a as n,u as A,b as x,d as o,e as h,f as R,t as m,F as P,g as te,h as T,i as Ie,j as Bt,k as Jt,l as K,m as ga,n as de,p as oa,q as Ge,s as Dn,T as Xl,v as be,x as xe,y as oi,z as xa,A as bl,B as Il,C as yn,D as va,E as gl,G as ra,H as Gf,I as Wt,J as Hc,K as vs,L as Zs,M as cl,N as ii,O as zf,P as Nc,V as Kc,Q as Ds,R as jf,S as ri,U as Va,W as Tl,X as qf,Y as Yf,Z as Gc,_ as Wf,$ as Jf,a0 as Xf,a1 as td,a2 as Zf}from"./chunks/vue.esm-bundler.js?ver=1.6.5";import{u as sl,a as nl,o as zc,c as em,b as tm}from"./chunks/vue-router.js?ver=1.6.5";import{_ as Yt}from"./chunks/preload-helper.js?ver=1.6.5";import{t as u,a as sa,A as ze,_ as kl,p as Io}from"./chunks/Translator.js?ver=1.6.5";import{T as Vs,_ as Ts,a as ad,F as Qo,b as el,P as dn,B as fa,c as jc,m as qc,d as Yc,e as am}from"./chunks/Badge.js?ver=1.6.5";import{_ as Ct,P as ol}from"./chunks/Empty.js?ver=1.6.5";import{a as Hn,E as Fl,m as lm,b as Al,d as Wc,i as ll,c as sm,s as Jc,e as Do,f as ld,g as Xc,p as Od,r as Zc,w as nm,l as en,h as om,j as im,k as sd,n as Vo,t as rm,o as dm,q as um,u as cm,v as Am,x as pm,y as fm,z as mm}from"./chunks/index.js?ver=1.6.5";import{u as eA,_ as tA,a as nd,b as Ea,c as aA,d as lA,L as od,e as di,O as sA,f as ui,P as id,C as as}from"./chunks/OrderCustomerInformation.js?ver=1.6.5";import{_ as Ot,p as Vn}from"./chunks/UserCan.js?ver=1.6.5";import{C as ft,f as Zl,r as Ll}from"./chunks/CurrencyFormatter.js?ver=1.6.5";import{_ as Pa,a as rd,b as dd,c as hm,S as nA,d as oA,A as iA,e as rA}from"./chunks/Activity.js?ver=1.6.5";import{_ as Ba,C as Ve,a as ke,b as Se}from"./chunks/CardBody.js?ver=1.6.5";import{_ as Y}from"./chunks/DynamicIcon.js?ver=1.6.5";import{_ as nt}from"./chunks/_plugin-vue_export-helper.js?ver=1.6.5";import{c as _m,S as Vt,u as vm,h as ln,a as fr,g as dA,f as gm,b as Us,$ as ul,d as ym}from"./chunks/common.js?ver=1.6.5";import{I as at}from"./chunks/IconButton.js?ver=1.6.5";import{M as tl}from"./chunks/Model.js?ver=1.6.5";import{R as Ae}from"./chunks/Rest.js?ver=1.6.5";import{d as lt,g as bm}from"./chunks/dayjs.min.js?ver=1.6.5";import{n as q}from"./chunks/Notify.js?ver=1.6.5";import{_ as ya}from"./chunks/Animation.js?ver=1.6.5";import{_ as ls,T as Te,m as Oa,a as Gl,i as na,r as wm,L as mr,b as uA,d as cA,c as AA}from"./chunks/dateShortCuts.js?ver=1.6.5";import{S as Ua,_ as Ia,u as bs,a as Cm,b as km,c as Bm}from"./chunks/countries.js?ver=1.6.5";import{u as ws,L as pa,_ as ci}from"./chunks/NotFound.js?ver=1.6.5";import{c as Ql,a as wl,b as za,e as Tn,i as ud,U as cd,p as xm}from"./chunks/Utils.js?ver=1.6.5";import{A as gs}from"./chunks/Asset.js?ver=1.6.5";import{E as Sm}from"./chunks/index2.js?ver=1.6.5";import{S as da}from"./chunks/Str.js?ver=1.6.5";import{A as dt}from"./chunks/Arr.js?ver=1.6.5";import{C as ks,V as sn,_ as Aa,c as Mn,a as Bo,b as Fm,d as $m}from"./chunks/AttrGroups.js?ver=1.6.5";import{U as nn}from"./chunks/Url.js?ver=1.6.5";import{p as Em,E as Os,v as Um,i as Im}from"./chunks/DynamicTemplateParser.js?ver=1.6.5";import{u as Ai,t as pA}from"./chunks/timezone.js?ver=1.6.5";import{_ as un,P as fA}from"./chunks/ProductVariationSelector.js?ver=1.6.5";import{f as Kt,a as Qm,p as Dm,b as Vm,g as Tm,c as Mm,d as Lm}from"./chunks/productService.js?ver=1.6.5";import{B as To}from"./chunks/BundleProducts.js?ver=1.6.5";import{m as Pd,n as Rm,s as Om,a as Pm,i as Hd,r as Hm,b as Nm,g as Nd,c as Kd,d as Km,e as Gm,f as zm,h as jm,j as qm,k as Ym,l as Wm}from"./chunks/galleryTabs.js?ver=1.6.5";import{E as Gd}from"./chunks/index3.js?ver=1.6.5";import{T as zd}from"./chunks/TransitionAccordion.js?ver=1.6.5";import{_ as mA}from"./chunks/FileUploaderDialog.js?ver=1.6.5";import Jm from"./chunks/Screenshot.js?ver=1.6.5";import{u as Xm}from"./chunks/useElementPlusComponents.js?ver=1.6.5";import"./chunks/AddressComponent2.js?ver=1.6.5";import"./chunks/weekOfYear.js?ver=1.6.5";import"./chunks/index4.js?ver=1.6.5";class Zm extends Vs{getTabs(){return{}}getToggleableColumns(){return[{label:u("Lifetime Value (LTV)"),value:"ltv"},{label:u("Customer Since"),value:"customer_since"},{label:u("Last Purchase Date"),value:"last_purchase_date"}]}getSearchHint(){return u("Search by, #ID, First Name, Last Name and Email")}getFetchUrl(){return"customers"}parseResponse(t){return t.customers}getTableName(){return"customers"}}function hA(e){return Zm.init(e)}const eh={class:"table-cell"},th={class:"fct-product-info-card w-full"},ah={class:"fct-product-info-media"},lh={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},sh={class:"fct-product-info-name flex flex-col items-start gap-3"},nh={class:"table-cell"},oh={class:"table-cell"},ih={class:"table-cell"},rh={class:"table-cell"},dh={class:"table-cell"},uh={__name:"CustomersLoader",props:{nextPageCount:{type:Number,default:0},customerTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-table-column"),p=C("el-table"),f=C("el-skeleton");return r(),E(f,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive"},{default:d(()=>[n(c,{label:l.$t("Customer"),width:"340"},{default:d(()=>[o("div",eh,[o("div",th,[o("div",ah,[n(i,{variant:"image",class:"w-10 h-10.5 rounded-full flex-none"})]),o("div",lh,[o("div",sh,[n(i,{variant:"p",class:"max-w-[190px]"}),n(i,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),n(c,{label:l.$t("Address"),width:"340"},{default:d(()=>[o("div",nh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{label:l.$t("Purchases"),width:"102"},{default:d(()=>[o("div",oh,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),e.customerTable.isColumnVisible("ltv")?(r(),E(c,{key:0,label:l.$t("LTV"),width:"113"},{default:d(()=>[o("div",ih,[n(i,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("last_purchase_date")?(r(),E(c,{key:1,label:l.$t("Last Purchase Date"),width:"226"},{default:d(()=>[o("div",rh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.customerTable.isColumnVisible("customer_since")?(r(),E(c,{key:2,label:l.$t("Customer Since"),width:"170"},{default:d(()=>[o("div",dh,[n(i,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),_:1})}}},ch={key:0,class:"fct-customer-card"},Ah={class:"fct-customer-avatar"},ph=["src"],fh={class:"fct-customer-details"},mh={class:"fct-customer-name"},hh={class:"fct-customer-id"},_h={class:"fct-customer-email"},vh=["innerHTML"],gh={key:1},yh={__name:"CustomersTable",props:{table:{type:Object,required:!0}},emits:["selectionChange"],setup(e,{emit:t}){const a=t,l=s=>{a("selectionChange",s)};return(s,i)=>{const c=C("el-table-column"),p=C("el-table");return r(),E(p,{data:e.table.getTableData(),class:"w-full compact-table",onSelectionChange:l},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No customer found!")},null,8,["text"])]),default:d(()=>[n(c,{type:"selection",width:"45"}),n(c,{label:A(u)("Customer"),width:"300"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>{var g,y,v,w,k;return[(g=f.row)!=null&&g.id?(r(),h("div",ch,[o("div",Ah,[o("span",null,[o("img",{src:(y=f.row)==null?void 0:y.photo,alt:"avatar"},null,8,ph)])]),o("div",fh,[o("div",mh,[R(m(((v=f.row)==null?void 0:v.full_name)||A(u)("No Name"))+" ",1),o("span",hh,"#"+m(A(sa)((w=f.row)==null?void 0:w.id)),1)]),o("div",_h,m((k=f.row)==null?void 0:k.email),1)])])):x("",!0)]}),_:2},1032,["to"])]}),_:1},8,["label"]),n(c,{label:A(u)("Address"),width:"300"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[R(m(s.getOrderAddress(f.row)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),n(c,{label:A(u)("Purchases"),width:90},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[R(m(A(sa)(f.row.purchase_count)),1)]),_:2},1032,["to"])]}),_:1},8,["label"]),e.table.isColumnVisible("ltv")?(r(),E(c,{key:0,label:A(u)("LTV"),width:100},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[o("span",{innerHTML:A(ft).formatNumber(f.row.ltv,!0,!1)},null,8,vh)]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),E(c,{key:1,label:A(u)("Last Purchase Date"),width:"200"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[f.row.last_purchase_date?(r(),E(Pa,{key:0,"date-time":f.row.last_purchase_date},null,8,["date-time"])):(r(),h("span",gh,"---"))]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),E(c,{key:2,label:A(u)("Customer Since"),width:"150"},{default:d(f=>{var _;return[n(Ba,{class:"hover:no-underline",to:{name:"view_customer",params:{customer_id:(_=f.row)==null?void 0:_.id}}},{default:d(()=>[n(Pa,{"date-time":f.row.created_at},null,8,["date-time"])]),_:2},1032,["to"])]}),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},bh={class:"fct-customer-table-mobile-wrap"},wh=["onClick"],Ch={class:"fct-customer-table-mobile-header"},kh={key:0,class:"fct-customer-table-customer-col fct-customer-card"},Bh={class:"fct-customer-avatar"},xh=["src"],Sh={class:"fct-customer-details"},Fh={class:"fct-customer-name"},$h={class:"fct-customer-id"},Eh={class:"fct-customer-email"},Uh={class:"fct-customer-table-purchases-col"},Ih={class:"fct-customer-table-mobile-body"},Qh={class:"fct-customer-table-mobile-body-list"},Dh={key:0,class:"fct-customer-table-ltv-col"},Vh={class:"label"},Th=["innerHTML"],Mh={key:1,class:"fct-customer-table-last-purchase-date-col"},Lh={class:"label"},Rh={class:"value"},Oh={key:2,class:"fct-customer-table-customer-since-col"},Ph={class:"label"},Hh={class:"value"},Nh={class:"fct-customer-table-mobile-footer"},Kh={class:"fct-customer-table-address-col"},Gh={key:0,class:"py-6 text-center"},zh={__name:"CustomersTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){return(t,a)=>(r(),h("div",bh,[(r(!0),h(P,null,te(e.table.getTableData(),(l,s)=>(r(),h("div",{key:l.id,class:"fct-customer-table-mobile-row",onClick:i=>t.$router.push({name:"view_customer",params:{customer_id:l.id}})},[o("div",Ch,[l!=null&&l.id?(r(),h("div",kh,[o("div",Bh,[o("img",{src:l==null?void 0:l.photo,alt:"avatar"},null,8,xh)]),o("div",Sh,[o("div",Fh,[R(m((l==null?void 0:l.full_name)||A(u)("No Name"))+" ",1),o("span",$h,"#"+m(l==null?void 0:l.id),1)]),o("div",Eh,m(l==null?void 0:l.email),1)])])):x("",!0),o("div",Uh,m(l.purchase_count)+" "+m(l.purchase_count>1?A(u)("Purchases"):A(u)("Purchase")),1)]),o("div",Ih,[o("ul",Qh,[e.table.isColumnVisible("ltv")?(r(),h("li",Dh,[o("div",Vh,m(A(u)("LTV:")),1),o("div",{class:"value",innerHTML:A(ft).formatNumber(l.ltv,!0,!1)},null,8,Th)])):x("",!0),e.table.isColumnVisible("last_purchase_date")?(r(),h("li",Mh,[o("div",Lh,m(A(u)("Last Purchase Date:")),1),o("div",Rh,[n(Pa,{"date-time":l.last_purchase_date},null,8,["date-time"])])])):x("",!0),e.table.isColumnVisible("customer_since")?(r(),h("li",Oh,[o("div",Ph,m(A(u)("Customer Since:")),1),o("div",Hh,[n(Pa,{"date-time":l.created_at},null,8,["date-time"])])])):x("",!0)])]),o("div",Nh,[o("div",Kh,[n(Y,{name:"LocationPin"}),R(" "+m(t.getOrderAddress(l)),1)])])],8,wh))),128)),e.table.getTableData().length===0?(r(),h("div",Gh,[n(Ct,{icon:"Empty/Order","has-dark":"",text:e.emptyText},null,8,["text"])])):x("",!0)]))}},jh={},qh={class:"px-4 py-3"},Yh={class:"flex items-center justify-between mb-3"},Wh={class:"flex items-center justify-between mb-3"},Jh={class:"flex items-center justify-between mb-3"},Xh={class:"flex items-center justify-between mb-3"};function Zh(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",qh,[o("div",Yh,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",Wh,[n(a,{varient:"p",class:"w-[50px]"}),n(a,{varient:"p",class:"w-[80px]"})]),o("div",Jh,[n(a,{varient:"p",class:"w-[120px]"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",Xh,[n(a,{varient:"p",class:"w-[100px]"}),n(a,{varient:"p",class:"w-[100px]"})]),n(a,{varient:"p",class:"w-[230px]"})])]),_:1})}const e_=nt(jh,[["render",Zh]]),t_={class:"fct-all-customers-page fct-layout-width"},a_={class:"fct-all-customers-wrap"},l_={key:1},s_={__name:"AllCustomers",setup(e){const t=hA(),a=T({showModal:!1,action:"create",title:u("Create New Customer"),customer:{}}),l=T(!1),s=T(!1),i=T([]),c=(y=!0)=>{const v=t.buildQueryParams();return y||(delete v.active_view,delete v.filter_type,delete v.search,delete v.advanced_filters),v},p=eA({entity:"customers",buildParams:()=>c(),buildAllParams:()=>c(!1),filenamePrefix:"customers-export"}),f=({scope:y,columns:v,modules:w,format:k})=>{let b=[];y==="current_page"?b=t.getTableData().map(S=>S.id).filter(Boolean):y==="selected"&&(b=i.value.map(S=>S.id).filter(Boolean)),p.startExport({scope:y,ids:b,columns:v,modules:w,format:k})},_=y=>{i.value=y},g=()=>{l.value=window.innerWidth<768};return Ie(()=>{g(),window.addEventListener("resize",g)}),Bt(()=>{window.removeEventListener("resize",g)}),(y,v)=>{const w=C("el-icon"),k=C("el-button"),b=C("el-dropdown-item"),S=C("el-dropdown-menu"),$=C("el-dropdown");return r(),h("div",t_,[n(ol,{title:A(u)("Customers")},{action:d(()=>[n(Ot,{permission:"customers/export"},{default:d(()=>[n($,{trigger:"click","popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[n(b,{onClick:v[0]||(v[0]=D=>s.value=!0)},{default:d(()=>[n(Y,{name:"Download"}),R(" "+m(A(u)("Export Customers")),1)]),_:1})]),_:1})]),default:d(()=>[n(k,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(w,null,{default:d(()=>[n(A(Hn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"customers/manage"},{default:d(()=>[n(k,{type:"primary",onClick:v[1]||(v[1]=D=>a.value.showModal=!0)},{default:d(()=>[R(m(A(u)("Add Customer")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Ot,{permission:"customers/view"},{default:d(()=>[o("div",a_,[n(Ts,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(e_,{key:0})):x("",!0),n(zh,{table:A(t)},null,8,["table"])]),default:d(()=>[A(t).isLoading()?(r(),E(uh,{key:0,customerTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["customerTable","next-page-count"])):(r(),h("div",l_,[n(yh,{table:A(t),onSelectionChange:_},null,8,["table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"customers/manage"},{default:d(()=>[n(nd,{"onUpdate:customerModal":v[2]||(v[2]=()=>{a.value.showModal=!1,a.value.customer={},A(t).fetch()}),customerModalInfos:a.value,customer_id:a.value.customer_id,customer:a.value.customer,onCloseModal:v[3]||(v[3]=D=>a.value.showModal=!1)},null,8,["customerModalInfos","customer_id","customer"])]),_:1}),n(tA,{modelValue:s.value,"onUpdate:modelValue":v[4]||(v[4]=D=>s.value=D),title:A(u)("Export Customers"),"selected-count":i.value.length,"current-page-count":A(t).getTableData().length,"total-count":A(t).data.paginate.total,"item-label-singular":A(u)("customer"),"item-label-plural":A(u)("customers"),"has-active-filter":!!A(t).isFiltering(),"export-state":A(p),onExport:f},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}};class n_ extends Vs{getTabs(){return{all:u("All"),completed:u("Completed"),processing:u("Processing"),"on-hold":u("On Hold"),paid:u("Paid"),subscription:u("Subscription"),renewal:u("Renewal"),refunded:u("Refunded"),partially_refunded:u("Partially Refunded"),upgraded_from:{title:u("Upgraded From"),description:u("Orders upgraded from another order")},upgraded_to:{title:u("Upgraded To"),description:u("Orders upgraded to another order")}}}getToggleableColumns(){return[{label:u("Customer"),value:"customer"},{label:u("Items"),value:"order_items"},{label:u("Order Status"),value:"status"},{label:u("Order Type"),value:"type"},{label:u("Actions"),value:"actions"}]}getSearchHint(){return u("Search by invoice no, customer name, or customer email.")}getFetchUrl(){return"orders"}parseResponse(t){return t.orders}getTableName(){return"order_table"}with(){return["admin_order_list"]}}function _A(e){return n_.init(e)}const o_={class:"fct-order-stats-card"},i_={class:"fct-order-stats-card-head"},r_={class:"fct-order-stats-card-head-content"},d_={class:"text"},u_={key:0,class:"value"},c_={class:"fct-order-stats-card-body"},A_={key:0,class:"change-wrap"},p_={key:0,class:"change-title"},f_={key:1,class:"change-title"},m_={key:1,class:"change-wrap"},h_={class:"change-title"},__={__name:"StatCard",props:{direction:String,stat:Object,statRanges:Object,currentRange:String|Number,statKey:String|Number,loading:Boolean},setup(e){const t=Jt().ctx,a=e,l=K(()=>{switch(a.statKey){case"total_orders":return"warning";case"paid_orders":return"blue";case"total_paid_order_items":return"danger";case"total_paid_amounts":return"secondary";default:return"info"}}),s=K(()=>c.value===0?"":c.value>0?"success":"danger"),i=f=>f.is_cents?t.formatNumber(f.current_count):sa(f.current_count),c=K(()=>{let f=_m(a.stat.current_count,a.stat.compare_count)??0;return f===""?0:f}),p=K(()=>a.statRanges[a.currentRange].label);return(f,_)=>{const g=C("el-skeleton"),y=C("el-skeleton-item");return r(),h("div",o_,[o("div",i_,[n(at,{size:"large",bg:l.value,soft:""},{default:d(()=>[ga(f.$slots,"icon")]),_:3},8,["bg"]),o("div",r_,[n(g,{loading:e.loading,animated:"",rows:0},null,8,["loading"]),o("span",d_,m(e.stat.title),1),e.loading?x("",!0):(r(),h("div",u_,m(i(e.stat)),1))])]),o("div",c_,[n(g,{loading:e.loading,animated:""},{template:d(()=>[n(y,{variant:"p",class:"w-1/2 h-4"})]),_:1},8,["loading"]),!e.loading&&e.currentRange!=="all_time"?(r(),h("div",A_,[o("span",{class:de("change "+s.value)},[c.value!==0?(r(),E(Y,{key:0,name:c.value>0?"CaretUp":"CaretDown"},null,8,["name"])):x("",!0),R(" "+m(c.value===0?f.$t("Same as previous"):Math.abs(c.value)+"%"),1)],2),c.value>0?(r(),h("span",p_,m(A(u)("More than %s",p.value==="Today"?f.$t("Yesterday"):f.$t(p.value))),1)):c.value<0?(r(),h("span",f_,m(A(u)("Less than %s",p.value==="Today"?f.$t("Yesterday"):f.$t(p.value))),1)):x("",!0)])):x("",!0),!e.loading&&e.currentRange==="all_time"?(r(),h("div",m_,[o("span",h_,m(f.$t("All Time")),1)])):x("",!0)])])}}},v_={name:"CardFooter"},g_={class:"fct-card-footer"};function y_(e,t,a,l,s,i){return r(),h("div",g_,[ga(e.$slots,"default")])}const Ad=nt(v_,[["render",y_]]);class vA{constructor(){Pe(this,"_attributes",{})}attribute(t,a){return this._attributes[t]=a,this}setAttribute(t){return this._attributes=typeof t=="object"?t:this._attributes,this}}class ms{static install(t,a,l={},s=!1){const i=new a(...Object.values(l));Object.keys(i).forEach(c=>{(s||!t.hasOwnProperty(c))&&(t[c]=i[c])}),Object.getOwnPropertyNames(a.prototype).forEach(c=>{c!=="constructor"&&typeof i[c]=="function"&&(s||typeof t[c]!="function")&&(t[c]=i[c].bind(t))})}}class b_ extends tl{constructor(){super(...arguments);Pe(this,"data",{salesGrowthChart:[],countryHeatMap:[],fluctuations:[],dashBoardStats:[],recentOrders:[],recentActivities:[],topSoldProducts:[],currencySign:ze.get("shop.currency_sign"),isBusy:{recentActivities:!1,fluctuations:!1,dashBoardStats:!1,recentOrders:!1,countryHeatMap:!1,salesGrowthChart:!0,topSoldProducts:!0}})}get controllerKey(){return"ReportingController"}beforeInit(){}makeRequest(a,l,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}getSalesGrowthChart(a={}){return this.makeRequest("sales-growth-chart",a,"salesGrowthChart","salesGrowthChart")}getCountryHeatMap(a={}){return this.makeRequest("country-heat-map",a,"countryHeatMap","countryHeatMap")}getRecentOrders(a={}){return this.makeRequest("get-recent-orders",a,"recentOrders","recentOrders")}getRecentActivities(a={}){return this.makeRequest("get-recent-activities",a,"recentActivities","recentActivities")}getSummary(a={}){return this.makeRequest("get-dashboard-summary",a,"summaryData","summaryData")}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const rl=b_.init(),w_={},C_={class:"fct-order-stats-row"},k_={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},B_={class:"flex items-center gap-2 mb-3"},x_={class:"right flex flex-col flex-1 gap-2"};function S_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",C_,[(r(),h(P,null,te(4,s=>n(l,{animated:"",key:s},{template:d(()=>[o("div",k_,[o("div",B_,[n(a,{variant:"p",class:"rounded w-10 h-10 block"}),o("div",x_,[n(a,{variant:"p",class:"rounded w-4/5 block"}),n(a,{variant:"p",class:"rounded w-1/2 block"})])]),o("div",null,[n(a,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64))])}const F_=nt(w_,[["render",S_]]),$_={class:"fct-order-stats-wrap"},E_={class:"fct-order-stats-actions flex items-center gap-2.5"},U_={class:"fct-order-stats-body"},I_={key:1,class:"fct-order-stats-row"},Q_={class:"flex justify-end mt-2"},D_=Object.assign({name:"OrderStatBar"},{__name:"OrderStatBar",setup(e){const t=T(Vt.get("order_stat_collapse",!1)),a=T(""),l=Jt().ctx,s=T(!1),i=T(!0),c=T(!1),p=T("-7 days"),f=sl(),_=T({"-0 days":{label:u("Today"),desc:u("Compared to yesterday")},"-7 days":{label:u("Last 7 days"),desc:u("Compared to the previous 7 days")},"-30 days":{label:u("Last 30 days"),desc:u("Compared to the previous 30 days")},this_month:{label:u("This Month"),desc:u("Compared to the previous Month")},all_time:{label:u("All Time"),desc:u("See All time Sales Stat")}}),g=async v=>{if(p.value!==v)try{p.value=v,a.value="collapse",t.value===!0&&(t.value=!1,Vt.set("order_stat_collapse",t.value)),await Promise.all([l.Storage().set("order_quick_stat_bar_range",p.value),y()])}catch{}},y=()=>{c.value=!1,i.value=!0;const v={"-0 days":[lt().startOf("day").format("YYYY-MM-DD"),lt().endOf("day").format("YYYY-MM-DD")],"-7 days":[lt().subtract(7,"days").startOf("day").format("YYYY-MM-DD"),lt().endOf("day").format("YYYY-MM-DD")],"-30 days":[lt().subtract(30,"days").startOf("day").format("YYYY-MM-DD"),lt().endOf("day").format("YYYY-MM-DD")],this_month:[lt().startOf("month").format("YYYY-MM-DD"),lt().endOf("day").format("YYYY-MM-DD")],all_time:[null,null]},[w,k]=v[p.value]||[lt().startOf("month"),lt().endOf("day")],b={startDate:w,endDate:k,paymentStatus:"all"};rl.getDashboardStats({params:{...b}}).then(()=>{s.value=rl.data.dashBoardStats}).catch(S=>{}).finally(()=>{i.value=!1})};return Ie(()=>{p.value=Vt.get("order_quick_stat_bar_range","-0 days");let v=Vt.get("order_quick_stat_bar_collapse_item");a.value=v===null?"collapse":v,y()}),(v,w)=>{const k=C("el-button");return r(),h("div",$_,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Order Stats Overview"),border_bottom:""},{action:d(()=>[o("div",E_,[n(ad,{class:"hide-animation-on-mobile"},{default:d(()=>[(r(!0),h(P,null,te(_.value,(b,S)=>(r(),E(Qo,{title:`${A(u)("Order Stats Overview of")} ${b.label}`,tabindex:"0",key:S,onClick:$=>g(S),class:de(S===p.value?"active":"")},{default:d(()=>[R(m(b.label),1)]),_:2},1032,["title","onClick","class"]))),128))]),_:1})])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[o("div",U_,[i.value?(r(),E(F_,{key:0})):(r(),h("div",I_,[(r(!0),h(P,null,te(s.value,(b,S)=>(r(),h("div",{key:S,class:"fct-order-stats-col cursor-pointer",onClick:w[0]||(w[0]=$=>A(f).push({name:"reports_orders"}))},[(r(),E(__,{key:S,stat:b,"current-range":p.value,"stat-ranges":_.value,loading:i.value,"stat-key":S},{icon:d(()=>[n(Y,{name:b.icon},null,8,["name"])]),_:2},1032,["stat","current-range","stat-ranges","loading","stat-key"]))]))),128))])),o("div",Q_,[n(k,{text:"",class:"underline-link-button",onClick:w[1]||(w[1]=b=>A(f).push({name:"reports_orders"}))},{default:d(()=>[R(m(A(u)("See Full Report")),1)]),_:1})])])]),_:1})]),_:1})])}}}),V_={class:"table-cell"},T_={class:"table-cell"},M_={class:"table-cell"},L_={class:"table-cell"},R_={class:"table-cell items-center gap-1"},O_={class:"table-cell"},P_={class:"table-cell"},H_={class:"table-cell"},N_={__name:"OrdersLoader",props:{nextPageCount:{type:Number,default:0},orderTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=s=>t.orderTable.columns.includes(s),l=Array.from({length:t.nextPageCount},(s,i)=>i+1);return(s,i)=>{const c=C("el-table-column"),p=C("el-skeleton-item"),f=C("el-table"),_=C("el-skeleton");return r(),E(_,{animated:""},{template:d(()=>[n(f,{data:A(l),class:"w-full compact-table responsive"},{empty:d(()=>i[0]||(i[0]=[])),default:d(()=>[x("",!0),n(c,{label:s.$t("Date"),width:"140"},{default:d(()=>[o("div",V_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),a("customer")?(r(),E(c,{key:1,width:"130",label:s.$t("Customer")},{default:d(()=>[o("div",T_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("order_items")?(r(),E(c,{key:2,label:s.$t("Items"),width:"402"},{default:d(()=>[o("div",M_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),n(c,{width:"150",label:s.$t("Total")},{default:d(()=>[o("div",L_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"]),n(c,{width:"150",label:s.$t("Payment Status")},{default:d(()=>[o("div",R_,[n(p,{variant:"p",class:"w-4/5"}),n(p,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"]),a("status")?(r(),E(c,{key:3,width:"120",label:s.$t("Status")},{default:d(()=>[o("div",O_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("type")?(r(),E(c,{key:4,width:"140",label:s.$t("Order Type")},{default:d(()=>[o("div",P_,[n(p,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),a("actions")?(r(),E(c,{key:5,width:"60",label:""},{default:d(()=>[o("div",H_,[n(p,{variant:"p",class:"w-3/5"})])]),_:1})):x("",!0)]),_:1},8,["data"])]),_:1})}}},K_={},G_={class:"px-4 py-3"},z_={class:"grid grid-cols-3 gap-5 mt-5"};function j_(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",G_,[(r(),h(P,null,te(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",z_,[(r(),h(P,null,te(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const q_=nt(K_,[["render",j_]]),Y_={class:"fct-all-orders-page fct-layout-width"},W_={class:"fct-delete-test-orders-content"},J_={if:"deleteTestOrdersProgressTitle",class:"fct-delete-test-orders-title"},X_={class:"fct-delete-test-orders-meta"},Z_={class:"fct-delete-test-orders-text"},ev={key:0,class:"fct-delete-test-orders-loading"},tv={class:"fct-test-orders-loading-content"},av={class:"fct-loading-bars"},lv=["id"],sv={class:"fct-delete-test-orders-percentage"},nv={class:"fct-delete-test-orders-stats"},ov={class:"fct-delete-test-orders-stat-row"},iv={class:"fct-delete-test-orders-stat-label"},rv={class:"fct-delete-test-orders-stat-value"},dv={class:"fct-delete-test-orders-stat-row"},uv={class:"fct-delete-test-orders-stat-label"},cv={class:"fct-delete-test-orders-stat-value is-success"},Av={class:"fct-delete-test-orders-stat-row"},pv={class:"fct-delete-test-orders-stat-label"},fv={class:"fct-delete-test-orders-stat-value is-danger"},mv={key:1,class:"fct-delete-test-orders-message"},hv={key:0,class:"dialog-footer"},_v={class:"fct-all-orders-wrap"},vv={__name:"AllOrders",setup(e){const t=_A({instance:Jt()}),a=T(!1),l=T(!1),s=T(!1),i=T(!1),c=T({total:0,processed:0,deleted:0,failed:0}),p=T(""),f=T(!1),_=T([]),g=(V=!0)=>{const I=t.buildQueryParams();return V||(delete I.active_view,delete I.filter_type,delete I.search,delete I.advanced_filters),I},y=eA({entity:"orders",buildParams:()=>g(),buildAllParams:()=>g(!1),filenamePrefix:"orders-export"}),v=({scope:V,columns:I,modules:M,format:O})=>{let L=[];V==="current_page"?L=t.getTableData().map(H=>H.id).filter(Boolean):V==="selected"&&(L=_.value.map(H=>H.id).filter(Boolean)),y.startExport({scope:V,ids:L,columns:I,modules:M,format:O})},w=V=>{_.value=V},k=K(()=>c.value.total?Math.min(100,Math.round(c.value.processed/c.value.total*100)):0),b=K(()=>{if(!c.value.total)return"";const V=Math.min(c.value.processed,c.value.total);return s.value?u("Deleting %1$s of %2$s Test Orders",V,c.value.total):u("Deleted %1$s of %2$s Test Orders",V,c.value.total)}),S=K(()=>c.value.total?s.value?u("Deleting... %1$s",`${k.value}%`):u("Completed"):""),$=()=>{l.value=window.innerWidth<768},D=()=>{c.value={total:0,processed:0,deleted:0,failed:0},p.value=""},F=V=>{V==="show_order_stats"&&(Vt.set("show_order_stats",!a.value),a.value=!a.value),V==="show_delete_bulk_action"&&t.showBulkDeleteAction(!0),V==="hide_delete_bulk_action"&&t.showBulkDeleteAction(!1),V==="delete_test_orders"&&B()},B=async()=>{var V,I;if(!s.value){try{await Fl.confirm(u("Are you sure you want to delete all test orders? This action cannot be undone."),u("Confirm Delete!"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"})}catch{return}s.value=!0,i.value=!0,D();try{let M=0,O=0,L=0;for(;;){const j=await Ae.post("orders/do-bulk-action",{action:"delete_test_orders",last_order_id:M}),W=j||{};if(O=O||Number(W.total_count||0),L+=Number(W.batch_count||0),c.value={total:O,processed:L,deleted:c.value.deleted+Number(W.deleted_count||0),failed:c.value.failed+Number(W.failed_count||0)},p.value=W.has_more?u("Processed %1$s of %2$s test orders...",Math.min(L,O),O):(j==null?void 0:j.message)||"",!W.has_more)break;M=Number(W.last_attempted_order_id||0),await new Promise(G=>setTimeout(G,100))}if(!c.value.total){i.value=!1,q.info(u("No test orders found to delete"));return}const H=c.value.failed?u("Deleted %1$s test orders. %2$s test orders could not be deleted.",c.value.deleted,c.value.failed):u("Deleted %s test orders successfully",c.value.deleted);p.value=H,q.success(H),t.fetch()}catch(M){p.value=((V=M==null?void 0:M.data)==null?void 0:V.message)||u("Failed to delete test orders"),q.error(((I=M==null?void 0:M.data)==null?void 0:I.message)||u("Failed to delete test orders"))}finally{s.value=!1}}},U=()=>{i.value=!1},Q=()=>{const V=Vt.get("show_order_stats");V&&(a.value=V)};return Ie(()=>{Q(),$(),window.addEventListener("resize",$)}),Bt(()=>{window.removeEventListener("resize",$)}),(V,I)=>{const M=C("el-icon"),O=C("el-button"),L=C("el-dropdown-item"),H=C("el-dropdown-menu"),j=C("el-dropdown"),W=C("el-tag"),G=C("el-progress"),Z=C("el-dialog");return r(),h("div",Y_,[n(ol,{title:A(u)("Orders")},{action:d(()=>[n(Ot,{permission:["reports/view","orders/manage","orders/export","orders/delete"]},{default:d(()=>[n(j,{trigger:"click","popper-class":"fct-dropdown",onCommand:F,placement:"bottom-end"},{dropdown:d(()=>[n(H,null,{default:d(()=>[n(Ot,{permission:"reports/view"},{default:d(()=>[n(L,{command:"show_order_stats"},{default:d(()=>[a.value?(r(),h(P,{key:1},[n(Y,{name:"EyeOff"}),R(" "+m(A(u)("Hide Order Stats")),1)],64)):(r(),h(P,{key:0},[n(Y,{name:"Eye"}),R(" "+m(A(u)("Show Order Stats")),1)],64))]),_:1}),A(t).data.showDeleteBulkAction?x("",!0):(r(),E(L,{key:0,command:"show_delete_bulk_action"},{default:d(()=>[n(Y,{name:"Eye"}),R(" "+m(A(u)("Show Bulk Actions")),1)]),_:1})),A(t).data.showDeleteBulkAction?(r(),E(L,{key:1,command:"hide_delete_bulk_action"},{default:d(()=>[n(Y,{name:"EyeOff"}),R(" "+m(A(u)("Hide Bulk Actions")),1)]),_:1})):x("",!0)]),_:1}),n(Ot,{permission:"orders/delete"},{default:d(()=>[n(L,{command:"delete_test_orders",disabled:s.value,class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(s.value?A(u)("Deleting Test Orders..."):A(u)("Delete Test Orders")),1)]),_:1},8,["disabled"])]),_:1}),n(Ot,{permission:"orders/export"},{default:d(()=>[n(L,{onClick:I[0]||(I[0]=ne=>f.value=!0)},{default:d(()=>[n(Y,{name:"Download"}),R(" "+m(A(u)("Export Orders")),1)]),_:1})]),_:1})]),_:1})]),default:d(()=>[n(O,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(M,null,{default:d(()=>[n(A(Hn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"orders/create"},{default:d(()=>[n(O,{tag:"router-link",type:"primary",to:{name:"add_order"}},{default:d(()=>[R(m(A(u)("Create Order")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Z,{modelValue:i.value,"onUpdate:modelValue":I[1]||(I[1]=ne=>i.value=ne),title:A(u)("Delete Test Orders"),"append-to-body":!0,"close-on-click-modal":!1,"show-close":!0,"close-on-press-escape":!0,onClose:U,class:"fct-delete-test-orders-modal"},{footer:d(()=>[s.value?x("",!0):(r(),h("div",hv,[n(O,{type:"primary",onClick:U},{default:d(()=>[R(m(A(u)("Done")),1)]),_:1})]))]),default:d(()=>[o("div",W_,[o("div",J_,m(b.value),1),o("div",X_,[o("div",Z_,m(s.value?A(u)("You can close this — deletion will continue in the background"):A(u)("Test order deletion completed.")),1),S.value?(r(),E(W,{key:0,type:"success",class:de(["fct-delete-test-orders-status",{"is-complete":!s.value}])},{default:d(()=>[R(m(S.value),1)]),_:1},8,["class"])):x("",!0)]),s.value?(r(),h("div",ev,[o("div",tv,[o("div",av,[(r(),h(P,null,te(8,ne=>o("div",{key:ne,class:"bar-block",id:`bar-block-${ne+1}`},null,8,lv)),64))]),R(" "+m(A(u)("Deleting...")),1)]),o("span",sv,m(k.value)+"% ",1)])):x("",!0),n(ya,{visible:s.value,fade:"",duration:300},{default:d(()=>[n(G,{percentage:k.value,"stroke-width":6,striped:"","striped-flow":"","show-text":!1,status:s.value?void 0:"success",class:"fct-delete-test-orders-progress"},null,8,["percentage","status"])]),_:1},8,["visible"]),o("div",nv,[o("div",ov,[I[3]||(I[3]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M13.66 1.1333C13.3741 1.09487 13.0575 1.0716 12.7083 1.05762V1.66146V1.70461C12.7083 2.25782 12.7084 2.73471 12.6567 3.11653C12.6017 3.52616 12.4775 3.91865 12.1592 4.23714C11.8409 4.55563 11.4483 4.68009 11.0383 4.73518C10.6566 4.78653 10.18 4.78649 9.62663 4.78646H9.58329H8.74996H8.70662C8.15333 4.78649 7.67666 4.78653 7.29499 4.73518C6.88499 4.68009 6.49249 4.55563 6.17416 4.23714C5.85583 3.91865 5.73166 3.52616 5.67666 3.11653C5.62333 2.72482 5.625 2.23304 5.625 1.66146V1.05762C5.27583 1.0716 4.95917 1.09487 4.67333 1.1333C3.92333 1.23414 3.2925 1.45038 2.79083 1.95198C2.28917 2.45358 2.07249 3.08503 1.97166 3.83513C1.87499 4.55588 1.875 5.47186 1.875 6.60774V13.3818C1.875 14.5178 1.87499 15.4337 1.97166 16.1544C2.07249 16.9046 2.28917 17.536 2.79083 18.0376C3.2925 18.5392 3.92333 18.7554 4.67333 18.8563C5.39417 18.9532 6.31 18.9532 7.44667 18.9531H10.8866C11.0791 18.9532 11.2641 18.9519 11.4433 18.9515C11.2358 18.5378 11.0666 18.3449 10.9875 18.2671C10.18 18.0578 9.58329 17.3269 9.58329 16.4539C9.58329 15.4184 10.4225 14.5789 11.4583 14.5789C11.6941 14.5789 11.9733 14.6359 12.1158 14.6766C12.31 14.7322 12.52 14.8165 12.7383 14.9346C13.1533 14.298 13.6958 13.5629 14.3133 12.9367C14.8741 12.3678 15.5933 11.7846 16.4583 11.432V6.60774C16.4583 5.47186 16.4583 4.55588 16.3616 3.83513C16.2608 3.08503 16.0441 2.45358 15.5425 1.95198C15.0408 1.45038 14.41 1.23414 13.66 1.1333Z",fill:"#017EF3"}),o("path",{d:"M17.012 12.3361C17.4462 12.1825 17.922 12.4094 18.0753 12.8431C18.2295 13.2768 18.002 13.753 17.5687 13.9068C17.1453 14.0568 16.6945 14.3786 16.2395 14.8393C15.7912 15.2944 15.3778 15.845 15.022 16.3897C14.6687 16.9317 14.3828 17.4519 14.1853 17.8374C14.087 18.0296 13.9387 18.3456 13.8879 18.4534C13.7587 18.7501 13.4695 18.9462 13.1453 18.9548C12.822 18.9633 12.5228 18.7836 12.3778 18.4942C12.0112 17.7597 11.6821 17.4672 11.5154 17.3564C11.4421 17.3074 11.3937 17.2895 11.3762 17.284C10.9537 17.2435 10.6237 16.8878 10.6237 16.4548C10.6237 15.9945 10.997 15.6214 11.457 15.6214C11.5645 15.6214 11.7428 15.6547 11.8287 15.6792C12.002 15.7287 12.2112 15.8173 12.4403 15.9698C12.6295 16.0958 12.8245 16.2633 13.0228 16.48C13.1945 16.1726 13.3971 15.8302 13.6271 15.4782C14.0187 14.8772 14.5003 14.2296 15.0528 13.6691C15.6003 13.1143 16.2595 12.6028 17.012 12.3361ZM9.16532 11.8714C9.51032 11.8714 9.79032 12.1513 9.79032 12.4964C9.79032 12.8416 9.51032 13.1214 9.16532 13.1214H5.83203C5.48703 13.1214 5.20703 12.8416 5.20703 12.4964C5.20703 12.1513 5.48703 11.8714 5.83203 11.8714H9.16532ZM12.4987 8.53809C12.8437 8.53809 13.1237 8.81793 13.1237 9.16309C13.1237 9.50826 12.8437 9.78809 12.4987 9.78809H5.83203C5.48703 9.78809 5.20703 9.50826 5.20703 9.16309C5.20703 8.81793 5.48703 8.53809 5.83203 8.53809H12.4987ZM11.457 1.0389V1.66309C11.457 2.26994 11.4562 2.66228 11.417 2.95134C11.3803 3.22242 11.3212 3.3074 11.2737 3.35498C11.2262 3.40256 11.1412 3.46176 10.8704 3.49821C10.5812 3.53706 10.1887 3.53809 9.58199 3.53809H8.74866C8.14203 3.53809 7.74952 3.53706 7.46036 3.49821C7.18952 3.46176 7.10453 3.40256 7.05703 3.35498C7.00953 3.3074 6.95036 3.22242 6.9137 2.95134C6.87453 2.66228 6.8737 2.26994 6.8737 1.66309V1.0389C7.05786 1.03839 7.24786 1.03808 7.44536 1.03809H10.8853C11.0828 1.03808 11.2728 1.03839 11.457 1.0389Z",fill:"#017EF3"})])],-1)),o("span",iv,m(A(u)("Processed")),1),o("span",rv,m(c.value.processed)+" / "+m(c.value.total),1)]),o("div",dv,[I[4]||(I[4]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M16.9433 13.0463C16.88 14.0913 16.8292 14.9197 16.725 15.5813C16.6183 16.2605 16.4475 16.8263 16.1067 17.3205C15.7942 17.773 15.3917 18.1547 14.9258 18.4413C14.4158 18.7555 13.8467 18.8922 13.1692 18.958H8.06417C7.38667 18.8922 6.81667 18.7547 6.30667 18.4405C5.84 18.153 5.4375 17.7705 5.125 17.3172C4.78417 16.8222 4.61417 16.2563 4.50833 15.5763C4.405 14.913 4.355 14.083 4.2925 13.0372L3.75 3.95801H17.5L16.9433 13.0463Z",fill:"#189877"}),o("path",{d:"M11.7488 1.06879C12.2196 1.11046 12.6621 1.25462 13.043 1.53796C13.3238 1.74712 13.5188 2.00379 13.6855 2.28212C13.8405 2.53962 13.9963 2.86046 14.173 3.22462L14.528 3.95879H18.1263C18.5863 3.95879 18.9596 4.33129 18.9596 4.79212C18.9596 5.25212 18.5863 5.62546 18.1263 5.62546H3.1263C2.6663 5.62546 2.29297 5.25212 2.29297 4.79212C2.29297 4.33129 2.6663 3.95879 3.1263 3.95879H6.8013L7.09797 3.30796C7.26964 2.93046 7.4213 2.59796 7.5738 2.33129C7.73797 2.04296 7.93214 1.77629 8.21714 1.55796C8.6013 1.26296 9.05297 1.11379 9.53464 1.06962C9.86213 1.03962 10.193 1.04046 10.5221 1.04129C10.5571 1.04129 10.5913 1.04212 10.6263 1.04212C10.6605 1.04212 10.6955 1.04212 10.7288 1.04212C11.1138 1.04212 11.4605 1.04296 11.7488 1.06879ZM8.63297 3.95879H12.6763C12.4871 3.56879 12.3663 3.32212 12.2571 3.13962C12.0963 2.87296 11.9046 2.75546 11.6005 2.72879C11.3846 2.70962 11.103 2.70879 10.6555 2.70879C10.1963 2.70879 9.90714 2.70962 9.68547 2.72962C9.3738 2.75796 9.17964 2.87962 9.0213 3.15712C8.91714 3.33879 8.80464 3.58212 8.63297 3.95879Z",fill:"#189877"})])],-1)),o("span",uv,m(A(u)("Deleted")),1),o("span",cv,m(c.value.deleted),1)]),o("div",Av,[I[5]||(I[5]=o("span",{class:"fct-delete-test-orders-stat-icon"},[o("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{opacity:"0.4",d:"M10.0013 1.04004C14.9488 1.04004 18.9596 5.05082 18.9596 9.99833C18.9596 14.9459 14.9488 18.9567 10.0013 18.9567C5.0538 18.9567 1.04297 14.9459 1.04297 9.99833C1.04297 9.54867 1.40778 9.18392 1.85677 9.18375C2.30677 9.18375 2.6722 9.54858 2.6722 9.99833C2.6722 14.0463 5.95297 17.3282 10.0013 17.3282C14.0496 17.3282 17.3304 14.0463 17.3304 9.99833C17.3304 5.95037 14.0496 2.66846 10.0013 2.66846C9.55138 2.66846 9.18764 2.30434 9.18747 1.85466C9.18747 1.40488 9.5513 1.04004 10.0013 1.04004ZM2.80566 4.66634C3.08066 4.35891 3.55043 4.30436 3.89209 4.55241C4.25514 4.81714 4.33519 5.32656 4.07031 5.69011L3.90674 5.92448C3.53507 6.47876 3.23784 7.08712 3.02784 7.73356C2.88857 8.16094 2.42904 8.39483 2.00163 8.25602C1.57424 8.11701 1.33924 7.65747 1.47835 7.22982C1.77169 6.32508 2.20608 5.48362 2.75358 4.73145L2.80566 4.66634ZM7.3125 1.45345C7.71574 1.36659 8.12817 1.59791 8.25814 1.9987C8.39722 2.42644 8.16233 2.88598 7.73486 3.02491L7.46061 3.12011C6.82564 3.35476 6.23137 3.67519 5.69222 4.06738L5.62224 4.11214C5.26557 4.32003 4.80286 4.22905 4.55453 3.88835C4.29044 3.52472 4.37034 3.01452 4.73356 2.74984L5.02084 2.55046C5.69734 2.09692 6.44048 1.7332 7.23194 1.47624L7.3125 1.45345Z",fill:"#F04438"}),o("path",{d:"M11.9754 6.85201C12.3029 6.58506 12.7854 6.6039 13.0904 6.90897C13.3954 7.21407 13.4145 7.69657 13.147 8.02388L13.0904 8.08736L11.1787 9.99808L13.0895 11.9089L13.147 11.9724C13.4137 12.2997 13.3945 12.7823 13.0895 13.0873C12.7845 13.3923 12.302 13.4113 11.9745 13.1442L11.9112 13.0873L10.0012 11.1765L8.09122 13.0873C7.76538 13.4127 7.23789 13.4127 6.91289 13.0873C6.58706 12.7619 6.58706 12.2344 6.91289 11.9089L8.82288 9.99808L6.91206 8.08736L6.85456 8.02388C6.58789 7.69657 6.60706 7.21407 6.91206 6.90897C7.21706 6.6039 7.69955 6.58506 8.02705 6.85201L8.09039 6.90897L10.0012 8.81975L11.912 6.90897L11.9754 6.85201Z",fill:"#F04438"})])],-1)),o("span",pv,m(A(u)("Failed")),1),o("span",fv,m(c.value.failed),1)])]),p.value&&!s.value?(r(),h("p",mv,m(p.value),1)):x("",!0)])]),_:1},8,["modelValue","title"]),n(Ot,{permission:"reports/view"},{default:d(()=>[a.value?(r(),E(D_,{key:0})):x("",!0)]),_:1}),n(Ot,{permission:"orders/view"},{default:d(()=>[o("div",_v,[n(Ts,{table:A(t),classicTabStyle:!0,hasMobileSlot:!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(q_,{key:0})):x("",!0),A(t).isLoading()?x("",!0):(r(),E(dd,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage},null,8,["table","orders","columns","empty-text"]))]),default:d(()=>[A(t).isLoading()?(r(),E(N_,{key:0,orderTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["orderTable","next-page-count"])):(r(),E(rd,{key:1,table:A(t),orders:A(t).getTableData(),columns:A(t).data.columns,"empty-text":A(t).emptyMessage,onSelectionChange:w},null,8,["table","orders","columns","empty-text"]))]),_:1},8,["table"])])]),_:1}),n(tA,{modelValue:f.value,"onUpdate:modelValue":I[2]||(I[2]=ne=>f.value=ne),title:A(u)("Export Orders"),"selected-count":_.value.length,"current-page-count":A(t).getTableData().length,"total-count":A(t).data.paginate.total,"item-label-singular":A(u)("order"),"item-label-plural":A(u)("orders"),"has-active-filter":!!A(t).isFiltering(),"export-state":A(y),onExport:v},null,8,["modelValue","title","selected-count","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}},gv={class:"setting-wrap"},yv={class:"setting-wrap-inner"},bv={class:"setting-confirmation-content"},wv={class:"custom-wp-editor-wrapper"},Cv={class:"setting-save-action"},kv={__name:"InvoicePacking",setup(e){const t=T([]),a=T([]),l=T(!1),s=T(!1);ws().onSave(()=>{_()});const c=T([u("Invoice Template"),u("Packing Slip Template"),u("Delivery Slip Template"),u("Shipping Slip Template"),u("Dispatch Slip Template")]),p=()=>{l.value=!0,Ae.get("templates/print-templates").then(g=>{t.value=g.templates,l.value=!1}).catch(g=>{q.error(g)}).finally(()=>{l.value=!1})},f=()=>{l.value=!0,Ae.get("settings/confirmation/shortcode",{}).then(g=>{a.value=g.data}).catch(g=>{q.error(g)}).finally(()=>{l.value=!1})},_=()=>{s.value=!0,Ae.put("templates/print-templates",{templates:t.value}).then(g=>{q.success(g.message)}).catch(g=>{q.error(g)}).finally(()=>{s.value=!1})};return Ie(()=>{p(),f()}),(g,y)=>{const v=C("el-skeleton");return C("el-button"),r(),h("div",gv,[n(Ua,{heading:A(u)("Invoice & Packing"),"show-save-button":!1},null,8,["heading"]),o("div",yv,[n(Ia),n(el,{class:"mb-5",type:"information",content:A(u)("It will be available soon!")},null,8,["content"]),l.value?(r(!0),h(P,{key:0},te(c.value,(w,k)=>(r(),E(Se,{key:k},{default:d(()=>[n(Ve,{title:w,border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[n(v,{animated:"",rows:6})]),_:1})]),_:2},1024))),128)):x("",!0),!l.value&&t.value.length>0?(r(),h(P,{key:1},[(r(!0),h(P,null,te(t.value,(w,k)=>(r(),E(Se,{key:k},{default:d(()=>[n(Ve,{title:w.title+" (Under Development)",border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",bv,[o("div",wv,[n(ls,{"short-codes":a.value,modelValue:w.content,"onUpdate:modelValue":b=>w.content=b,onUpdate:b=>{w.content=b}},null,8,["short-codes","modelValue","onUpdate:modelValue","onUpdate"])])])]),_:2},1024)]),_:2},1024))),128)),o("div",Cv,[x("",!0)])],64)):x("",!0)])])}}},Bv={key:0,class:"bg-white p-10 rounded m-10 dark:bg-dark-600"},xv={__name:"PdfTemplateRoute",setup(e){const t=ze.get("app_config.isProActive");return(a,l)=>{const s=C("router-view");return A(t)?(r(),E(s,{key:1})):(r(),h("div",Bv,[n(dn,{placement:"feature_lock_pdf_templates",title:A(u)("PDF Templates"),text:A(u)("Customizable PDF receipts, invoices, and e-invoices with ZUGFeRD support.")},null,8,["title","text"])]))}}},Sv={class:"setting-wrap"},Fv={class:"setting-wrap-inner"},$v={class:"flex gap-5"},Ev={class:"flex flex-col items-center justify-center py-12 text-center"},Uv={class:"text-lg font-semibold mb-2 text-system-dark dark:text-gray-200"},Iv={class:"text-sm text-system-mid dark:text-gray-400 mb-6 max-w-md"},Qv={class:"fct-pdf-template-desc"},Dv={class:"fct-pdf-template-grid"},Vv={class:"fct-pdf-template-preview"},Tv={class:"fct-pdf-template-preview-placeholder"},Mv={class:"fct-pdf-placeholder-text"},Lv={class:"fct-pdf-template-overlay"},Rv={class:"fct-pdf-template-footer"},Ov={class:"fct-pdf-template-name-row"},Pv={class:"fct-pdf-template-title"},Hv={key:0,class:"fct-pdf-badge fct-pdf-badge--default"},Nv={__name:"PdfTemplateIndex",setup(e){const t=sl(),a=T(!0),l=T(!1),s=T({}),i=T(!1),c=T(""),p=T(!1),f=T(""),_=T(null),g=T(!1),y=T(!1),v=ze.get("app_config.isProActive"),w=()=>{a.value=!0,Ae.get("settings/pdf-templates/receipt").then(F=>{s.value=F.templates||{},l.value=F.has_fluent_pdf||!1,_.value=F.addon_info||null}).catch(F=>{var B;q.error(((B=F.data)==null?void 0:B.message)||u("Failed to load templates"))}).finally(()=>{a.value=!1})},k=()=>{if(_.value){if(!v&&_.value.repo_link){window.open(_.value.repo_link,"_blank","noopener,noreferrer");return}g.value=!0,Ae.post("settings/modules/plugin-addons/install",{plugin_slug:_.value.plugin_slug,source_type:_.value.source_type||"wordpress",source_link:_.value.source_link||"",asset_path:_.value.asset_path||""}).then(F=>{q.success(F.message||u("Plugin installed successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var B;q.error(((B=F.data)==null?void 0:B.message)||u("Failed to install plugin"))}).finally(()=>{g.value=!1})}},b=()=>{_.value&&(y.value=!0,Ae.post("settings/modules/plugin-addons/activate",{plugin_file:_.value.plugin_file}).then(F=>{q.success(F.message||u("Plugin activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(F=>{var B;q.error(((B=F.data)==null?void 0:B.message)||u("Failed to activate plugin"))}).finally(()=>{y.value=!1}))},S=()=>{c.value="",i.value=!0},$=()=>{if(!c.value.trim()){q.error(u("Please enter a template name"));return}p.value=!0,Ae.post("settings/pdf-templates/create",{title:c.value.trim()}).then(F=>{i.value=!1,q.success(F.message||u("Template created")),F.slug?t.push({name:"edit-pdf-template",params:{template:F.slug}}):w()}).catch(F=>{var B;q.error(((B=F.data)==null?void 0:B.message)||u("Failed to create template"))}).finally(()=>{p.value=!1})},D=F=>{f.value=F,Ae.delete("settings/pdf-templates/delete/"+F).then(B=>{q.success(B.message||u("Template deleted")),w()}).catch(B=>{var U;q.error(((U=B.data)==null?void 0:U.message)||u("Failed to delete template"))}).finally(()=>{f.value=""})};return Ie(()=>{w()}),(F,B)=>{const U=C("el-button"),Q=C("el-skeleton-item"),V=C("el-skeleton"),I=C("el-popconfirm"),M=C("el-input"),O=C("el-form-item"),L=C("el-form"),H=C("el-dialog");return r(),h("div",Sv,[n(Ua,{heading:A(u)("PDF Templates"),"show-save-button":!1},oa({_:2},[l.value?{name:"action",fn:d(()=>[n(U,{type:"primary",size:"small",onClick:S},{default:d(()=>[R(m(A(u)("Add Template")),1)]),_:1})]),key:"0"}:void 0]),1032,["heading"]),o("div",Fv,[n(Ia),a.value?(r(),E(Se,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(V,{animated:""},{template:d(()=>[n(Q,{variant:"text",class:"w-[300px] mb-4"}),o("div",$v,[n(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}}),n(Q,{variant:"rect",style:{width:"220px",height:"280px","border-radius":"8px"}})])]),_:1})]),_:1})]),_:1})):x("",!0),!a.value&&!l.value&&_.value?(r(),E(Se,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[o("div",Ev,[B[3]||(B[3]=o("svg",{class:"mb-4",width:"48",height:"48",viewBox:"0 0 32 32",fill:"none",stroke:"currentColor","stroke-width":"1.5"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("h3",Uv,m(A(u)("Fluent PDF Required")),1),o("p",Iv,m(A(u)("To use PDF receipt templates, you need to install and activate the Fluent PDF plugin.")),1),_.value.is_installed?_.value.is_installed&&!_.value.is_active?(r(),E(U,{key:1,type:"success",loading:y.value,onClick:b},{default:d(()=>[R(m(A(u)("Activate Plugin")),1)]),_:1},8,["loading"])):x("",!0):(r(),E(U,{key:0,type:"primary",loading:g.value,onClick:k},{default:d(()=>[R(m(A(v)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:1},8,["loading"]))])]),_:1})]),_:1})):x("",!0),!a.value&&l.value?(r(),E(Se,{key:2},{default:d(()=>[n(ke,null,{default:d(()=>[o("p",Qv,m(A(u)("Customize PDF templates for email attachments. Select which template to attach in each email notification's settings.")),1),o("div",Dv,[(r(!0),h(P,null,te(s.value,(j,W)=>(r(),h("div",{key:W,class:"fct-pdf-template-card"},[o("div",Vv,[o("div",Tv,[B[4]||(B[4]=o("svg",{width:"40",height:"40",viewBox:"0 0 32 32",fill:"none",stroke:"#525866","stroke-width":"1.2"},[o("path",{d:"M8 2C6.9 2 6 2.9 6 4v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10l-8-8H8z"}),o("path",{d:"M18 2v8h8"}),o("path",{d:"M12 18h8M12 22h6"})],-1)),o("span",Mv,m(j.title||A(u)("Receipt Template")),1)]),o("div",Lv,[n(U,{type:"primary",size:"small",tag:"router-link",to:{name:"edit-pdf-template",params:{template:W}}},{default:d(()=>[R(m(A(u)("Edit Template")),1)]),_:2},1032,["to"])])]),o("div",Rv,[o("div",Ov,[o("span",Pv,m(j.title||W),1),j.is_default?(r(),h("span",Hv,m(A(u)("Built-in")),1)):x("",!0)]),j.is_default?x("",!0):(r(),E(I,{key:0,title:A(u)("Delete this template?"),"confirm-button-text":A(u)("Delete"),"cancel-button-text":A(u)("Cancel"),"confirm-button-type":"danger",onConfirm:G=>D(W)},{reference:d(()=>[n(U,{type:"danger",size:"small",text:"",loading:f.value===W,class:"fct-pdf-delete-btn"},{default:d(()=>B[5]||(B[5]=[o("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M3 6h18"}),o("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})],-1)])),_:2,__:[5]},1032,["loading"])]),_:2},1032,["title","confirm-button-text","cancel-button-text","onConfirm"]))])]))),128))])]),_:1})]),_:1})):x("",!0)]),n(H,{modelValue:i.value,"onUpdate:modelValue":B[2]||(B[2]=j=>i.value=j),title:A(u)("Add Custom Template"),width:"420px","close-on-click-modal":!1,"append-to-body":!0},{footer:d(()=>[n(U,{onClick:B[1]||(B[1]=j=>i.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(U,{type:"primary",onClick:$,loading:p.value},{default:d(()=>[R(m(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(L,{onSubmit:Ge($,["prevent"]),"label-position":"top"},{default:d(()=>[n(O,{label:A(u)("Template Name")},{default:d(()=>[n(M,{modelValue:c.value,"onUpdate:modelValue":B[0]||(B[0]=j=>c.value=j),placeholder:A(u)("e.g. Custom Invoice"),autofocus:""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])}}},Kv={name:"EmailBodySkeleton",props:{showLoadingBadge:{type:Boolean,default:!1}}},Gv={class:"fct-email-body-skeleton"},zv={class:"fct-email-body-skeleton__page"},jv={key:0,class:"fct-ebs__badge"},qv={class:"fct-ebs__badge-text"};function Yv(e,t,a,l,s,i){return r(),h("div",Gv,[o("div",zv,[t[3]||(t[3]=Dn('<div class="fct-ebs__skel fct-ebs__header"></div><div style="height:8px;"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div><div style="flex:1;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__grid"><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div><div class="fct-ebs__skel"></div></div><div class="fct-ebs__row" style="margin-top:2px;"><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div><div class="fct-ebs__skel" style="width:30%;height:12px;"></div><div class="fct-ebs__skel" style="width:20%;height:12px;"></div></div><div class="fct-ebs__divider"></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="flex:1;height:12px;"></div></div><div class="fct-ebs__row"><div class="fct-ebs__skel" style="width:45%;height:12px;"></div></div>',9)),a.showLoadingBadge?(r(),h("div",jv,[t[0]||(t[0]=o("span",{class:"fct-ebs__dot"},null,-1)),t[1]||(t[1]=o("span",{class:"fct-ebs__dot"},null,-1)),t[2]||(t[2]=o("span",{class:"fct-ebs__dot"},null,-1)),o("span",qv,m(e.$t("Loading block editor…")),1)])):x("",!0)])])}const hr=nt(Kv,[["render",Yv]]),Wv={name:"NewEditorFrame",components:{EmailBodySkeleton:hr},props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""}},emits:["update:modelValue","titleUpdated","contentUpdated","editorFullscreenToggle","featuredMediaUpdated","previewRequest","autosaveState"],data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,dataSent:!1,isFailing:!1,iframeReady:!1,pendingDataSend:!1,sendRetries:0,editorReadyReceived:!1,editorContentReady:!1,isFullscreen:!1,_timers:[]}},computed:{editorFailed(){return!this.dataSent&&this.isFailing&&!this.editorReadyReceived}},mounted(){this._setTimeout(()=>{this.editorReadyReceived||(this.isFailing=!0)},3e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){this._timers.forEach(e=>clearTimeout(e)),this._timers=[],window.removeEventListener("message",this.handleEditorMessage),this.isFullscreen&&this.toggleFullScreen(!1),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{_setTimeout(e,t){const a=setTimeout(e,t);return this._timers.push(a),a},createEditorIframe(){this.editorFrame=document.createElement("iframe");let e=this.appVars.fct_editor_frame;if(this.editorParams){const t=new URLSearchParams(this.editorParams);e+="&"+t.toString()}try{this.editorOrigin=new URL(e,window.location.origin).origin}catch{this.editorOrigin=window.location.origin}this.editorFrame.src=e,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.editorFrame.onload=()=>{this.iframeReady=!0,this.pendingDataSend&&(this.pendingDataSend=!1,this._setTimeout(()=>{this.sendDataToEditor()},1e3)),this._setTimeout(()=>{!this.editorReadyReceived&&this.iframeReady&&this.sendDataToEditor()},1e4)},this.$refs.iframeContainer.appendChild(this.editorFrame)},sendDataToEditor(){if(!this.iframeReady||!this.editorFrame||!this.editorFrame.contentWindow){this.pendingDataSend=!0;return}try{const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({action:"UPDATE_EDITOR",data:e},this.editorOrigin),this.dataSent=!0,this.sendRetries=0,this._setTimeout(()=>{this.editorContentReady||(this.editorContentReady=!0)},5e3)}catch{this.sendRetries++,this.sendRetries<=3&&this._setTimeout(()=>{this.sendDataToEditor()},500)}},handleEditorMessage(e){if(e&&e.origin&&this.editorOrigin&&e.origin!==this.editorOrigin)return;const{action:t,content:a}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorContentReady||this._setTimeout(()=>{this.editorContentReady=!0},1500),this.editorData.content=a,this.$emit("update:modelValue",a),this.$emit("contentUpdated",a)):t==="TITLE_UPDATED"?(this.editorData.title=a,this.$emit("titleUpdated",a)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",a):t==="EDITOR_FULLSCREEN_TOGGLE"?this.toggleFullScreen(a):t==="EMAIL_PREVIEW_REQUEST"?this.$emit("previewRequest"):t==="AUTOSAVE_STATE"?this.$emit("autosaveState",a):t==="EDITOR_READY"&&(this.editorReadyReceived=!0,this.isFailing=!1,this.sendDataToEditor())},forceAutosave(){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({action:"FORCE_SAVE"},this.editorOrigin)},toggleFullScreen(e){this.isFullscreen=e;const t=this.editorFrame;if(e){if(document.documentElement.classList.add("fct-editor-fullscreen"),document.body.style.overflow="hidden",t){t.classList.add("fct-fullscreen-iframe"),this._fullscreenAncestors=[];let a=t.parentElement;for(;a&&a!==document.documentElement;)a.classList.add("fct-fullscreen-ancestor"),this._fullscreenAncestors.push(a),a=a.parentElement}}else document.documentElement.classList.remove("fct-editor-fullscreen"),document.body.style.overflow="",t&&t.classList.remove("fct-fullscreen-iframe"),this._fullscreenAncestors&&(this._fullscreenAncestors.forEach(function(a){a.classList.remove("fct-fullscreen-ancestor")}),this._fullscreenAncestors=null);this.$emit("editorFullscreenToggle",e)}}},Jv={style:{width:"100%"}},Xv={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},Zv={class:"editor-container",style:{position:"relative"}},eg={key:0,class:"fct-editor-skeleton"},tg={ref:"iframeContainer",class:"iframe-container"};function ag(e,t,a,l,s,i){const c=C("EmailBodySkeleton");return r(),h("div",Jv,[i.editorFailed?(r(),h("div",Xv,[o("p",null,m(e.$t("Problem with loading the editor. Please reload the page.")),1)])):x("",!0),o("div",Zv,[n(Xl,{name:"fct-skeleton-fade"},{default:d(()=>[s.editorContentReady?x("",!0):(r(),h("div",eg,[t[0]||(t[0]=o("div",{class:"fct-skel-menubar"},[o("div",{class:"fct-skel fct-skel-logo"}),o("div",{class:"fct-skel-slash"}),o("div",{class:"fct-skel fct-skel-name"}),o("div",{class:"fct-skel-spacer"}),o("div",{class:"fct-skel fct-skel-btn-wide"}),o("div",{class:"fct-skel-dot"}),o("div",{class:"fct-skel-dot"})],-1)),t[1]||(t[1]=o("div",{class:"fct-skel-toolbar"},[o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel fct-skel-tb-btn"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel fct-skel-tb-wide"}),o("div",{class:"fct-skel-sep"}),o("div",{class:"fct-skel fct-skel-tb-btn"})],-1)),n(c,{"show-loading-badge":!0})]))]),_:1}),o("div",tg,null,512)])])}const gA=nt(Wv,[["render",ag],["__scopeId","data-v-e5dae537"]]),lg={class:"setting-wrap fct-pdf-template-edit-wrapper"},sg={class:"capitalize"},ng={class:"setting-wrap-inner"},og={class:"bg-white rounded dark:bg-dark-700 p-6 mb-4"},ig={class:"setting-save-action"},rg={__name:"PdfTemplateEdit",props:{template:{type:String,required:!0}},setup(e){const t=e,a=sl(),l=T(!0),s=T(!1),i=T(!1),c=T(!1),p=T(null),f=T(null),_=T(""),g=B=>{const U=atob(B),Q=new Array(U.length);for(let V=0;V<U.length;V++)Q[V]=U.charCodeAt(V);return new Blob([new Uint8Array(Q)],{type:"application/pdf"})},y=async()=>{const B=await Ae.post("settings/pdf-templates/download",{template_id:t.template});if(!(B!=null&&B.pdf_base64))throw new Error(u("Failed to generate PDF"));return B},v=()=>{l.value=!0,Ae.get("settings/pdf-templates/receipt/"+t.template).then(B=>{var Q,V,I;p.value=B.template;const U=(I=(V=(Q=B.template)==null?void 0:Q.pdf_settings)==null?void 0:V[0])==null?void 0:I.pdf_structure;U&&(_.value=U.content||"")}).catch(B=>{var U;q.error(((U=B.data)==null?void 0:U.message)||u("Failed to load template"))}).finally(()=>{l.value=!1})},w=async({showSuccess:B=!0}={})=>{var Q,V,I,M;s.value=!0,f.value&&await f.value.forceAutosave();const U=((I=(V=(Q=p.value)==null?void 0:Q.pdf_settings)==null?void 0:V[0])==null?void 0:I.pdf_structure)||{};U.content=_.value;try{const O=await Ae.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:U});return B&&q.success(O.message||u("Template saved")),!0}catch(O){return q.error(((M=O.data)==null?void 0:M.message)||u("Failed to save template")),!1}finally{s.value=!1}},k=()=>{i.value=!0,y().then(B=>{const U=g(B.pdf_base64),Q=URL.createObjectURL(U),V=document.createElement("a");V.href=Q,V.download=B.filename||"receipt-test.pdf",document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(Q),q.success(u("PDF downloaded"))}).catch(B=>{var U;q.error(((U=B.data)==null?void 0:U.message)||B.message||u("Failed to generate PDF"))}).finally(()=>{i.value=!1})},b=async()=>{var B;c.value=!0;try{const U=await y(),Q=g(U.pdf_base64),V=URL.createObjectURL(Q),I=document.createElement("a");I.href=V,I.target="_blank",I.rel="noopener",document.body.appendChild(I),I.click(),document.body.removeChild(I),setTimeout(()=>{URL.revokeObjectURL(V)},1e4)}catch(U){q.error(((B=U.data)==null?void 0:B.message)||U.message||u("Failed to generate PDF"))}finally{c.value=!1}},S=async()=>{s.value||i.value||c.value||!await w({showSuccess:!1})||await b()},$=()=>p.value&&!p.value.is_default,D=()=>{Ae.delete("settings/pdf-templates/delete/"+t.template).then(B=>{q.success(B.message||u("Template deleted")),a.push({path:"/settings/pdf-template"})}).catch(B=>{var U;q.error(((U=B.data)==null?void 0:U.message)||u("Failed to delete template"))})},F=()=>{Ae.get("settings/pdf-templates/factory-default").then(B=>{var V,I,M;const U=(V=B.templates)==null?void 0:V[t.template];if(!U)return;const Q=((M=(I=U.pdf_settings)==null?void 0:I[0])==null?void 0:M.pdf_structure)||{};return Ae.post("settings/pdf-templates/receipt/"+t.template,{pdf_structure:Q}).then(()=>{q.success(u("Reverted to default template")),v()})}).catch(B=>{var U;q.error(((U=B.data)==null?void 0:U.message)||u("Failed to revert template"))})};return Ie(()=>{v()}),(B,U)=>{const Q=C("el-breadcrumb-item"),V=C("el-breadcrumb"),I=C("el-icon"),M=C("el-button"),O=C("el-dropdown-item"),L=C("el-dropdown-menu"),H=C("el-dropdown"),j=C("el-skeleton-item"),W=C("el-skeleton");return r(),h("div",lg,[n(Ua,{loading:s.value,"loading-text":A(u)("Saving"),"save-button-text":A(u)("Save Template"),onOnSave:w},{heading:d(()=>[n(V,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[n(Q,{to:{path:"/settings/pdf-template"}},{default:d(()=>[R(m(A(u)("PDF Templates")),1)]),_:1}),n(Q,null,{default:d(()=>{var G;return[o("span",sg,m(((G=p.value)==null?void 0:G.title)||A(u)("Edit Template")),1)]}),_:1})]),_:1},8,["separator-icon"])]),action:d(()=>[n(H,{trigger:"click",style:{"margin-left":"12px",display:"inline-flex","align-items":"center"},"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(L,null,{default:d(()=>[n(O,{onClick:k,disabled:i.value},{default:d(()=>[R(m(i.value?A(u)("Downloading..."):A(u)("Test Download")),1)]),_:1},8,["disabled"]),n(O,{onClick:F},{default:d(()=>[R(m(A(u)("Revert to Default")),1)]),_:1}),$()?(r(),E(O,{key:0,divided:"",onClick:D,style:{color:"#F56C6C"}},{default:d(()=>[R(m(A(u)("Delete Template")),1)]),_:1})):x("",!0)]),_:1})]),default:d(()=>[n(M,{size:"small",text:"",style:{height:"auto",padding:"4px"}},{default:d(()=>[n(I,{style:{transform:"rotate(90deg)","font-size":"16px"}},{default:d(()=>[n(A(lm))]),_:1})]),_:1})]),_:1})]),_:1},8,["loading","loading-text","save-button-text"]),o("div",ng,[n(Ia),n(W,{loading:l.value,class:"bg-white rounded p-6 dark:bg-dark-700",animated:""},{template:d(()=>[n(j,{variant:"h3",class:"w-[200px] mb-5"}),n(j,{variant:"rect",style:{width:"100%",height:"500px"}})]),_:1},8,["loading"]),!l.value&&p.value?(r(),h(P,{key:0},[o("div",og,[n(gA,{ref_key:"editorFrameRef",ref:f,editorParams:{block_type:"pdf_template",campaign_title:p.value.title,bid:t.template},frameHeight:"calc(100vh - 200px)",documentTitle:p.value.title||A(u)("Receipt Template"),onPreviewRequest:S,modelValue:_.value,"onUpdate:modelValue":U[0]||(U[0]=G=>_.value=G)},null,8,["editorParams","documentTitle","modelValue"])]),o("div",ig,[n(M,{onClick:w,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(m(A(u)("Save Template")),1)]),_:1},8,["disabled","loading"]),n(M,{onClick:k,disabled:i.value,loading:i.value},{default:d(()=>[R(m(A(u)("Test Download")),1)]),_:1},8,["disabled","loading"])])],64)):x("",!0)])])}}},dg={class:"fluent-cart-admin-validation-error-wrapper `${fieldKey}`"},_l=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:{type:String,default:""}},setup(e){return(t,a)=>(r(),h("div",dg,[(r(!0),h(P,null,te(e.validationErrors,(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},m(l),1))),128))]))}}),xo={__name:"Alert",props:{type:String,title:String,description:String,closable:Boolean,showIcon:Boolean},setup(e){return(t,a)=>{const l=C("el-alert");return r(),E(l,{title:e.title,type:e.type,description:e.description,"show-icon":e.showIcon,closable:e.closable,role:"alert"},{default:d(()=>[ga(t.$slots,"default")]),_:3},8,["title","type","description","show-icon","closable"])}}},ug={class:"setting-wrap"},cg={class:"setting-wrap-inner"},Ag={class:"grid gap-3 mb-6"},pg={class:"grid gap-3 mb-6"},fg={class:"grid gap-3 mb-6"},mg={class:"grid gap-3"},hg={key:0,class:"mb-4 p-4 rounded-lg border border-yellow-300 bg-yellow-50 text-yellow-800 text-sm"},_g=["href"],vg={class:"form-note"},gg={class:"form-note"},yg=["href"],bg={class:"mb-4"},wg={class:"mb-4"},Cg={class:"form-note"},kg={class:"form-note"},Bg={class:"form-note"},xg={class:"form-note"},Sg={class:"setting-save-action"},Fg={__name:"PdfTemplateSettings",setup(e){const t=T(!0),a=T(!1),l=T({}),s=T(!0),i=T(""),c=T({zugferd_enabled:"0",zugferd_profile:"en16931",seller_legal_registration_scheme:"",seller_contact_name:"",seller_contact_email:"",seller_contact_phone:"",seller_bank_iban:"",seller_bank_bic:"",seller_bank_account_name:"",seller_electronic_address:""}),p=[{label:"EN 16931 (ZUGFeRD)",value:"en16931"}],f=[{value:"",label:u("None")},{value:"0002",label:"0002 — SIRENE (France)"},{value:"0009",label:"0009 — SIRET (France)"},{value:"0021",label:"0021 — SWIFT"},{value:"0060",label:"0060 — DUNS"},{value:"0088",label:"0088 — EAN / GS1 GLN"},{value:"0096",label:"0096 — Danish P number"},{value:"0130",label:"0130 — EU Directorates"},{value:"0183",label:"0183 — Swiss UID"},{value:"0184",label:"0184 — Danish CVR"},{value:"0190",label:"0190 — Dutch OIN"},{value:"0191",label:"0191 — Dutch KvK"},{value:"0192",label:"0192 — Dutch Organisation ID"},{value:"0195",label:"0195 — Singapore UEN"},{value:"0196",label:"0196 — Icelandic kennitala"},{value:"0198",label:"0198 — Danish SE"},{value:"0199",label:"0199 — LEI"},{value:"0200",label:"0200 — Lithuanian legal entity"},{value:"0204",label:"0204 — German Leitweg-ID"},{value:"0208",label:"0208 — Belgian CBE / KBO"},{value:"0210",label:"0210 — Italian Codice Fiscale"},{value:"0211",label:"0211 — Italian Partita IVA"},{value:"0213",label:"0213 — Finnish OVT"}];ws().onSave(()=>{y()});const g=()=>{t.value=!0,Ae.get("settings/pdf-templates/seller-details").then(v=>{v.seller_details&&Object.keys(c.value).forEach(w=>{v.seller_details[w]!==void 0&&(c.value[w]=v.seller_details[w])}),s.value=v.store_country_set!==!1,i.value=v.store_settings_url||""}).catch(v=>{var w;q.error(((w=v.data)==null?void 0:w.message)||u("Failed to load settings"))}).finally(()=>{t.value=!1})},y=()=>{a.value=!0,l.value={},Ae.post("settings/pdf-templates/seller-details",c.value).then(v=>{q.success(v.message||u("Settings saved"))}).catch(v=>{var w,k;v.status_code===422&&((w=v.data)!=null&&w.data)&&(l.value=v.data.data),q.error(((k=v.data)==null?void 0:k.message)||u("Failed to save settings"))}).finally(()=>{a.value=!1})};return Ie(()=>{g()}),(v,w)=>{const k=C("el-skeleton-item"),b=C("el-skeleton"),S=C("el-switch"),$=C("el-option"),D=C("el-select"),F=C("el-form-item"),B=C("el-col"),U=C("el-row"),Q=C("el-input"),V=C("el-divider"),I=C("el-button");return r(),h("div",ug,[n(Ua,{heading:A(u)("E-Invoice Settings"),loading:a.value,onOnSave:y},null,8,["heading","loading"]),o("div",cg,[n(Ia),t.value?(r(),E(Se,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(b,{animated:""},{template:d(()=>[o("div",Ag,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",pg,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",fg,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})]),o("div",mg,[n(k,{variant:"p",class:"w-[20%]"}),n(k,{variant:"p"})])]),_:1})]),_:1})]),_:1})):x("",!0),t.value?x("",!0):(r(),h(P,{key:1},[c.value.zugferd_enabled==="1"&&!s.value?(r(),h("div",hg,[o("strong",null,m(A(u)("Store country is not configured.")),1),R(" "+m(A(u)("ZUGFeRD XML cannot be embedded in PDFs until your store country is set."))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,class:"underline ml-1"},m(A(u)("Go to Store Settings")),9,_g)):x("",!0)])):x("",!0),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("E-Invoice Configuration"),text:A(u)("Configure ZUGFeRD / Factur-X e-invoice encoding and seller details for your PDFs."),border_bottom:""},{action:d(()=>[n(S,{modelValue:c.value.zugferd_enabled,"onUpdate:modelValue":w[0]||(w[0]=M=>c.value.zugferd_enabled=M),"active-value":"1","inactive-value":"0"},null,8,["modelValue"])]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[n(U,{gutter:15},{default:d(()=>[n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("ZUGFeRD Profile"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.zugferd_profile,"onUpdate:modelValue":w[1]||(w[1]=M=>c.value.zugferd_profile=M)},{default:d(()=>[(r(),h(P,null,te(p,M=>n($,{key:M.value,label:M.label,value:M.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),o("div",vg,[o("p",null,m(A(u)("Select the e-invoice formatter used when generating the embedded XML.")),1)])]),_:1},8,["label"])]),_:1}),n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Legal Registration Scheme"),"label-position":"top"},{default:d(()=>[n(D,{modelValue:c.value.seller_legal_registration_scheme,"onUpdate:modelValue":w[2]||(w[2]=M=>c.value.seller_legal_registration_scheme=M),placeholder:A(u)("Select scheme"),clearable:"",filterable:""},{default:d(()=>[(r(),h(P,null,te(f,M=>n($,{key:M.value,label:M.label,value:M.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),o("div",gg,[o("p",null,m(A(u)("ISO 6523 ICD code for the legal registration identifier")),1)]),n(_l,{"validation-errors":l.value.seller_legal_registration_scheme||{},"field-key":"seller_legal_registration_scheme"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(xo,{type:"info",closable:!1,"show-icon":"",class:"mb-4"},{default:d(()=>[R(m(A(u)("Company Name, VAT ID, Tax ID, and Legal Registration ID are managed in"))+" ",1),i.value?(r(),h("a",{key:0,href:i.value,target:"_blank",class:""},m(A(u)("Store Settings → Business Details")),9,yg)):x("",!0)]),_:1}),o("h4",bg,m(A(u)("Seller Contact")),1),n(U,{gutter:15},{default:d(()=>[n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Name"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_name,"onUpdate:modelValue":w[3]||(w[3]=M=>c.value.seller_contact_name=M)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Email"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_email,"onUpdate:modelValue":w[4]||(w[4]=M=>c.value.seller_contact_email=M),type:"email"},null,8,["modelValue"]),n(_l,{"validation-errors":l.value.seller_contact_email||{},"field-key":"seller_contact_email"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1})]),_:1}),n(U,{gutter:15},{default:d(()=>[n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Contact Phone"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_contact_phone,"onUpdate:modelValue":w[5]||(w[5]=M=>c.value.seller_contact_phone=M)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),n(V),o("h4",wg,m(A(u)("Seller Bank Details")),1),n(U,{gutter:15},{default:d(()=>[n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank IBAN"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_iban,"onUpdate:modelValue":w[6]||(w[6]=M=>c.value.seller_bank_iban=M)},null,8,["modelValue"]),n(_l,{"validation-errors":l.value.seller_bank_iban||{},"field-key":"seller_bank_iban"},null,8,["validation-errors"]),o("div",Cg,[o("p",null,m(A(u)("International Bank Account Number")),1)])]),_:1},8,["label"])]),_:1}),n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank BIC"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_bic,"onUpdate:modelValue":w[7]||(w[7]=M=>c.value.seller_bank_bic=M)},null,8,["modelValue"]),o("div",kg,[o("p",null,m(A(u)("Bank Identifier Code (SWIFT)")),1)])]),_:1},8,["label"])]),_:1})]),_:1}),n(U,{gutter:15},{default:d(()=>[n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Bank Account Name"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_bank_account_name,"onUpdate:modelValue":w[8]||(w[8]=M=>c.value.seller_bank_account_name=M)},null,8,["modelValue"]),o("div",Bg,[o("p",null,m(A(u)("Name of the bank account holder")),1)])]),_:1},8,["label"])]),_:1}),n(B,{lg:12},{default:d(()=>[n(F,{label:A(u)("Electronic Address"),"label-position":"top"},{default:d(()=>[n(Q,{modelValue:c.value.seller_electronic_address,"onUpdate:modelValue":w[9]||(w[9]=M=>c.value.seller_electronic_address=M)},null,8,["modelValue"]),o("div",xg,[o("p",null,m(A(u)("Electronic address for receiving e-invoices (e.g. PEPPOL ID)")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),o("div",Sg,[n(I,{type:"primary",onClick:w[10]||(w[10]=M=>y()),loading:a.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])],64))])])}}},$g={name:"CustomersRoute"},Eg={class:"fca_customers_route"};function Ug(e,t,a,l,s,i){const c=C("router-view");return r(),h("div",Eg,[n(c)])}const Ig=nt($g,[["render",Ug]]);/*! | |
| 2 | 2 | * html2canvas 1.4.1 <https://html2canvas.hertzen.com> |
| 3 | 3 | * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com> |
| 4 | 4 | * Released under MIT License |
| 5 | 5 | *//*! ***************************************************************************** |
| @@ -14,13 +14,13 @@ | ||
| 14 | 14 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| 15 | 15 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| 16 | 16 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 17 | 17 | PERFORMANCE OF THIS SOFTWARE. |
| 18 | -***************************************************************************** */var nr=function(e,t){return nr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,l){a.__proto__=l}||function(a,l){for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(a[s]=l[s])},nr(e,t)};function Il(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nr(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var or=function(){return or=Object.assign||function(t){for(var a,l=1,s=arguments.length;l<s;l++){a=arguments[l];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},or.apply(this,arguments)};function el(e,t,a,l){function s(i){return i instanceof a?i:new a(function(c){c(i)})}return new(a||(a=Promise))(function(i,c){function p(g){try{_(l.next(g))}catch(y){c(y)}}function m(g){try{_(l.throw(g))}catch(y){c(y)}}function _(g){g.done?i(g.value):s(g.value).then(p,m)}_((l=l.apply(e,[])).next())})}function Ya(e,t){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},l,s,i,c;return c={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function p(_){return function(g){return m([_,g])}}function m(_){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,s&&(i=_[0]&2?s.return:_[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,_[1])).done)return i;switch(s=0,i&&(_=[_[0]&2,i.value]),_[0]){case 0:case 1:i=_;break;case 4:return a.label++,{value:_[1],done:!1};case 5:a.label++,s=_[1],_=[0];continue;case 7:_=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(_[0]===6||_[0]===2)){a=0;continue}if(_[0]===3&&(!i||_[1]>i[0]&&_[1]<i[3])){a.label=_[1];break}if(_[0]===6&&a.label<i[1]){a.label=i[1],i=_;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(_);break}i[2]&&a.ops.pop(),a.trys.pop();continue}_=t.call(e,a)}catch(g){_=[6,g],s=0}finally{l=i=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function Hn(e,t,a){if(arguments.length===2)for(var l=0,s=t.length,i;l<s;l++)(i||!(l in t))&&(i||(i=Array.prototype.slice.call(t,0,l)),i[l]=t[l]);return e.concat(i||t)}var Xl=function(){function e(t,a,l,s){this.left=t,this.top=a,this.width=l,this.height=s}return e.prototype.add=function(t,a,l,s){return new e(this.left+t,this.top+a,this.width+l,this.height+s)},e.fromClientRect=function(t,a){return new e(a.left+t.windowBounds.left,a.top+t.windowBounds.top,a.width,a.height)},e.fromDOMRectList=function(t,a){var l=Array.from(a).find(function(s){return s.width!==0});return l?new e(l.left+t.windowBounds.left,l.top+t.windowBounds.top,l.width,l.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),si=function(e,t){return Xl.fromClientRect(e,t.getBoundingClientRect())},Xv=function(e){var t=e.body,a=e.documentElement;if(!t||!a)throw new Error("Unable to get document size");var l=Math.max(Math.max(t.scrollWidth,a.scrollWidth),Math.max(t.offsetWidth,a.offsetWidth),Math.max(t.clientWidth,a.clientWidth)),s=Math.max(Math.max(t.scrollHeight,a.scrollHeight),Math.max(t.offsetHeight,a.offsetHeight),Math.max(t.clientHeight,a.clientHeight));return new Xl(0,0,l,s)},ni=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},Sa=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},Id="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jv=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Pn=0;Pn<Id.length;Pn++)Jv[Id.charCodeAt(Pn)]=Pn;var Qd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",An=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Nn=0;Nn<Qd.length;Nn++)An[Qd.charCodeAt(Nn)]=Nn;var Zv=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=An[e.charCodeAt(l)],c=An[e.charCodeAt(l+1)],p=An[e.charCodeAt(l+2)],m=An[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},eg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},tg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},Cs=5,ad=11,wi=2,ag=ad-Cs,zc=65536>>Cs,lg=1<<Cs,Ci=lg-1,sg=1024>>Cs,ng=zc+sg,og=ng,ig=32,rg=og+ig,dg=65536>>ad,ug=1<<ag,cg=ug-1,Dd=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},Ag=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},pg=function(e,t){var a=Zv(e),l=Array.isArray(a)?tg(a):new Uint32Array(a),s=Array.isArray(a)?eg(a):new Uint16Array(a),i=24,c=Dd(s,i/2,l[4]/2),p=l[5]===2?Dd(s,(i+l[4])/2):Ag(l,Math.ceil((i+l[4])/4));return new fg(l[0],l[1],l[2],l[3],c,p)},fg=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Cs],a=(a<<wi)+(t&Ci),this.data[a];if(t<=65535)return a=this.index[zc+(t-55296>>Cs)],a=(a<<wi)+(t&Ci),this.data[a];if(t<this.highStart)return a=rg-dg+(t>>ad),a=this.index[a],a+=t>>Cs&cg,a=this.index[a],a=(a<<wi)+(t&Ci),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Vd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kn=0;Kn<Vd.length;Kn++)mg[Vd.charCodeAt(Kn)]=Kn;var hg="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Td=50,_g=1,qc=2,Yc=3,vg=4,gg=5,Md=7,Wc=8,Ld=9,ss=10,ir=11,Rd=12,rr=13,yg=14,pn=15,dr=16,Gn=17,rn=18,bg=19,Od=20,ur=21,dn=22,Bi=23,Ds=24,cl=25,fn=26,mn=27,Vs=28,wg=29,ys=30,Cg=31,jn=32,zn=33,cr=34,Ar=35,pr=36,En=37,fr=38,vo=39,go=40,ki=41,Xc=42,Bg=43,kg=[9001,65288],Jc="!",Ot="×",qn="÷",mr=pg(hg),Nl=[ys,pr],hr=[_g,qc,Yc,gg],Zc=[ss,Wc],Hd=[mn,fn],xg=hr.concat(Zc),Pd=[fr,vo,go,cr,Ar],Sg=[pn,rr],Fg=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,c){var p=mr.get(i);if(p>Td?(s.push(!0),p-=Td):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(c),a.push(dr);if(p===vg||p===ir){if(c===0)return l.push(c),a.push(ys);var m=a[c-1];return xg.indexOf(m)===-1?(l.push(l[c-1]),a.push(m)):(l.push(c),a.push(ys))}if(l.push(c),p===Cg)return a.push(t==="strict"?ur:En);if(p===Xc||p===wg)return a.push(ys);if(p===Bg)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(En):a.push(ys);a.push(p)}),[l,a,s]},xi=function(e,t,a,l){var s=l[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var i=a;i<=l.length;){i++;var c=l[i];if(c===t)return!0;if(c!==ss)break}if(s===ss)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var m=a;m<=l.length;){m++;var c=l[m];if(c===t)return!0;if(c!==ss)break}if(p!==ss)break}return!1},Nd=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===ss)a--;else return l}return 0},$g=function(e,t,a,l,s){if(a[l]===0)return Ot;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Ot;var c=i-1,p=i+1,m=t[i],_=c>=0?t[c]:0,g=t[p];if(m===qc&&g===Yc)return Ot;if(hr.indexOf(m)!==-1)return Jc;if(hr.indexOf(g)!==-1||Zc.indexOf(g)!==-1)return Ot;if(Nd(i,t)===Wc)return qn;if(mr.get(e[i])===ir||(m===jn||m===zn)&&mr.get(e[p])===ir||m===Md||g===Md||m===Ld||[ss,rr,pn].indexOf(m)===-1&&g===Ld||[Gn,rn,bg,Ds,Vs].indexOf(g)!==-1||Nd(i,t)===dn||xi(Bi,dn,i,t)||xi([Gn,rn],ur,i,t)||xi(Rd,Rd,i,t))return Ot;if(m===ss)return qn;if(m===Bi||g===Bi)return Ot;if(g===dr||m===dr)return qn;if([rr,pn,ur].indexOf(g)!==-1||m===yg||_===pr&&Sg.indexOf(m)!==-1||m===Vs&&g===pr||g===Od||Nl.indexOf(g)!==-1&&m===cl||Nl.indexOf(m)!==-1&&g===cl||m===mn&&[En,jn,zn].indexOf(g)!==-1||[En,jn,zn].indexOf(m)!==-1&&g===fn||Nl.indexOf(m)!==-1&&Hd.indexOf(g)!==-1||Hd.indexOf(m)!==-1&&Nl.indexOf(g)!==-1||[mn,fn].indexOf(m)!==-1&&(g===cl||[dn,pn].indexOf(g)!==-1&&t[p+1]===cl)||[dn,pn].indexOf(m)!==-1&&g===cl||m===cl&&[cl,Vs,Ds].indexOf(g)!==-1)return Ot;if([cl,Vs,Ds,Gn,rn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===cl)return Ot;if([Vs,Ds].indexOf(v)!==-1)y--;else break}if([mn,fn].indexOf(g)!==-1)for(var y=[Gn,rn].indexOf(m)!==-1?c:i;y>=0;){var v=t[y];if(v===cl)return Ot;if([Vs,Ds].indexOf(v)!==-1)y--;else break}if(fr===m&&[fr,vo,cr,Ar].indexOf(g)!==-1||[vo,cr].indexOf(m)!==-1&&[vo,go].indexOf(g)!==-1||[go,Ar].indexOf(m)!==-1&&g===go||Pd.indexOf(m)!==-1&&[Od,fn].indexOf(g)!==-1||Pd.indexOf(g)!==-1&&m===mn||Nl.indexOf(m)!==-1&&Nl.indexOf(g)!==-1||m===Ds&&Nl.indexOf(g)!==-1||Nl.concat(cl).indexOf(m)!==-1&&g===dn&&kg.indexOf(e[p])===-1||Nl.concat(cl).indexOf(g)!==-1&&m===rn)return Ot;if(m===ki&&g===ki){for(var C=a[i],b=1;C>0&&(C--,t[C]===ki);)b++;if(b%2!==0)return Ot}return m===jn&&g===zn?Ot:qn},Eg=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=Fg(e,t.lineBreak),l=a[0],s=a[1],i=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(s=s.map(function(p){return[cl,ys,Xc].indexOf(p)!==-1?En:p}));var c=t.wordBreak==="keep-all"?i.map(function(p,m){return p&&e[m]>=19968&&e[m]<=40959}):void 0;return[l,s,c]},Ug=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===Jc,this.start=l,this.end=s}return e.prototype.slice=function(){return Sa.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),Ig=function(e,t){var a=ni(e),l=Eg(a,t),s=l[0],i=l[1],c=l[2],p=a.length,m=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Ot;_<p&&(g=$g(a,i,s,++_,c))===Ot;);if(g!==Ot||_===p){var y=new Ug(a,g,m,_);return m=_,{value:y,done:!1}}return{done:!0,value:null}}}},Qg=1,Dg=2,Tn=4,Kd=8,Fo=10,Gd=47,yn=92,Vg=9,Tg=32,Yn=34,un=61,Mg=35,Lg=36,Rg=37,Wn=39,Xn=40,cn=41,Og=95,ol=45,Hg=33,Pg=60,Ng=62,Kg=64,Gg=91,jg=93,zg=61,qg=123,Jn=63,Yg=125,jd=124,Wg=126,Xg=128,zd=65533,Si=42,ws=43,Jg=44,Zg=58,e1=59,Un=46,t1=0,a1=8,l1=11,s1=14,n1=31,o1=127,Dl=-1,eA=48,tA=97,aA=101,i1=102,r1=117,d1=122,lA=65,sA=69,nA=70,u1=85,c1=90,Xa=function(e){return e>=eA&&e<=57},A1=function(e){return e>=55296&&e<=57343},Ts=function(e){return Xa(e)||e>=lA&&e<=nA||e>=tA&&e<=i1},p1=function(e){return e>=tA&&e<=d1},f1=function(e){return e>=lA&&e<=c1},m1=function(e){return p1(e)||f1(e)},h1=function(e){return e>=Xg},Zn=function(e){return e===Fo||e===Vg||e===Tg},$o=function(e){return m1(e)||h1(e)||e===Og},qd=function(e){return $o(e)||Xa(e)||e===ol},_1=function(e){return e>=t1&&e<=a1||e===l1||e>=s1&&e<=n1||e===o1},ls=function(e,t){return e!==yn?!1:t!==Fo},eo=function(e,t,a){return e===ol?$o(t)||ls(t,a):$o(e)?!0:!!(e===yn&&ls(e,t))},Fi=function(e,t,a){return e===ws||e===ol?Xa(t)?!0:t===Un&&Xa(a):Xa(e===Un?t:e)},v1=function(e){var t=0,a=1;(e[t]===ws||e[t]===ol)&&(e[t]===ol&&(a=-1),t++);for(var l=[];Xa(e[t]);)l.push(e[t++]);var s=l.length?parseInt(Sa.apply(void 0,l),10):0;e[t]===Un&&t++;for(var i=[];Xa(e[t]);)i.push(e[t++]);var c=i.length,p=c?parseInt(Sa.apply(void 0,i),10):0;(e[t]===sA||e[t]===aA)&&t++;var m=1;(e[t]===ws||e[t]===ol)&&(e[t]===ol&&(m=-1),t++);for(var _=[];Xa(e[t]);)_.push(e[t++]);var g=_.length?parseInt(Sa.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-c))*Math.pow(10,m*g)},g1={type:2},y1={type:3},b1={type:4},w1={type:13},C1={type:8},B1={type:21},k1={type:9},x1={type:10},S1={type:11},F1={type:12},$1={type:14},to={type:23},E1={type:1},U1={type:25},I1={type:24},Q1={type:26},D1={type:27},V1={type:28},T1={type:29},M1={type:31},_r={type:32},oA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(ni(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==_r;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case Yn:return this.consumeStringToken(Yn);case Mg:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(qd(a)||ls(l,s)){var i=eo(a,l,s)?Dg:Qg,c=this.consumeName();return{type:5,value:c,flags:i}}break;case Lg:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),w1;break;case Wn:return this.consumeStringToken(Wn);case Xn:return g1;case cn:return y1;case Si:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),$1;break;case ws:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Jg:return b1;case ol:var p=t,m=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Fi(p,m,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(eo(p,m,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(m===ol&&_===Ng)return this.consumeCodePoint(),this.consumeCodePoint(),I1;break;case Un:if(Fi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Gd:if(this.peekCodePoint(0)===Si)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Si&&(g=this.consumeCodePoint(),g===Gd))return this.consumeToken();if(g===Dl)return this.consumeToken()}break;case Zg:return Q1;case e1:return D1;case Pg:if(this.peekCodePoint(0)===Hg&&this.peekCodePoint(1)===ol&&this.peekCodePoint(2)===ol)return this.consumeCodePoint(),this.consumeCodePoint(),U1;break;case Kg:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),C=this.peekCodePoint(2);if(eo(y,v,C)){var c=this.consumeName();return{type:7,value:c}}break;case Gg:return V1;case yn:if(ls(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case jg:return T1;case zg:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),C1;break;case qg:return S1;case Yg:return F1;case r1:case u1:var b=this.peekCodePoint(0),w=this.peekCodePoint(1);return b===ws&&(Ts(w)||w===Jn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case jd:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),k1;if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),B1;break;case Wg:if(this.peekCodePoint(0)===un)return this.consumeCodePoint(),x1;break;case Dl:return _r}return Zn(t)?(this.consumeWhiteSpace(),M1):Xa(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):$o(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Sa(t)}},e.prototype.consumeCodePoint=function(){var t=this._value.shift();return typeof t>"u"?-1:t},e.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},e.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},e.prototype.consumeUnicodeRangeToken=function(){for(var t=[],a=this.consumeCodePoint();Ts(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===Jn&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var s=parseInt(Sa.apply(void 0,t.map(function(m){return m===Jn?eA:m})),16),i=parseInt(Sa.apply(void 0,t.map(function(m){return m===Jn?nA:m})),16);return{type:30,start:s,end:i}}var c=parseInt(Sa.apply(void 0,t),16);if(this.peekCodePoint(0)===ol&&Ts(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];Ts(a)&&p.length<6;)p.push(a),a=this.consumeCodePoint();var i=parseInt(Sa.apply(void 0,p),16);return{type:30,start:c,end:i}}else return{type:30,start:c,end:c}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===Xn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Xn?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===Wn||a===Yn){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl||this.peekCodePoint(0)===cn)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),to)}for(;;){var s=this.consumeCodePoint();if(s===Dl||s===cn)return{type:22,value:Sa.apply(void 0,t)};if(Zn(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Dl||this.peekCodePoint(0)===cn?(this.consumeCodePoint(),{type:22,value:Sa.apply(void 0,t)}):(this.consumeBadUrlRemnants(),to);if(s===Yn||s===Wn||s===Xn||_1(s))return this.consumeBadUrlRemnants(),to;if(s===yn)if(ls(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),to;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;Zn(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===cn||t===Dl)return;ls(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,l="";t>0;){var s=Math.min(a,t);l+=Sa.apply(void 0,this._value.splice(0,s)),t-=s}return this._value.shift(),l},e.prototype.consumeStringToken=function(t){var a="",l=0;do{var s=this._value[l];if(s===Dl||s===void 0||s===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(s===Fo)return this._value.splice(0,l),E1;if(s===yn){var i=this._value[l+1];i!==Dl&&i!==void 0&&(i===Fo?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):ls(s,i)&&(a+=this.consumeStringSlice(l),a+=Sa(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Tn,l=this.peekCodePoint(0);for((l===ws||l===ol)&&t.push(this.consumeCodePoint());Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(l===Un&&Xa(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=Kd;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===sA||l===aA)&&((s===ws||s===ol)&&Xa(i)||Xa(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=Kd;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[v1(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],l=t[1],s=this.peekCodePoint(0),i=this.peekCodePoint(1),c=this.peekCodePoint(2);if(eo(s,i,c)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return s===Rg?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Ts(t)){for(var a=Sa(t);Ts(this.peekCodePoint(0))&&a.length<6;)a+=Sa(this.consumeCodePoint());Zn(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||A1(l)||l>1114111?zd:l}return t===Dl?zd:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(qd(a))t+=Sa(a);else if(ls(a,this.peekCodePoint(0)))t+=Sa(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),iA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new oA;return a.write(t),new e(a.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var t=this.consumeToken();t.type===31;)t=this.consumeToken();if(t.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var a=this.consumeComponentValue();do t=this.consumeToken();while(t.type===31);if(t.type===32)return a;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var t=[];;){var a=this.consumeComponentValue();if(a.type===32)return t;t.push(a),t.push()}},e.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},e.prototype.consumeSimpleBlock=function(t){for(var a={type:t,values:[]},l=this.consumeToken();;){if(l.type===32||R1(l,t))return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue()),l=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var a={name:t.value,values:[],type:18};;){var l=this.consumeToken();if(l.type===32||l.type===3)return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?_r:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Mn=function(e){return e.type===15},ln=function(e){return e.type===17},sa=function(e){return e.type===20},L1=function(e){return e.type===0},vr=function(e,t){return sa(e)&&e.value===t},rA=function(e){return e.type!==31},en=function(e){return e.type!==31&&e.type!==4},Ol=function(e){var t=[],a=[];return e.forEach(function(l){if(l.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(a),a=[];return}l.type!==31&&a.push(l)}),a.length&&t.push(a),t},R1=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},As=function(e){return e.type===17||e.type===15},Da=function(e){return e.type===16||As(e)},dA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},ja={type:17,number:0,flags:Tn},ld={type:16,number:50,flags:Tn},ns={type:16,number:100,flags:Tn},hn=function(e,t,a){var l=e[0],s=e[1];return[ma(l,t),ma(typeof s<"u"?s:l,a)]},ma=function(e,t){if(e.type===16)return e.number/100*t;if(Mn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},uA="deg",cA="grad",AA="rad",pA="turn",oi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case uA:return Math.PI*t.number/180;case cA:return Math.PI/200*t.number;case AA:return t.number;case pA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},fA=function(e){return e.type===15&&(e.unit===uA||e.unit===cA||e.unit===AA||e.unit===pA)},mA=function(e){var t=e.filter(sa).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ja,ja];case"to top":case"bottom":return Bl(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ja,ns];case"to right":case"left":return Bl(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[ns,ns];case"to bottom":case"top":return Bl(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[ns,ja];case"to left":case"right":return Bl(270)}return 0},Bl=function(e){return Math.PI*e/180},ds={name:"color",parse:function(e,t){if(t.type===18){var a=O1[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return a(e,t.values)}if(t.type===5){if(t.value.length===3){var l=t.value.substring(0,1),s=t.value.substring(1,2),i=t.value.substring(2,3);return os(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),1)}if(t.value.length===4){var l=t.value.substring(0,1),s=t.value.substring(1,2),i=t.value.substring(2,3),c=t.value.substring(3,4);return os(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),parseInt(c+c,16)/255)}if(t.value.length===6){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6);return os(parseInt(l,16),parseInt(s,16),parseInt(i,16),1)}if(t.value.length===8){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6),c=t.value.substring(6,8);return os(parseInt(l,16),parseInt(s,16),parseInt(i,16),parseInt(c,16)/255)}}if(t.type===20){var p=zl[t.value.toUpperCase()];if(typeof p<"u")return p}return zl.TRANSPARENT}},us=function(e){return(255&e)===0},Oa=function(e){var t=255&e,a=255&e>>8,l=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+l+","+a+","+t/255+")":"rgb("+s+","+l+","+a+")"},os=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},Yd=function(e,t){if(e.type===17)return e.number;if(e.type===16){var a=t===3?1:255;return t===3?e.number/100*a:Math.round(e.number/100*a)}return 0},Wd=function(e,t){var a=t.filter(en);if(a.length===3){var l=a.map(Yd),s=l[0],i=l[1],c=l[2];return os(s,i,c,1)}if(a.length===4){var p=a.map(Yd),s=p[0],i=p[1],c=p[2],m=p[3];return os(s,i,c,m)}return 0};function $i(e,t,a){return a<0&&(a+=1),a>=1&&(a-=1),a<1/6?(t-e)*a*6+e:a<1/2?t:a<2/3?(t-e)*6*(2/3-a)+e:e}var Xd=function(e,t){var a=t.filter(en),l=a[0],s=a[1],i=a[2],c=a[3],p=(l.type===17?Bl(l.number):oi.parse(e,l))/(Math.PI*2),m=Da(s)?s.number/100:0,_=Da(i)?i.number/100:0,g=typeof c<"u"&&Da(c)?ma(c,1):1;if(m===0)return os(_*255,_*255,_*255,1);var y=_<=.5?_*(m+1):_+m-_*m,v=_*2-y,C=$i(v,y,p+1/3),b=$i(v,y,p),w=$i(v,y,p-1/3);return os(C*255,b*255,w*255,g)},O1={hsl:Xd,hsla:Xd,rgb:Wd,rgba:Wd},bn=function(e,t){return ds.parse(e,iA.create(t).parseComponentValue())},zl={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},H1={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(sa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},P1={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ii=function(e,t){var a=ds.parse(e,t[0]),l=t[1];return l&&Da(l)?{color:a,stop:l}:{color:a,stop:null}},Jd=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=ja),l.stop===null&&(l.stop=ns);for(var s=[],i=0,c=0;c<e.length;c++){var p=e[c].stop;if(p!==null){var m=ma(p,t);m>i?s.push(m):s.push(i),i=m}else s.push(null)}for(var _=null,c=0;c<s.length;c++){var g=s[c];if(g===null)_===null&&(_=c);else if(_!==null){for(var y=c-_,v=s[_-1],C=(g-v)/(y+1),b=1;b<=y;b++)s[_+b-1]=C*b;_=null}}return e.map(function(w,x){var F=w.color;return{color:F,stop:Math.max(Math.min(1,s[x]/t),0)}})},N1=function(e,t,a){var l=t/2,s=a/2,i=ma(e[0],t)-l,c=s-ma(e[1],a);return(Math.atan2(c,i)+Math.PI*2)%(Math.PI*2)},K1=function(e,t,a){var l=typeof e=="number"?e:N1(e,t,a),s=Math.abs(t*Math.sin(l))+Math.abs(a*Math.cos(l)),i=t/2,c=a/2,p=s/2,m=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,c-m,c+m]},$l=function(e,t){return Math.sqrt(e*e+t*t)},Zd=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(c,p){var m=p[0],_=p[1],g=$l(a-m,l-_);return(s?g<c.optimumDistance:g>c.optimumDistance)?{optimumCorner:p,optimumDistance:g}:c},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},G1=function(e,t,a,l,s){var i=0,c=0;switch(e.size){case 0:e.shape===0?i=c=Math.min(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.min(Math.abs(t),Math.abs(t-l)),c=Math.min(Math.abs(a),Math.abs(a-s)));break;case 2:if(e.shape===0)i=c=Math.min($l(t,a),$l(t,a-s),$l(t-l,a),$l(t-l,a-s));else if(e.shape===1){var p=Math.min(Math.abs(a),Math.abs(a-s))/Math.min(Math.abs(t),Math.abs(t-l)),m=Zd(l,s,t,a,!0),_=m[0],g=m[1];i=$l(_-t,(g-a)/p),c=p*i}break;case 1:e.shape===0?i=c=Math.max(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.max(Math.abs(t),Math.abs(t-l)),c=Math.max(Math.abs(a),Math.abs(a-s)));break;case 3:if(e.shape===0)i=c=Math.max($l(t,a),$l(t,a-s),$l(t-l,a),$l(t-l,a-s));else if(e.shape===1){var p=Math.max(Math.abs(a),Math.abs(a-s))/Math.max(Math.abs(t),Math.abs(t-l)),y=Zd(l,s,t,a,!1),_=y[0],g=y[1];i=$l(_-t,(g-a)/p),c=p*i}break}return Array.isArray(e.size)&&(i=ma(e.size[0],l),c=e.size.length===2?ma(e.size[1],s):i),[i,c]},j1=function(e,t){var a=Bl(180),l=[];return Ol(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&c.value==="to"){a=mA(s);return}else if(fA(c)){a=oi.parse(e,c);return}}var p=ii(e,s);l.push(p)}),{angle:a,stops:l,type:1}},ao=function(e,t){var a=Bl(180),l=[];return Ol(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&["top","left","right","bottom"].indexOf(c.value)!==-1){a=mA(s);return}else if(fA(c)){a=(oi.parse(e,c)+Bl(270))%Bl(360);return}}var p=ii(e,s);l.push(p)}),{angle:a,stops:l,type:1}},z1=function(e,t){var a=Bl(180),l=[],s=1,i=0,c=3,p=[];return Ol(t).forEach(function(m,_){var g=m[0];if(_===0){if(sa(g)&&g.value==="linear"){s=1;return}else if(sa(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=ds.parse(e,g.values[0]);l.push({stop:ja,color:y})}else if(g.name==="to"){var y=ds.parse(e,g.values[0]);l.push({stop:ns,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(en);if(v.length===2){var y=ds.parse(e,v[1]),C=v[0];ln(C)&&l.push({stop:{type:16,number:C.number*100,flags:C.flags},color:y})}}}}),s===1?{angle:(a+Bl(180))%Bl(360),stops:l,type:s}:{size:c,shape:i,stops:l,position:p,type:s}},hA="closest-side",_A="farthest-side",vA="closest-corner",gA="farthest-corner",yA="circle",bA="ellipse",wA="cover",CA="contain",q1=function(e,t){var a=0,l=3,s=[],i=[];return Ol(t).forEach(function(c,p){var m=!0;if(p===0){var _=!1;m=c.reduce(function(y,v){if(_)if(sa(v))switch(v.value){case"center":return i.push(ld),y;case"top":case"left":return i.push(ja),y;case"right":case"bottom":return i.push(ns),y}else(Da(v)||As(v))&&i.push(v);else if(sa(v))switch(v.value){case yA:return a=0,!1;case bA:return a=1,!1;case"at":return _=!0,!1;case hA:return l=0,!1;case wA:case _A:return l=1,!1;case CA:case vA:return l=2,!1;case gA:return l=3,!1}else if(As(v)||Da(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},m)}if(m){var g=ii(e,c);s.push(g)}}),{size:l,shape:a,stops:s,position:i,type:2}},lo=function(e,t){var a=0,l=3,s=[],i=[];return Ol(t).forEach(function(c,p){var m=!0;if(p===0?m=c.reduce(function(g,y){if(sa(y))switch(y.value){case"center":return i.push(ld),!1;case"top":case"left":return i.push(ja),!1;case"right":case"bottom":return i.push(ns),!1}else if(Da(y)||As(y))return i.push(y),!1;return g},m):p===1&&(m=c.reduce(function(g,y){if(sa(y))switch(y.value){case yA:return a=0,!1;case bA:return a=1,!1;case CA:case hA:return l=0,!1;case _A:return l=1,!1;case vA:return l=2,!1;case wA:case gA:return l=3,!1}else if(As(y)||Da(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},m)),m){var _=ii(e,c);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},Y1=function(e){return e.type===1},W1=function(e){return e.type===2},sd={name:"image",parse:function(e,t){if(t.type===22){var a={url:t.value,type:0};return e.cache.addImage(t.value),a}if(t.type===18){var l=BA[t.name];if(typeof l>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return l(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function X1(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!BA[e.name])}var BA={"linear-gradient":j1,"-moz-linear-gradient":ao,"-ms-linear-gradient":ao,"-o-linear-gradient":ao,"-webkit-linear-gradient":ao,"radial-gradient":q1,"-moz-radial-gradient":lo,"-ms-radial-gradient":lo,"-o-radial-gradient":lo,"-webkit-radial-gradient":lo,"-webkit-gradient":z1},J1={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t.filter(function(l){return en(l)&&X1(l)}).map(function(l){return sd.parse(e,l)})}},Z1={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(sa(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ey={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(Da)}).map(dA)}},ty={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(sa).map(function(l){return l.value}).join(" ")}).map(ay)}},ay=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},Ys;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(Ys||(Ys={}));var ly={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ol(t).map(function(a){return a.filter(sy)})}},sy=function(e){return sa(e)||Da(e)},ri=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},ny=ri("top"),oy=ri("right"),iy=ri("bottom"),ry=ri("left"),di=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return dA(a.filter(Da))}}},dy=di("top-left"),uy=di("top-right"),cy=di("bottom-right"),Ay=di("bottom-left"),ui=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,a){switch(a){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},py=ui("top"),fy=ui("right"),my=ui("bottom"),hy=ui("left"),ci=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Mn(a)?a.number:0}}},_y=ci("top"),vy=ci("right"),gy=ci("bottom"),yy=ci("left"),by={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},wy={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},Cy={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(sa).reduce(function(a,l){return a|By(l.value)},0)}},By=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},ky={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},xy={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value==="normal"?0:t.type===17||t.type===15?t.number:0}},Eo;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Eo||(Eo={}));var Sy={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Eo.STRICT;case"normal":default:return Eo.NORMAL}}},Fy={name:"line-height",initialValue:"normal",prefix:!1,type:4},eu=function(e,t){return sa(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Da(e)?ma(e,t):t},$y={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:sd.parse(e,t)}},Ey={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){switch(t){case"inside":return 0;case"outside":default:return 1}}},gr={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Ai=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},Uy=Ai("top"),Iy=Ai("right"),Qy=Ai("bottom"),Dy=Ai("left"),Vy={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(sa).map(function(a){switch(a.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Ty={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-word":return"break-word";case"normal":default:return"normal"}}},pi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},My=pi("top"),Ly=pi("right"),Ry=pi("bottom"),Oy=pi("left"),Hy={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Py={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Ny={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&vr(t[0],"none")?[]:Ol(t).map(function(a){for(var l={color:zl.TRANSPARENT,offsetX:ja,offsetY:ja,blur:ja},s=0,i=0;i<a.length;i++){var c=a[i];As(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:l.blur=c,s++):l.color=ds.parse(e,c)}return l})}},Ky={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Gy={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,t){if(t.type===20&&t.value==="none")return null;if(t.type===18){var a=qy[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},jy=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},zy=function(e){var t=e.filter(function(m){return m.type===17}).map(function(m){return m.number}),a=t[0],l=t[1];t[2],t[3];var s=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var c=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,s,i,c,p]:null},qy={matrix:jy,matrix3d:zy},tu={type:16,number:50,flags:Tn},Yy=[tu,tu],Wy={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Da);return a.length!==2?Yy:[a[0],a[1]]}},Xy={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},wn;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(wn||(wn={}));var Jy={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return wn.BREAK_ALL;case"keep-all":return wn.KEEP_ALL;case"normal":default:return wn.NORMAL}}},Zy={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(ln(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},kA={name:"time",parse:function(e,t){if(t.type===15)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")}},eb={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return ln(t)?t.number:1}},tb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ab={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(sa).map(function(a){switch(a.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(a){return a!==0})}},lb={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],l=[];return t.forEach(function(s){switch(s.type){case 20:case 0:a.push(s.value);break;case 17:a.push(s.number.toString());break;case 4:l.push(a.join(" ")),a.length=0;break}}),a.length&&l.push(a.join(" ")),l.map(function(s){return s.indexOf(" ")===-1?s:"'"+s+"'"})}},sb={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},nb={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(ln(t))return t.number;if(sa(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},ob={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(sa).map(function(a){return a.value})}},ib={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Ta=function(e,t){return(e&t)!==0},rb={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t}},db={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;for(var l=[],s=t.filter(rA),i=0;i<s.length;i++){var c=s[i],p=s[i+1];if(c.type===20){var m=p&&ln(p)?p.number:1;l.push({counter:c.value,increment:m})}}return l}},ub={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(rA),s=0;s<l.length;s++){var i=l[s],c=l[s+1];if(sa(i)&&i.value!=="none"){var p=c&&ln(c)?c.number:0;a.push({counter:i.value,reset:p})}}return a}},cb={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Mn).map(function(a){return kA.parse(e,a)})}},Ab={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;var l=[],s=t.filter(L1);if(s.length%2!==0)return null;for(var i=0;i<s.length;i+=2){var c=s[i].value,p=s[i+1].value;l.push({open:c,close:p})}return l}},au=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},pb={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&vr(t[0],"none")?[]:Ol(t).map(function(a){for(var l={color:255,offsetX:ja,offsetY:ja,blur:ja,spread:ja,inset:!1},s=0,i=0;i<a.length;i++){var c=a[i];vr(c,"inset")?l.inset=!0:As(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:s===2?l.blur=c:l.spread=c,s++):l.color=ds.parse(e,c)}return l})}},fb={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(sa).forEach(function(s){switch(s.value){case"stroke":l.push(1);break;case"fill":l.push(0);break;case"markers":l.push(2);break}}),a.forEach(function(s){l.indexOf(s)===-1&&l.push(s)}),l}},mb={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},hb={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Mn(t)?t.number:0}},_b=function(){function e(t,a){var l,s;this.animationDuration=ut(t,cb,a.animationDuration),this.backgroundClip=ut(t,H1,a.backgroundClip),this.backgroundColor=ut(t,P1,a.backgroundColor),this.backgroundImage=ut(t,J1,a.backgroundImage),this.backgroundOrigin=ut(t,Z1,a.backgroundOrigin),this.backgroundPosition=ut(t,ey,a.backgroundPosition),this.backgroundRepeat=ut(t,ty,a.backgroundRepeat),this.backgroundSize=ut(t,ly,a.backgroundSize),this.borderTopColor=ut(t,ny,a.borderTopColor),this.borderRightColor=ut(t,oy,a.borderRightColor),this.borderBottomColor=ut(t,iy,a.borderBottomColor),this.borderLeftColor=ut(t,ry,a.borderLeftColor),this.borderTopLeftRadius=ut(t,dy,a.borderTopLeftRadius),this.borderTopRightRadius=ut(t,uy,a.borderTopRightRadius),this.borderBottomRightRadius=ut(t,cy,a.borderBottomRightRadius),this.borderBottomLeftRadius=ut(t,Ay,a.borderBottomLeftRadius),this.borderTopStyle=ut(t,py,a.borderTopStyle),this.borderRightStyle=ut(t,fy,a.borderRightStyle),this.borderBottomStyle=ut(t,my,a.borderBottomStyle),this.borderLeftStyle=ut(t,hy,a.borderLeftStyle),this.borderTopWidth=ut(t,_y,a.borderTopWidth),this.borderRightWidth=ut(t,vy,a.borderRightWidth),this.borderBottomWidth=ut(t,gy,a.borderBottomWidth),this.borderLeftWidth=ut(t,yy,a.borderLeftWidth),this.boxShadow=ut(t,pb,a.boxShadow),this.color=ut(t,by,a.color),this.direction=ut(t,wy,a.direction),this.display=ut(t,Cy,a.display),this.float=ut(t,ky,a.cssFloat),this.fontFamily=ut(t,lb,a.fontFamily),this.fontSize=ut(t,sb,a.fontSize),this.fontStyle=ut(t,ib,a.fontStyle),this.fontVariant=ut(t,ob,a.fontVariant),this.fontWeight=ut(t,nb,a.fontWeight),this.letterSpacing=ut(t,xy,a.letterSpacing),this.lineBreak=ut(t,Sy,a.lineBreak),this.lineHeight=ut(t,Fy,a.lineHeight),this.listStyleImage=ut(t,$y,a.listStyleImage),this.listStylePosition=ut(t,Ey,a.listStylePosition),this.listStyleType=ut(t,gr,a.listStyleType),this.marginTop=ut(t,Uy,a.marginTop),this.marginRight=ut(t,Iy,a.marginRight),this.marginBottom=ut(t,Qy,a.marginBottom),this.marginLeft=ut(t,Dy,a.marginLeft),this.opacity=ut(t,eb,a.opacity);var i=ut(t,Vy,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=ut(t,Ty,a.overflowWrap),this.paddingTop=ut(t,My,a.paddingTop),this.paddingRight=ut(t,Ly,a.paddingRight),this.paddingBottom=ut(t,Ry,a.paddingBottom),this.paddingLeft=ut(t,Oy,a.paddingLeft),this.paintOrder=ut(t,fb,a.paintOrder),this.position=ut(t,Py,a.position),this.textAlign=ut(t,Hy,a.textAlign),this.textDecorationColor=ut(t,tb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=ut(t,ab,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=ut(t,Ny,a.textShadow),this.textTransform=ut(t,Ky,a.textTransform),this.transform=ut(t,Gy,a.transform),this.transformOrigin=ut(t,Wy,a.transformOrigin),this.visibility=ut(t,Xy,a.visibility),this.webkitTextStrokeColor=ut(t,mb,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ut(t,hb,a.webkitTextStrokeWidth),this.wordBreak=ut(t,Jy,a.wordBreak),this.zIndex=ut(t,Zy,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return us(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return Ta(this.display,4)||Ta(this.display,33554432)||Ta(this.display,268435456)||Ta(this.display,536870912)||Ta(this.display,67108864)||Ta(this.display,134217728)},e}(),vb=function(){function e(t,a){this.content=ut(t,rb,a.content),this.quotes=ut(t,Ab,a.quotes)}return e}(),lu=function(){function e(t,a){this.counterIncrement=ut(t,db,a.counterIncrement),this.counterReset=ut(t,ub,a.counterReset)}return e}(),ut=function(e,t,a){var l=new oA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new iA(l.read());switch(t.type){case 2:var c=i.parseComponentValue();return t.parse(e,sa(c)?c.value:t.initialValue);case 0:return t.parse(e,i.parseComponentValue());case 1:return t.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(t.format){case"angle":return oi.parse(e,i.parseComponentValue());case"color":return ds.parse(e,i.parseComponentValue());case"image":return sd.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return As(p)?p:ja;case"length-percentage":var m=i.parseComponentValue();return Da(m)?m:ja;case"time":return kA.parse(e,i.parseComponentValue())}break}},gb="data-html2canvas-debug",yb=function(e){var t=e.getAttribute(gb);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},yr=function(e,t){var a=yb(e);return a===1||t===a},Hl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,yr(a,3))debugger;this.styles=new _b(t,window.getComputedStyle(a,null)),Cr(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=si(this.context,a),yr(a,4)&&(this.flags|=16)}return e}(),bb="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_n=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var so=0;so<su.length;so++)_n[su.charCodeAt(so)]=so;var wb=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,m;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=_n[e.charCodeAt(l)],c=_n[e.charCodeAt(l+1)],p=_n[e.charCodeAt(l+2)],m=_n[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|m&63;return _},Cb=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Bb=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},Bs=5,nd=11,Ei=2,kb=nd-Bs,xA=65536>>Bs,xb=1<<Bs,Ui=xb-1,Sb=1024>>Bs,Fb=xA+Sb,$b=Fb,Eb=32,Ub=$b+Eb,Ib=65536>>nd,Qb=1<<kb,Db=Qb-1,nu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},Vb=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Tb=function(e,t){var a=wb(e),l=Array.isArray(a)?Bb(a):new Uint32Array(a),s=Array.isArray(a)?Cb(a):new Uint16Array(a),i=24,c=nu(s,i/2,l[4]/2),p=l[5]===2?nu(s,(i+l[4])/2):Vb(l,Math.ceil((i+l[4])/4));return new Mb(l[0],l[1],l[2],l[3],c,p)},Mb=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Bs],a=(a<<Ei)+(t&Ui),this.data[a];if(t<=65535)return a=this.index[xA+(t-55296>>Bs)],a=(a<<Ei)+(t&Ui),this.data[a];if(t<this.highStart)return a=Ub-Ib+(t>>nd),a=this.index[a],a+=t>>Bs&Db,a=this.index[a],a=(a<<Ei)+(t&Ui),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lb=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var no=0;no<ou.length;no++)Lb[ou.charCodeAt(no)]=no;var Rb=1,Ii=2,Qi=3,iu=4,ru=5,Ob=7,du=8,Di=9,Vi=10,uu=11,cu=12,Au=13,pu=14,Ti=15,Hb=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},Pb=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},Nb=Tb(bb),gl="×",Mi="÷",Kb=function(e){return Nb.get(e)},Gb=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],c=t[a];if(i===Ii&&c===Qi)return gl;if(i===Ii||i===Qi||i===iu||c===Ii||c===Qi||c===iu)return Mi;if(i===du&&[du,Di,uu,cu].indexOf(c)!==-1||(i===uu||i===Di)&&(c===Di||c===Vi)||(i===cu||i===Vi)&&c===Vi||c===Au||c===ru||c===Ob||i===Rb)return gl;if(i===Au&&c===pu){for(;s===ru;)s=t[--l];if(s===pu)return gl}if(i===Ti&&c===Ti){for(var p=0;s===Ti;)p++,s=t[--l];if(p%2===0)return gl}return Mi},jb=function(e){var t=Hb(e),a=t.length,l=0,s=0,i=t.map(Kb);return{next:function(){if(l>=a)return{done:!0,value:null};for(var c=gl;l<a&&(c=Gb(t,i,++l))===gl;);if(c!==gl||l===a){var p=Pb.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},zb=function(e){for(var t=jb(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},qb=function(e){var t=123;if(e.createRange){var a=e.createRange();if(a.getBoundingClientRect){var l=e.createElement("boundtest");l.style.height=t+"px",l.style.display="block",e.body.appendChild(l),a.selectNode(l);var s=a.getBoundingClientRect(),i=Math.round(s.height);if(e.body.removeChild(l),i===t)return!0}}return!1},Yb=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var a=e.createRange();t.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var l=t.firstChild,s=ni(l.data).map(function(m){return Sa(m)}),i=0,c={},p=s.every(function(m,_){a.setStart(l,i),a.setEnd(l,i+m.length);var g=a.getBoundingClientRect();i+=m.length;var y=g.x>c.x||g.y>c.y;return c=g,_===0?!0:y});return e.body.removeChild(t),p},Wb=function(){return typeof new Image().crossOrigin<"u"},Xb=function(){return typeof new XMLHttpRequest().responseType=="string"},Jb=function(e){var t=new Image,a=e.createElement("canvas"),l=a.getContext("2d");if(!l)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{l.drawImage(t,0,0),a.toDataURL()}catch{return!1}return!0},fu=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},Zb=function(e){var t=e.createElement("canvas"),a=100;t.width=a,t.height=a;var l=t.getContext("2d");if(!l)return Promise.reject(!1);l.fillStyle="rgb(0, 255, 0)",l.fillRect(0,0,a,a);var s=new Image,i=t.toDataURL();s.src=i;var c=br(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),mu(c).then(function(p){l.drawImage(p,0,0);var m=l.getImageData(0,0,a,a).data;l.fillStyle="red",l.fillRect(0,0,a,a);var _=e.createElement("div");return _.style.backgroundImage="url("+i+")",_.style.height=a+"px",fu(m)?mu(br(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),fu(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},br=function(e,t,a,l,s){var i="http://www.w3.org/2000/svg",c=document.createElementNS(i,"svg"),p=document.createElementNS(i,"foreignObject");return c.setAttributeNS(null,"width",e.toString()),c.setAttributeNS(null,"height",t.toString()),p.setAttributeNS(null,"width","100%"),p.setAttributeNS(null,"height","100%"),p.setAttributeNS(null,"x",a.toString()),p.setAttributeNS(null,"y",l.toString()),p.setAttributeNS(null,"externalResourcesRequired","true"),c.appendChild(p),p.appendChild(s),c},mu=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){return t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Ga={get SUPPORT_RANGE_BOUNDS(){var e=qb(document);return Object.defineProperty(Ga,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Ga.SUPPORT_RANGE_BOUNDS&&Yb(document);return Object.defineProperty(Ga,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=Jb(document);return Object.defineProperty(Ga,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?Zb(document):Promise.resolve(!1);return Object.defineProperty(Ga,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=Wb();return Object.defineProperty(Ga,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Xb();return Object.defineProperty(Ga,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Ga,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Ga,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Cn=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),e0=function(e,t,a,l){var s=l0(t,a),i=[],c=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Ga.SUPPORT_RANGE_BOUNDS){var m=hu(l,c,p.length).getClientRects();if(m.length>1){var _=od(p),g=0;_.forEach(function(v){i.push(new Cn(v,Xl.fromDOMRectList(e,hu(l,g+c,v.length).getClientRects()))),g+=v.length})}else i.push(new Cn(p,Xl.fromDOMRectList(e,m)))}else{var y=l.splitText(p.length);i.push(new Cn(p,t0(e,l))),l=y}else Ga.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));c+=p.length}),i},t0=function(e,t){var a=t.ownerDocument;if(a){var l=a.createElement("html2canvaswrapper");l.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(l,t);var i=si(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return Xl.EMPTY},hu=function(e,t,a){var l=e.ownerDocument;if(!l)throw new Error("Node has no owner document");var s=l.createRange();return s.setStart(e,t),s.setEnd(e,t+a),s},od=function(e){if(Ga.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(a){return a.segment})}return zb(e)},a0=function(e,t){if(Ga.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(e)).map(function(l){return l.segment})}return n0(e,t)},l0=function(e,t){return t.letterSpacing!==0?od(e):a0(e,t)},s0=[32,160,4961,65792,65793,4153,4241],n0=function(e,t){for(var a=Ig(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),l=[],s,i=function(){if(s.value){var c=s.value.slice(),p=ni(c),m="";p.forEach(function(_){s0.indexOf(_)===-1?m+=Sa(_):(m.length&&l.push(m),l.push(Sa(_)),m="")}),m.length&&l.push(m)}};!(s=a.next()).done;)i();return l},o0=function(){function e(t,a,l){this.text=i0(a.data,l.textTransform),this.textBounds=e0(t,this.text,l,a)}return e}(),i0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(r0,d0);case 2:return e.toUpperCase();default:return e}},r0=/(^|\s|:|-|\(|\))([a-z])/g,d0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},SA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.src=l.currentSrc||l.src,s.intrinsicWidth=l.naturalWidth,s.intrinsicHeight=l.naturalHeight,s.context.cache.addImage(s.src),s}return t}(Hl),FA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l,s.intrinsicWidth=l.width,s.intrinsicHeight=l.height,s}return t}(Hl),$A=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,c=si(a,l);return l.setAttribute("width",c.width+"px"),l.setAttribute("height",c.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(l)),s.intrinsicWidth=l.width.baseVal.value,s.intrinsicHeight=l.height.baseVal.value,s.context.cache.addImage(s.svg),s}return t}(Hl),EA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Hl),wr=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.start=l.start,s.reversed=typeof l.reversed=="boolean"&&l.reversed===!0,s}return t}(Hl),u0=[{type:15,flags:0,unit:"px",number:3}],c0=[{type:16,flags:0,number:50}],A0=function(e){return e.width>e.height?new Xl(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new Xl(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},p0=function(e){var t=e.type===f0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Uo="checkbox",Io="radio",f0="password",_u=707406591,id=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;switch(s.type=l.type.toLowerCase(),s.checked=l.checked,s.value=p0(l),(s.type===Uo||s.type===Io)&&(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=A0(s.bounds)),s.type){case Uo:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=u0;break;case Io:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=c0;break}return s}return t}(Hl),UA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=l.options[l.selectedIndex||0];return s.value=i&&i.text||"",s}return t}(Hl),IA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(Hl),QA=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;s.src=l.src,s.width=parseInt(l.width,10)||0,s.height=parseInt(l.height,10)||0,s.backgroundColor=s.styles.backgroundColor;try{if(l.contentWindow&&l.contentWindow.document&&l.contentWindow.document.documentElement){s.tree=VA(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?bn(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):zl.TRANSPARENT,c=l.contentWindow.document.body?bn(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):zl.TRANSPARENT;s.backgroundColor=us(i)?us(c)?s.styles.backgroundColor:c:i}}catch{}return s}return t}(Hl),m0=["OL","UL","MENU"],yo=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,TA(s)&&s.data.trim().length>0)a.textNodes.push(new o0(e,s,a.styles));else if(js(s))if(OA(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return yo(e,p,a,l)});else{var c=DA(e,s);c.styles.isVisible()&&(h0(s,c,l)?c.flags|=4:_0(c.styles)&&(c.flags|=2),m0.indexOf(s.tagName)!==-1&&(c.flags|=8),a.elements.push(c),s.slot,s.shadowRoot?yo(e,s.shadowRoot,c,l):!Qo(s)&&!MA(s)&&!Do(s)&&yo(e,s,c,l))}},DA=function(e,t){return Br(t)?new SA(e,t):LA(t)?new FA(e,t):MA(t)?new $A(e,t):v0(t)?new EA(e,t):g0(t)?new wr(e,t):y0(t)?new id(e,t):Do(t)?new UA(e,t):Qo(t)?new IA(e,t):RA(t)?new QA(e,t):new Hl(e,t)},VA=function(e,t){var a=DA(e,t);return a.flags|=4,yo(e,t,a,a),a},h0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||rd(e)&&a.styles.isTransparent()},_0=function(e){return e.isPositioned()||e.isFloating()},TA=function(e){return e.nodeType===Node.TEXT_NODE},js=function(e){return e.nodeType===Node.ELEMENT_NODE},Cr=function(e){return js(e)&&typeof e.style<"u"&&!bo(e)},bo=function(e){return typeof e.className=="object"},v0=function(e){return e.tagName==="LI"},g0=function(e){return e.tagName==="OL"},y0=function(e){return e.tagName==="INPUT"},b0=function(e){return e.tagName==="HTML"},MA=function(e){return e.tagName==="svg"},rd=function(e){return e.tagName==="BODY"},LA=function(e){return e.tagName==="CANVAS"},vu=function(e){return e.tagName==="VIDEO"},Br=function(e){return e.tagName==="IMG"},RA=function(e){return e.tagName==="IFRAME"},gu=function(e){return e.tagName==="STYLE"},w0=function(e){return e.tagName==="SCRIPT"},Qo=function(e){return e.tagName==="TEXTAREA"},Do=function(e){return e.tagName==="SELECT"},OA=function(e){return e.tagName==="SLOT"},yu=function(e){return e.tagName.indexOf("-")>0},C0=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(t){var a=this.counters[t];return a&&a.length?a[a.length-1]:1},e.prototype.getCounterValues=function(t){var a=this.counters[t];return a||[]},e.prototype.pop=function(t){var a=this;t.forEach(function(l){return a.counters[l].pop()})},e.prototype.parse=function(t){var a=this,l=t.counterIncrement,s=t.counterReset,i=!0;l!==null&&l.forEach(function(p){var m=a.counters[p.counter];m&&p.increment!==0&&(i=!1,m.length||m.push(1),m[Math.max(0,m.length-1)]+=p.increment)});var c=[];return i&&s.forEach(function(p){var m=a.counters[p.counter];c.push(p.counter),m||(m=a.counters[p.counter]=[]),m.push(p.reset)}),c},e}(),bu={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},wu={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},B0={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},k0={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ms=function(e,t,a,l,s,i){return e<t||e>a?In(e,s,i.length>0):l.integers.reduce(function(c,p,m){for(;e>=p;)e-=p,c+=l.values[m];return c},"")+i},HA=function(e,t,a,l){var s="";do a||e--,s=l(e)+s,e/=t;while(e*t>=t);return s},xa=function(e,t,a,l,s){var i=a-t+1;return(e<0?"-":"")+(HA(Math.abs(e),i,l,function(c){return Sa(Math.floor(c%i)+t)})+s)},_s=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return HA(Math.abs(e),l,!1,function(s){return t[Math.floor(s%l)]})+a},Hs=1,ts=2,as=4,vn=8,Kl=function(e,t,a,l,s,i){if(e<-9999||e>9999)return In(e,4,s.length>0);var c=Math.abs(e),p=s;if(c===0)return t[0]+p;for(var m=0;c>0&&m<=4;m++){var _=c%10;_===0&&Ta(i,Hs)&&p!==""?p=t[_]+p:_>1||_===1&&m===0||_===1&&m===1&&Ta(i,ts)||_===1&&m===1&&Ta(i,as)&&e>100||_===1&&m>1&&Ta(i,vn)?p=t[_]+(m>0?a[m-1]:"")+p:_===1&&m>0&&(p=a[m-1]+p),c=Math.floor(c/10)}return(e<0?l:"")+p},Cu="十百千萬",Bu="拾佰仟萬",ku="マイナス",Li="마이너스",In=function(e,t,a){var l=a?". ":"",s=a?"、":"",i=a?", ":"",c=a?" ":"";switch(t){case 0:return"•"+c;case 1:return"◦"+c;case 2:return"◾"+c;case 5:var p=xa(e,48,57,!0,l);return p.length<4?"0"+p:p;case 4:return _s(e,"〇一二三四五六七八九",s);case 6:return Ms(e,1,3999,bu,3,l).toLowerCase();case 7:return Ms(e,1,3999,bu,3,l);case 8:return xa(e,945,969,!1,l);case 9:return xa(e,97,122,!1,l);case 10:return xa(e,65,90,!1,l);case 11:return xa(e,1632,1641,!0,l);case 12:case 49:return Ms(e,1,9999,wu,3,l);case 35:return Ms(e,1,9999,wu,3,l).toLowerCase();case 13:return xa(e,2534,2543,!0,l);case 14:case 30:return xa(e,6112,6121,!0,l);case 15:return _s(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return _s(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Kl(e,"零一二三四五六七八九",Cu,"負",s,ts|as|vn);case 47:return Kl(e,"零壹貳參肆伍陸柒捌玖",Bu,"負",s,Hs|ts|as|vn);case 42:return Kl(e,"零一二三四五六七八九",Cu,"负",s,ts|as|vn);case 41:return Kl(e,"零壹贰叁肆伍陆柒捌玖",Bu,"负",s,Hs|ts|as|vn);case 26:return Kl(e,"〇一二三四五六七八九","十百千万",ku,s,0);case 25:return Kl(e,"零壱弐参四伍六七八九","拾百千万",ku,s,Hs|ts|as);case 31:return Kl(e,"영일이삼사오육칠팔구","십백천만",Li,i,Hs|ts|as);case 33:return Kl(e,"零一二三四五六七八九","十百千萬",Li,i,0);case 32:return Kl(e,"零壹貳參四五六七八九","拾百千",Li,i,Hs|ts|as);case 18:return xa(e,2406,2415,!0,l);case 20:return Ms(e,1,19999,k0,3,l);case 21:return xa(e,2790,2799,!0,l);case 22:return xa(e,2662,2671,!0,l);case 22:return Ms(e,1,10999,B0,3,l);case 23:return _s(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return _s(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return xa(e,3302,3311,!0,l);case 28:return _s(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return _s(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return xa(e,3792,3801,!0,l);case 37:return xa(e,6160,6169,!0,l);case 38:return xa(e,4160,4169,!0,l);case 39:return xa(e,2918,2927,!0,l);case 40:return xa(e,1776,1785,!0,l);case 43:return xa(e,3046,3055,!0,l);case 44:return xa(e,3174,3183,!0,l);case 45:return xa(e,3664,3673,!0,l);case 46:return xa(e,3872,3881,!0,l);case 3:default:return xa(e,48,57,!0,l)}},PA="data-html2canvas-ignore",xu=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new C0,this.quoteDepth=0,!a.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(a.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(t,a){var l=this,s=x0(t,a);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,c=t.defaultView.pageYOffset,p=s.contentWindow,m=p.document,_=$0(s).then(function(){return el(l,void 0,void 0,function(){var g,y;return Ya(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(Q0),p&&(p.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(p.scrollY!==a.top||p.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(p.scrollX-a.left,p.scrollY-a.top,0,0))),g=this.options.onclone,y=this.clonedReferenceElement,typeof y>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:m.fonts&&m.fonts.ready?[4,m.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,F0(m)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(m,y)}).then(function(){return s})]:[2,s]}})})});return m.open(),m.write(U0(document.doctype)+"<html></html>"),I0(this.referenceElement.ownerDocument,i,c),m.replaceChild(m.adoptNode(this.documentElement),m.documentElement),m.close(),_},e.prototype.createElementClone=function(t){if(yr(t,2))debugger;if(LA(t))return this.createCanvasClone(t);if(vu(t))return this.createVideoClone(t);if(gu(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Br(a)&&(Br(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),yu(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return Ri(t.style,a),a},e.prototype.createStyleClone=function(t){try{var a=t.sheet;if(a&&a.cssRules){var l=[].slice.call(a.cssRules,0).reduce(function(i,c){return c&&typeof c.cssText=="string"?i+c.cssText:i},""),s=t.cloneNode(!1);return s.textContent=l,s}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var a;if(this.options.inlineImages&&t.ownerDocument){var l=t.ownerDocument.createElement("img");try{return l.src=t.toDataURL(),l}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var s=t.cloneNode(!1);try{s.width=t.width,s.height=t.height;var i=t.getContext("2d"),c=s.getContext("2d");if(c)if(!this.options.allowTaint&&i)c.putImageData(i.getImageData(0,0,t.width,t.height),0,0);else{var p=(a=t.getContext("webgl2"))!==null&&a!==void 0?a:t.getContext("webgl");if(p){var m=p.getContextAttributes();(m==null?void 0:m.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}c.drawImage(t,0,0)}return s}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return s},e.prototype.createVideoClone=function(t){var a=t.ownerDocument.createElement("canvas");a.width=t.offsetWidth,a.height=t.offsetHeight;var l=a.getContext("2d");try{return l&&(l.drawImage(t,0,0,a.width,a.height),this.options.allowTaint||l.getImageData(0,0,a.width,a.height)),a}catch{this.context.logger.info("Unable to clone video as it is tainted",t)}var s=t.ownerDocument.createElement("canvas");return s.width=t.offsetWidth,s.height=t.offsetHeight,s},e.prototype.appendChildNode=function(t,a,l){(!js(a)||!w0(a)&&!a.hasAttribute(PA)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!js(a)||!gu(a))&&t.appendChild(this.cloneNode(a,l))},e.prototype.cloneChildNodes=function(t,a,l){for(var s=this,i=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;i;i=i.nextSibling)if(js(i)&&OA(i)&&typeof i.assignedNodes=="function"){var c=i.assignedNodes();c.length&&c.forEach(function(p){return s.appendChildNode(a,p,l)})}else this.appendChildNode(a,i,l)},e.prototype.cloneNode=function(t,a){if(TA(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&js(t)&&(Cr(t)||bo(t))){var s=this.createElementClone(t);s.style.transitionProperty="none";var i=l.getComputedStyle(t),c=l.getComputedStyle(t,":before"),p=l.getComputedStyle(t,":after");this.referenceElement===t&&Cr(s)&&(this.clonedReferenceElement=s),rd(s)&&T0(s);var m=this.counters.parse(new lu(this.context,i)),_=this.resolvePseudoContent(t,s,c,Bn.BEFORE);yu(t)&&(a=!0),vu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var g=this.resolvePseudoContent(t,s,p,Bn.AFTER);return g&&s.appendChild(g),this.counters.pop(m),(i&&(this.options.copyStyles||bo(t))&&!RA(t)||a)&&Ri(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Qo(t)||Do(t))&&(Qo(s)||Do(s))&&(s.value=t.value),s}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,l,s){var i=this;if(l){var c=l.content,p=a.ownerDocument;if(!(!p||!c||c==="none"||c==="-moz-alt-content"||l.display==="none")){this.counters.parse(new lu(this.context,l));var m=new vb(this.context,l),_=p.createElement("html2canvaspseudoelement");Ri(l,_),m.content.forEach(function(y){if(y.type===0)_.appendChild(p.createTextNode(y.value));else if(y.type===22){var v=p.createElement("img");v.src=y.value,v.style.opacity="1",_.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var C=y.values.filter(sa);C.length&&_.appendChild(p.createTextNode(t.getAttribute(C[0].value)||""))}else if(y.name==="counter"){var b=y.values.filter(en),w=b[0],x=b[1];if(w&&sa(w)){var F=i.counters.getCounterValue(w.value),L=x&&sa(x)?gr.parse(i.context,x.value):3;_.appendChild(p.createTextNode(In(F,L,!1)))}}else if(y.name==="counters"){var U=y.values.filter(en),w=U[0],S=U[1],x=U[2];if(w&&sa(w)){var M=i.counters.getCounterValues(w.value),I=x&&sa(x)?gr.parse(i.context,x.value):3,T=S&&S.type===0?S.value:"",Q=M.map(function(H){return In(H,I,!1)}).join(T);_.appendChild(p.createTextNode(Q))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(au(m.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(au(m.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=kr+" "+xr;var g=s===Bn.BEFORE?" "+kr:" "+xr;return bo(a)?a.className.baseValue+=g:a.className+=g,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),Bn;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(Bn||(Bn={}));var x0=function(e,t){var a=e.createElement("iframe");return a.className="html2canvas-container",a.style.visibility="hidden",a.style.position="fixed",a.style.left="-10000px",a.style.top="0px",a.style.border="0",a.width=t.width.toString(),a.height=t.height.toString(),a.scrolling="no",a.setAttribute(PA,"true"),e.body.appendChild(a),a},S0=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},F0=function(e){return Promise.all([].slice.call(e.images,0).map(S0))},$0=function(e){return new Promise(function(t,a){var l=e.contentWindow;if(!l)return a("No window assigned for iframe");var s=l.document;l.onload=e.onload=function(){l.onload=e.onload=null;var i=setInterval(function(){s.body.childNodes.length>0&&s.readyState==="complete"&&(clearInterval(i),t(e))},50)}})},E0=["all","d","content"],Ri=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);E0.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},U0=function(e){var t="";return e&&(t+="<!DOCTYPE ",e.name&&(t+=e.name),e.internalSubset&&(t+=e.internalSubset),e.publicId&&(t+='"'+e.publicId+'"'),e.systemId&&(t+='"'+e.systemId+'"'),t+=">"),t},I0=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},Q0=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},D0=":before",V0=":after",kr="___html2canvas___pseudoelement_before",xr="___html2canvas___pseudoelement_after",Su=`{ | |
| 18 | +***************************************************************************** */var _r=function(e,t){return _r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,l){a.__proto__=l}||function(a,l){for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(a[s]=l[s])},_r(e,t)};function Rl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_r(e,t);function a(){this.constructor=e}e.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)}var vr=function(){return vr=Object.assign||function(t){for(var a,l=1,s=arguments.length;l<s;l++){a=arguments[l];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(t[i]=a[i])}return t},vr.apply(this,arguments)};function al(e,t,a,l){function s(i){return i instanceof a?i:new a(function(c){c(i)})}return new(a||(a=Promise))(function(i,c){function p(g){try{_(l.next(g))}catch(y){c(y)}}function f(g){try{_(l.throw(g))}catch(y){c(y)}}function _(g){g.done?i(g.value):s(g.value).then(p,f)}_((l=l.apply(e,[])).next())})}function Ja(e,t){var a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},l,s,i,c;return c={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function p(_){return function(g){return f([_,g])}}function f(_){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,s&&(i=_[0]&2?s.return:_[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,_[1])).done)return i;switch(s=0,i&&(_=[_[0]&2,i.value]),_[0]){case 0:case 1:i=_;break;case 4:return a.label++,{value:_[1],done:!1};case 5:a.label++,s=_[1],_=[0];continue;case 7:_=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(_[0]===6||_[0]===2)){a=0;continue}if(_[0]===3&&(!i||_[1]>i[0]&&_[1]<i[3])){a.label=_[1];break}if(_[0]===6&&a.label<i[1]){a.label=i[1],i=_;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(_);break}i[2]&&a.ops.pop(),a.trys.pop();continue}_=t.call(e,a)}catch(g){_=[6,g],s=0}finally{l=i=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}function qn(e,t,a){if(arguments.length===2)for(var l=0,s=t.length,i;l<s;l++)(i||!(l in t))&&(i||(i=Array.prototype.slice.call(t,0,l)),i[l]=t[l]);return e.concat(i||t)}var ss=function(){function e(t,a,l,s){this.left=t,this.top=a,this.width=l,this.height=s}return e.prototype.add=function(t,a,l,s){return new e(this.left+t,this.top+a,this.width+l,this.height+s)},e.fromClientRect=function(t,a){return new e(a.left+t.windowBounds.left,a.top+t.windowBounds.top,a.width,a.height)},e.fromDOMRectList=function(t,a){var l=Array.from(a).find(function(s){return s.width!==0});return l?new e(l.left+t.windowBounds.left,l.top+t.windowBounds.top,l.width,l.height):e.EMPTY},e.EMPTY=new e(0,0,0,0),e}(),pi=function(e,t){return ss.fromClientRect(e,t.getBoundingClientRect())},Qg=function(e){var t=e.body,a=e.documentElement;if(!t||!a)throw new Error("Unable to get document size");var l=Math.max(Math.max(t.scrollWidth,a.scrollWidth),Math.max(t.offsetWidth,a.offsetWidth),Math.max(t.clientWidth,a.clientWidth)),s=Math.max(Math.max(t.scrollHeight,a.scrollHeight),Math.max(t.offsetHeight,a.offsetHeight),Math.max(t.clientHeight,a.clientHeight));return new ss(0,0,l,s)},fi=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},$a=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},jd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Yn=0;Yn<jd.length;Yn++)Dg[jd.charCodeAt(Yn)]=Yn;var qd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Wn=0;Wn<qd.length;Wn++)bn[qd.charCodeAt(Wn)]=Wn;var Vg=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=bn[e.charCodeAt(l)],c=bn[e.charCodeAt(l+1)],p=bn[e.charCodeAt(l+2)],f=bn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|f&63;return _},Tg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},Mg=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},$s=5,pd=11,Ui=2,Lg=pd-$s,yA=65536>>$s,Rg=1<<$s,Ii=Rg-1,Og=1024>>$s,Pg=yA+Og,Hg=Pg,Ng=32,Kg=Hg+Ng,Gg=65536>>pd,zg=1<<Lg,jg=zg-1,Yd=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},qg=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},Yg=function(e,t){var a=Vg(e),l=Array.isArray(a)?Mg(a):new Uint32Array(a),s=Array.isArray(a)?Tg(a):new Uint16Array(a),i=24,c=Yd(s,i/2,l[4]/2),p=l[5]===2?Yd(s,(i+l[4])/2):qg(l,Math.ceil((i+l[4])/4));return new Wg(l[0],l[1],l[2],l[3],c,p)},Wg=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>$s],a=(a<<Ui)+(t&Ii),this.data[a];if(t<=65535)return a=this.index[yA+(t-55296>>$s)],a=(a<<Ui)+(t&Ii),this.data[a];if(t<this.highStart)return a=Kg-Gg+(t>>pd),a=this.index[a],a+=t>>$s&jg,a=this.index[a],a=(a<<Ui)+(t&Ii),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Jn=0;Jn<Wd.length;Jn++)Jg[Wd.charCodeAt(Jn)]=Jn;var Xg="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Jd=50,Zg=1,bA=2,wA=3,ey=4,ty=5,Xd=7,CA=8,Zd=9,cs=10,gr=11,eu=12,yr=13,ay=14,wn=15,br=16,Xn=17,hn=18,ly=19,tu=20,wr=21,_n=22,Qi=23,Ps=24,fl=25,Cn=26,kn=27,Hs=28,sy=29,xs=30,ny=31,Zn=32,eo=33,Cr=34,kr=35,Br=36,Ln=37,xr=38,So=39,Fo=40,Di=41,kA=42,oy=43,iy=[9001,65288],BA="!",Nt="×",to="÷",Sr=Yg(Xg),Yl=[xs,Br],Fr=[Zg,bA,wA,ty],xA=[cs,CA],au=[kn,Cn],ry=Fr.concat(xA),lu=[xr,So,Fo,Cr,kr],dy=[wn,yr],uy=function(e,t){t===void 0&&(t="strict");var a=[],l=[],s=[];return e.forEach(function(i,c){var p=Sr.get(i);if(p>Jd?(s.push(!0),p-=Jd):s.push(!1),["normal","auto","loose"].indexOf(t)!==-1&&[8208,8211,12316,12448].indexOf(i)!==-1)return l.push(c),a.push(br);if(p===ey||p===gr){if(c===0)return l.push(c),a.push(xs);var f=a[c-1];return ry.indexOf(f)===-1?(l.push(l[c-1]),a.push(f)):(l.push(c),a.push(xs))}if(l.push(c),p===ny)return a.push(t==="strict"?wr:Ln);if(p===kA||p===sy)return a.push(xs);if(p===oy)return i>=131072&&i<=196605||i>=196608&&i<=262141?a.push(Ln):a.push(xs);a.push(p)}),[l,a,s]},Vi=function(e,t,a,l){var s=l[a];if(Array.isArray(e)?e.indexOf(s)!==-1:e===s)for(var i=a;i<=l.length;){i++;var c=l[i];if(c===t)return!0;if(c!==cs)break}if(s===cs)for(var i=a;i>0;){i--;var p=l[i];if(Array.isArray(e)?e.indexOf(p)!==-1:e===p)for(var f=a;f<=l.length;){f++;var c=l[f];if(c===t)return!0;if(c!==cs)break}if(p!==cs)break}return!1},su=function(e,t){for(var a=e;a>=0;){var l=t[a];if(l===cs)a--;else return l}return 0},cy=function(e,t,a,l,s){if(a[l]===0)return Nt;var i=l-1;if(Array.isArray(s)&&s[i]===!0)return Nt;var c=i-1,p=i+1,f=t[i],_=c>=0?t[c]:0,g=t[p];if(f===bA&&g===wA)return Nt;if(Fr.indexOf(f)!==-1)return BA;if(Fr.indexOf(g)!==-1||xA.indexOf(g)!==-1)return Nt;if(su(i,t)===CA)return to;if(Sr.get(e[i])===gr||(f===Zn||f===eo)&&Sr.get(e[p])===gr||f===Xd||g===Xd||f===Zd||[cs,yr,wn].indexOf(f)===-1&&g===Zd||[Xn,hn,ly,Ps,Hs].indexOf(g)!==-1||su(i,t)===_n||Vi(Qi,_n,i,t)||Vi([Xn,hn],wr,i,t)||Vi(eu,eu,i,t))return Nt;if(f===cs)return to;if(f===Qi||g===Qi)return Nt;if(g===br||f===br)return to;if([yr,wn,wr].indexOf(g)!==-1||f===ay||_===Br&&dy.indexOf(f)!==-1||f===Hs&&g===Br||g===tu||Yl.indexOf(g)!==-1&&f===fl||Yl.indexOf(f)!==-1&&g===fl||f===kn&&[Ln,Zn,eo].indexOf(g)!==-1||[Ln,Zn,eo].indexOf(f)!==-1&&g===Cn||Yl.indexOf(f)!==-1&&au.indexOf(g)!==-1||au.indexOf(f)!==-1&&Yl.indexOf(g)!==-1||[kn,Cn].indexOf(f)!==-1&&(g===fl||[_n,wn].indexOf(g)!==-1&&t[p+1]===fl)||[_n,wn].indexOf(f)!==-1&&g===fl||f===fl&&[fl,Hs,Ps].indexOf(g)!==-1)return Nt;if([fl,Hs,Ps,Xn,hn].indexOf(g)!==-1)for(var y=i;y>=0;){var v=t[y];if(v===fl)return Nt;if([Hs,Ps].indexOf(v)!==-1)y--;else break}if([kn,Cn].indexOf(g)!==-1)for(var y=[Xn,hn].indexOf(f)!==-1?c:i;y>=0;){var v=t[y];if(v===fl)return Nt;if([Hs,Ps].indexOf(v)!==-1)y--;else break}if(xr===f&&[xr,So,Cr,kr].indexOf(g)!==-1||[So,Cr].indexOf(f)!==-1&&[So,Fo].indexOf(g)!==-1||[Fo,kr].indexOf(f)!==-1&&g===Fo||lu.indexOf(f)!==-1&&[tu,Cn].indexOf(g)!==-1||lu.indexOf(g)!==-1&&f===kn||Yl.indexOf(f)!==-1&&Yl.indexOf(g)!==-1||f===Ps&&Yl.indexOf(g)!==-1||Yl.concat(fl).indexOf(f)!==-1&&g===_n&&iy.indexOf(e[p])===-1||Yl.concat(fl).indexOf(g)!==-1&&f===hn)return Nt;if(f===Di&&g===Di){for(var w=a[i],k=1;w>0&&(w--,t[w]===Di);)k++;if(k%2!==0)return Nt}return f===Zn&&g===eo?Nt:to},Ay=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var a=uy(e,t.lineBreak),l=a[0],s=a[1],i=a[2];(t.wordBreak==="break-all"||t.wordBreak==="break-word")&&(s=s.map(function(p){return[fl,xs,kA].indexOf(p)!==-1?Ln:p}));var c=t.wordBreak==="keep-all"?i.map(function(p,f){return p&&e[f]>=19968&&e[f]<=40959}):void 0;return[l,s,c]},py=function(){function e(t,a,l,s){this.codePoints=t,this.required=a===BA,this.start=l,this.end=s}return e.prototype.slice=function(){return $a.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),fy=function(e,t){var a=fi(e),l=Ay(a,t),s=l[0],i=l[1],c=l[2],p=a.length,f=0,_=0;return{next:function(){if(_>=p)return{done:!0,value:null};for(var g=Nt;_<p&&(g=cy(a,i,s,++_,c))===Nt;);if(g!==Nt||_===p){var y=new py(a,g,f,_);return f=_,{value:y,done:!1}}return{done:!0,value:null}}}},my=1,hy=2,Nn=4,nu=8,Mo=10,ou=47,Fn=92,_y=9,vy=32,ao=34,vn=61,gy=35,yy=36,by=37,lo=39,so=40,gn=41,wy=95,dl=45,Cy=33,ky=60,By=62,xy=64,Sy=91,Fy=93,$y=61,Ey=123,no=63,Uy=125,iu=124,Iy=126,Qy=128,ru=65533,Ti=42,Fs=43,Dy=44,Vy=58,Ty=59,Rn=46,My=0,Ly=8,Ry=11,Oy=14,Py=31,Hy=127,Pl=-1,SA=48,FA=97,$A=101,Ny=102,Ky=117,Gy=122,EA=65,UA=69,IA=70,zy=85,jy=90,Xa=function(e){return e>=SA&&e<=57},qy=function(e){return e>=55296&&e<=57343},Ns=function(e){return Xa(e)||e>=EA&&e<=IA||e>=FA&&e<=Ny},Yy=function(e){return e>=FA&&e<=Gy},Wy=function(e){return e>=EA&&e<=jy},Jy=function(e){return Yy(e)||Wy(e)},Xy=function(e){return e>=Qy},oo=function(e){return e===Mo||e===_y||e===vy},Lo=function(e){return Jy(e)||Xy(e)||e===wy},du=function(e){return Lo(e)||Xa(e)||e===dl},Zy=function(e){return e>=My&&e<=Ly||e===Ry||e>=Oy&&e<=Py||e===Hy},us=function(e,t){return e!==Fn?!1:t!==Mo},io=function(e,t,a){return e===dl?Lo(t)||us(t,a):Lo(e)?!0:!!(e===Fn&&us(e,t))},Mi=function(e,t,a){return e===Fs||e===dl?Xa(t)?!0:t===Rn&&Xa(a):Xa(e===Rn?t:e)},e1=function(e){var t=0,a=1;(e[t]===Fs||e[t]===dl)&&(e[t]===dl&&(a=-1),t++);for(var l=[];Xa(e[t]);)l.push(e[t++]);var s=l.length?parseInt($a.apply(void 0,l),10):0;e[t]===Rn&&t++;for(var i=[];Xa(e[t]);)i.push(e[t++]);var c=i.length,p=c?parseInt($a.apply(void 0,i),10):0;(e[t]===UA||e[t]===$A)&&t++;var f=1;(e[t]===Fs||e[t]===dl)&&(e[t]===dl&&(f=-1),t++);for(var _=[];Xa(e[t]);)_.push(e[t++]);var g=_.length?parseInt($a.apply(void 0,_),10):0;return a*(s+p*Math.pow(10,-c))*Math.pow(10,f*g)},t1={type:2},a1={type:3},l1={type:4},s1={type:13},n1={type:8},o1={type:21},i1={type:9},r1={type:10},d1={type:11},u1={type:12},c1={type:14},ro={type:23},A1={type:1},p1={type:25},f1={type:24},m1={type:26},h1={type:27},_1={type:28},v1={type:29},g1={type:31},$r={type:32},QA=function(){function e(){this._value=[]}return e.prototype.write=function(t){this._value=this._value.concat(fi(t))},e.prototype.read=function(){for(var t=[],a=this.consumeToken();a!==$r;)t.push(a),a=this.consumeToken();return t},e.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case ao:return this.consumeStringToken(ao);case gy:var a=this.peekCodePoint(0),l=this.peekCodePoint(1),s=this.peekCodePoint(2);if(du(a)||us(l,s)){var i=io(a,l,s)?hy:my,c=this.consumeName();return{type:5,value:c,flags:i}}break;case yy:if(this.peekCodePoint(0)===vn)return this.consumeCodePoint(),s1;break;case lo:return this.consumeStringToken(lo);case so:return t1;case gn:return a1;case Ti:if(this.peekCodePoint(0)===vn)return this.consumeCodePoint(),c1;break;case Fs:if(Mi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case Dy:return l1;case dl:var p=t,f=this.peekCodePoint(0),_=this.peekCodePoint(1);if(Mi(p,f,_))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(io(p,f,_))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(f===dl&&_===By)return this.consumeCodePoint(),this.consumeCodePoint(),f1;break;case Rn:if(Mi(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case ou:if(this.peekCodePoint(0)===Ti)for(this.consumeCodePoint();;){var g=this.consumeCodePoint();if(g===Ti&&(g=this.consumeCodePoint(),g===ou))return this.consumeToken();if(g===Pl)return this.consumeToken()}break;case Vy:return m1;case Ty:return h1;case ky:if(this.peekCodePoint(0)===Cy&&this.peekCodePoint(1)===dl&&this.peekCodePoint(2)===dl)return this.consumeCodePoint(),this.consumeCodePoint(),p1;break;case xy:var y=this.peekCodePoint(0),v=this.peekCodePoint(1),w=this.peekCodePoint(2);if(io(y,v,w)){var c=this.consumeName();return{type:7,value:c}}break;case Sy:return _1;case Fn:if(us(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case Fy:return v1;case $y:if(this.peekCodePoint(0)===vn)return this.consumeCodePoint(),n1;break;case Ey:return d1;case Uy:return u1;case Ky:case zy:var k=this.peekCodePoint(0),b=this.peekCodePoint(1);return k===Fs&&(Ns(b)||b===no)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case iu:if(this.peekCodePoint(0)===vn)return this.consumeCodePoint(),i1;if(this.peekCodePoint(0)===iu)return this.consumeCodePoint(),o1;break;case Iy:if(this.peekCodePoint(0)===vn)return this.consumeCodePoint(),r1;break;case Pl:return $r}return oo(t)?(this.consumeWhiteSpace(),g1):Xa(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Lo(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:$a(t)}},e.prototype.consumeCodePoint=function(){var t=this._value.shift();return typeof t>"u"?-1:t},e.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},e.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},e.prototype.consumeUnicodeRangeToken=function(){for(var t=[],a=this.consumeCodePoint();Ns(a)&&t.length<6;)t.push(a),a=this.consumeCodePoint();for(var l=!1;a===no&&t.length<6;)t.push(a),a=this.consumeCodePoint(),l=!0;if(l){var s=parseInt($a.apply(void 0,t.map(function(f){return f===no?SA:f})),16),i=parseInt($a.apply(void 0,t.map(function(f){return f===no?IA:f})),16);return{type:30,start:s,end:i}}var c=parseInt($a.apply(void 0,t),16);if(this.peekCodePoint(0)===dl&&Ns(this.peekCodePoint(1))){this.consumeCodePoint(),a=this.consumeCodePoint();for(var p=[];Ns(a)&&p.length<6;)p.push(a),a=this.consumeCodePoint();var i=parseInt($a.apply(void 0,p),16);return{type:30,start:c,end:i}}else return{type:30,start:c,end:c}},e.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return t.toLowerCase()==="url"&&this.peekCodePoint(0)===so?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===so?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},e.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Pl)return{type:22,value:""};var a=this.peekCodePoint(0);if(a===lo||a===ao){var l=this.consumeStringToken(this.consumeCodePoint());return l.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Pl||this.peekCodePoint(0)===gn)?(this.consumeCodePoint(),{type:22,value:l.value}):(this.consumeBadUrlRemnants(),ro)}for(;;){var s=this.consumeCodePoint();if(s===Pl||s===gn)return{type:22,value:$a.apply(void 0,t)};if(oo(s))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Pl||this.peekCodePoint(0)===gn?(this.consumeCodePoint(),{type:22,value:$a.apply(void 0,t)}):(this.consumeBadUrlRemnants(),ro);if(s===ao||s===lo||s===so||Zy(s))return this.consumeBadUrlRemnants(),ro;if(s===Fn)if(us(s,this.peekCodePoint(0)))t.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ro;else t.push(s)}},e.prototype.consumeWhiteSpace=function(){for(;oo(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(t===gn||t===Pl)return;us(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(t){for(var a=5e4,l="";t>0;){var s=Math.min(a,t);l+=$a.apply(void 0,this._value.splice(0,s)),t-=s}return this._value.shift(),l},e.prototype.consumeStringToken=function(t){var a="",l=0;do{var s=this._value[l];if(s===Pl||s===void 0||s===t)return a+=this.consumeStringSlice(l),{type:0,value:a};if(s===Mo)return this._value.splice(0,l),A1;if(s===Fn){var i=this._value[l+1];i!==Pl&&i!==void 0&&(i===Mo?(a+=this.consumeStringSlice(l),l=-1,this._value.shift()):us(s,i)&&(a+=this.consumeStringSlice(l),a+=$a(this.consumeEscapedCodePoint()),l=-1))}l++}while(!0)},e.prototype.consumeNumber=function(){var t=[],a=Nn,l=this.peekCodePoint(0);for((l===Fs||l===dl)&&t.push(this.consumeCodePoint());Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0);var s=this.peekCodePoint(1);if(l===Rn&&Xa(s))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=nu;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());l=this.peekCodePoint(0),s=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((l===UA||l===$A)&&((s===Fs||s===dl)&&Xa(i)||Xa(s)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),a=nu;Xa(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[e1(t),a]},e.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),a=t[0],l=t[1],s=this.peekCodePoint(0),i=this.peekCodePoint(1),c=this.peekCodePoint(2);if(io(s,i,c)){var p=this.consumeName();return{type:15,number:a,flags:l,unit:p}}return s===by?(this.consumeCodePoint(),{type:16,number:a,flags:l}):{type:17,number:a,flags:l}},e.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(Ns(t)){for(var a=$a(t);Ns(this.peekCodePoint(0))&&a.length<6;)a+=$a(this.consumeCodePoint());oo(this.peekCodePoint(0))&&this.consumeCodePoint();var l=parseInt(a,16);return l===0||qy(l)||l>1114111?ru:l}return t===Pl?ru:t},e.prototype.consumeName=function(){for(var t="";;){var a=this.consumeCodePoint();if(du(a))t+=$a(a);else if(us(a,this.peekCodePoint(0)))t+=$a(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(a),t}},e}(),DA=function(){function e(t){this._tokens=t}return e.create=function(t){var a=new QA;return a.write(t),new e(a.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var t=this.consumeToken();t.type===31;)t=this.consumeToken();if(t.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var a=this.consumeComponentValue();do t=this.consumeToken();while(t.type===31);if(t.type===32)return a;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var t=[];;){var a=this.consumeComponentValue();if(a.type===32)return t;t.push(a),t.push()}},e.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},e.prototype.consumeSimpleBlock=function(t){for(var a={type:t,values:[]},l=this.consumeToken();;){if(l.type===32||b1(l,t))return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue()),l=this.consumeToken()}},e.prototype.consumeFunction=function(t){for(var a={name:t.value,values:[],type:18};;){var l=this.consumeToken();if(l.type===32||l.type===3)return a;this.reconsumeToken(l),a.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var t=this._tokens.shift();return typeof t>"u"?$r:t},e.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},e}(),Kn=function(e){return e.type===15},cn=function(e){return e.type===17},ia=function(e){return e.type===20},y1=function(e){return e.type===0},Er=function(e,t){return ia(e)&&e.value===t},VA=function(e){return e.type!==31},on=function(e){return e.type!==31&&e.type!==4},zl=function(e){var t=[],a=[];return e.forEach(function(l){if(l.type===4){if(a.length===0)throw new Error("Error parsing function args, zero tokens for arg");t.push(a),a=[];return}l.type!==31&&a.push(l)}),a.length&&t.push(a),t},b1=function(e,t){return t===11&&e.type===12||t===28&&e.type===29?!0:t===2&&e.type===3},ys=function(e){return e.type===17||e.type===15},Da=function(e){return e.type===16||ys(e)},TA=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},Ga={type:17,number:0,flags:Nn},fd={type:16,number:50,flags:Nn},As={type:16,number:100,flags:Nn},Bn=function(e,t,a){var l=e[0],s=e[1];return[_a(l,t),_a(typeof s<"u"?s:l,a)]},_a=function(e,t){if(e.type===16)return e.number/100*t;if(Kn(e))switch(e.unit){case"rem":case"em":return 16*e.number;case"px":default:return e.number}return e.number},MA="deg",LA="grad",RA="rad",OA="turn",mi={name:"angle",parse:function(e,t){if(t.type===15)switch(t.unit){case MA:return Math.PI*t.number/180;case LA:return Math.PI/200*t.number;case RA:return t.number;case OA:return Math.PI*2*t.number}throw new Error("Unsupported angle type")}},PA=function(e){return e.type===15&&(e.unit===MA||e.unit===LA||e.unit===RA||e.unit===OA)},HA=function(e){var t=e.filter(ia).map(function(a){return a.value}).join(" ");switch(t){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Ga,Ga];case"to top":case"bottom":return $l(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Ga,As];case"to right":case"left":return $l(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[As,As];case"to bottom":case"top":return $l(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[As,Ga];case"to left":case"right":return $l(270)}return 0},$l=function(e){return Math.PI*e/180},hs={name:"color",parse:function(e,t){if(t.type===18){var a=w1[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return a(e,t.values)}if(t.type===5){if(t.value.length===3){var l=t.value.substring(0,1),s=t.value.substring(1,2),i=t.value.substring(2,3);return ps(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),1)}if(t.value.length===4){var l=t.value.substring(0,1),s=t.value.substring(1,2),i=t.value.substring(2,3),c=t.value.substring(3,4);return ps(parseInt(l+l,16),parseInt(s+s,16),parseInt(i+i,16),parseInt(c+c,16)/255)}if(t.value.length===6){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6);return ps(parseInt(l,16),parseInt(s,16),parseInt(i,16),1)}if(t.value.length===8){var l=t.value.substring(0,2),s=t.value.substring(2,4),i=t.value.substring(4,6),c=t.value.substring(6,8);return ps(parseInt(l,16),parseInt(s,16),parseInt(i,16),parseInt(c,16)/255)}}if(t.type===20){var p=es[t.value.toUpperCase()];if(typeof p<"u")return p}return es.TRANSPARENT}},_s=function(e){return(255&e)===0},Ra=function(e){var t=255&e,a=255&e>>8,l=255&e>>16,s=255&e>>24;return t<255?"rgba("+s+","+l+","+a+","+t/255+")":"rgb("+s+","+l+","+a+")"},ps=function(e,t,a,l){return(e<<24|t<<16|a<<8|Math.round(l*255)<<0)>>>0},uu=function(e,t){if(e.type===17)return e.number;if(e.type===16){var a=t===3?1:255;return t===3?e.number/100*a:Math.round(e.number/100*a)}return 0},cu=function(e,t){var a=t.filter(on);if(a.length===3){var l=a.map(uu),s=l[0],i=l[1],c=l[2];return ps(s,i,c,1)}if(a.length===4){var p=a.map(uu),s=p[0],i=p[1],c=p[2],f=p[3];return ps(s,i,c,f)}return 0};function Li(e,t,a){return a<0&&(a+=1),a>=1&&(a-=1),a<1/6?(t-e)*a*6+e:a<1/2?t:a<2/3?(t-e)*6*(2/3-a)+e:e}var Au=function(e,t){var a=t.filter(on),l=a[0],s=a[1],i=a[2],c=a[3],p=(l.type===17?$l(l.number):mi.parse(e,l))/(Math.PI*2),f=Da(s)?s.number/100:0,_=Da(i)?i.number/100:0,g=typeof c<"u"&&Da(c)?_a(c,1):1;if(f===0)return ps(_*255,_*255,_*255,1);var y=_<=.5?_*(f+1):_+f-_*f,v=_*2-y,w=Li(v,y,p+1/3),k=Li(v,y,p),b=Li(v,y,p-1/3);return ps(w*255,k*255,b*255,g)},w1={hsl:Au,hsla:Au,rgb:cu,rgba:cu},$n=function(e,t){return hs.parse(e,DA.create(t).parseComponentValue())},es={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},C1={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(ia(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},k1={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},hi=function(e,t){var a=hs.parse(e,t[0]),l=t[1];return l&&Da(l)?{color:a,stop:l}:{color:a,stop:null}},pu=function(e,t){var a=e[0],l=e[e.length-1];a.stop===null&&(a.stop=Ga),l.stop===null&&(l.stop=As);for(var s=[],i=0,c=0;c<e.length;c++){var p=e[c].stop;if(p!==null){var f=_a(p,t);f>i?s.push(f):s.push(i),i=f}else s.push(null)}for(var _=null,c=0;c<s.length;c++){var g=s[c];if(g===null)_===null&&(_=c);else if(_!==null){for(var y=c-_,v=s[_-1],w=(g-v)/(y+1),k=1;k<=y;k++)s[_+k-1]=w*k;_=null}}return e.map(function(b,S){var $=b.color;return{color:$,stop:Math.max(Math.min(1,s[S]/t),0)}})},B1=function(e,t,a){var l=t/2,s=a/2,i=_a(e[0],t)-l,c=s-_a(e[1],a);return(Math.atan2(c,i)+Math.PI*2)%(Math.PI*2)},x1=function(e,t,a){var l=typeof e=="number"?e:B1(e,t,a),s=Math.abs(t*Math.sin(l))+Math.abs(a*Math.cos(l)),i=t/2,c=a/2,p=s/2,f=Math.sin(l-Math.PI/2)*p,_=Math.cos(l-Math.PI/2)*p;return[s,i-_,i+_,c-f,c+f]},Dl=function(e,t){return Math.sqrt(e*e+t*t)},fu=function(e,t,a,l,s){var i=[[0,0],[0,t],[e,0],[e,t]];return i.reduce(function(c,p){var f=p[0],_=p[1],g=Dl(a-f,l-_);return(s?g<c.optimumDistance:g>c.optimumDistance)?{optimumCorner:p,optimumDistance:g}:c},{optimumDistance:s?1/0:-1/0,optimumCorner:null}).optimumCorner},S1=function(e,t,a,l,s){var i=0,c=0;switch(e.size){case 0:e.shape===0?i=c=Math.min(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.min(Math.abs(t),Math.abs(t-l)),c=Math.min(Math.abs(a),Math.abs(a-s)));break;case 2:if(e.shape===0)i=c=Math.min(Dl(t,a),Dl(t,a-s),Dl(t-l,a),Dl(t-l,a-s));else if(e.shape===1){var p=Math.min(Math.abs(a),Math.abs(a-s))/Math.min(Math.abs(t),Math.abs(t-l)),f=fu(l,s,t,a,!0),_=f[0],g=f[1];i=Dl(_-t,(g-a)/p),c=p*i}break;case 1:e.shape===0?i=c=Math.max(Math.abs(t),Math.abs(t-l),Math.abs(a),Math.abs(a-s)):e.shape===1&&(i=Math.max(Math.abs(t),Math.abs(t-l)),c=Math.max(Math.abs(a),Math.abs(a-s)));break;case 3:if(e.shape===0)i=c=Math.max(Dl(t,a),Dl(t,a-s),Dl(t-l,a),Dl(t-l,a-s));else if(e.shape===1){var p=Math.max(Math.abs(a),Math.abs(a-s))/Math.max(Math.abs(t),Math.abs(t-l)),y=fu(l,s,t,a,!1),_=y[0],g=y[1];i=Dl(_-t,(g-a)/p),c=p*i}break}return Array.isArray(e.size)&&(i=_a(e.size[0],l),c=e.size.length===2?_a(e.size[1],s):i),[i,c]},F1=function(e,t){var a=$l(180),l=[];return zl(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&c.value==="to"){a=HA(s);return}else if(PA(c)){a=mi.parse(e,c);return}}var p=hi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},uo=function(e,t){var a=$l(180),l=[];return zl(t).forEach(function(s,i){if(i===0){var c=s[0];if(c.type===20&&["top","left","right","bottom"].indexOf(c.value)!==-1){a=HA(s);return}else if(PA(c)){a=(mi.parse(e,c)+$l(270))%$l(360);return}}var p=hi(e,s);l.push(p)}),{angle:a,stops:l,type:1}},$1=function(e,t){var a=$l(180),l=[],s=1,i=0,c=3,p=[];return zl(t).forEach(function(f,_){var g=f[0];if(_===0){if(ia(g)&&g.value==="linear"){s=1;return}else if(ia(g)&&g.value==="radial"){s=2;return}}if(g.type===18){if(g.name==="from"){var y=hs.parse(e,g.values[0]);l.push({stop:Ga,color:y})}else if(g.name==="to"){var y=hs.parse(e,g.values[0]);l.push({stop:As,color:y})}else if(g.name==="color-stop"){var v=g.values.filter(on);if(v.length===2){var y=hs.parse(e,v[1]),w=v[0];cn(w)&&l.push({stop:{type:16,number:w.number*100,flags:w.flags},color:y})}}}}),s===1?{angle:(a+$l(180))%$l(360),stops:l,type:s}:{size:c,shape:i,stops:l,position:p,type:s}},NA="closest-side",KA="farthest-side",GA="closest-corner",zA="farthest-corner",jA="circle",qA="ellipse",YA="cover",WA="contain",E1=function(e,t){var a=0,l=3,s=[],i=[];return zl(t).forEach(function(c,p){var f=!0;if(p===0){var _=!1;f=c.reduce(function(y,v){if(_)if(ia(v))switch(v.value){case"center":return i.push(fd),y;case"top":case"left":return i.push(Ga),y;case"right":case"bottom":return i.push(As),y}else(Da(v)||ys(v))&&i.push(v);else if(ia(v))switch(v.value){case jA:return a=0,!1;case qA:return a=1,!1;case"at":return _=!0,!1;case NA:return l=0,!1;case YA:case KA:return l=1,!1;case WA:case GA:return l=2,!1;case zA:return l=3,!1}else if(ys(v)||Da(v))return Array.isArray(l)||(l=[]),l.push(v),!1;return y},f)}if(f){var g=hi(e,c);s.push(g)}}),{size:l,shape:a,stops:s,position:i,type:2}},co=function(e,t){var a=0,l=3,s=[],i=[];return zl(t).forEach(function(c,p){var f=!0;if(p===0?f=c.reduce(function(g,y){if(ia(y))switch(y.value){case"center":return i.push(fd),!1;case"top":case"left":return i.push(Ga),!1;case"right":case"bottom":return i.push(As),!1}else if(Da(y)||ys(y))return i.push(y),!1;return g},f):p===1&&(f=c.reduce(function(g,y){if(ia(y))switch(y.value){case jA:return a=0,!1;case qA:return a=1,!1;case WA:case NA:return l=0,!1;case KA:return l=1,!1;case GA:return l=2,!1;case YA:case zA:return l=3,!1}else if(ys(y)||Da(y))return Array.isArray(l)||(l=[]),l.push(y),!1;return g},f)),f){var _=hi(e,c);s.push(_)}}),{size:l,shape:a,stops:s,position:i,type:2}},U1=function(e){return e.type===1},I1=function(e){return e.type===2},md={name:"image",parse:function(e,t){if(t.type===22){var a={url:t.value,type:0};return e.cache.addImage(t.value),a}if(t.type===18){var l=JA[t.name];if(typeof l>"u")throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return l(e,t.values)}throw new Error("Unsupported image type "+t.type)}};function Q1(e){return!(e.type===20&&e.value==="none")&&(e.type!==18||!!JA[e.name])}var JA={"linear-gradient":F1,"-moz-linear-gradient":uo,"-ms-linear-gradient":uo,"-o-linear-gradient":uo,"-webkit-linear-gradient":uo,"radial-gradient":E1,"-moz-radial-gradient":co,"-ms-radial-gradient":co,"-o-radial-gradient":co,"-webkit-radial-gradient":co,"-webkit-gradient":$1},D1={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t.filter(function(l){return on(l)&&Q1(l)}).map(function(l){return md.parse(e,l)})}},V1={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(a){if(ia(a))switch(a.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},T1={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return zl(t).map(function(a){return a.filter(Da)}).map(TA)}},M1={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return zl(t).map(function(a){return a.filter(ia).map(function(l){return l.value}).join(" ")}).map(L1)}},L1=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},tn;(function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"})(tn||(tn={}));var R1={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return zl(t).map(function(a){return a.filter(O1)})}},O1=function(e){return ia(e)||Da(e)},_i=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},P1=_i("top"),H1=_i("right"),N1=_i("bottom"),K1=_i("left"),vi=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(t,a){return TA(a.filter(Da))}}},G1=vi("top-left"),z1=vi("top-right"),j1=vi("bottom-right"),q1=vi("bottom-left"),gi=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,a){switch(a){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Y1=gi("top"),W1=gi("right"),J1=gi("bottom"),X1=gi("left"),yi=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,a){return Kn(a)?a.number:0}}},Z1=yi("top"),eb=yi("right"),tb=yi("bottom"),ab=yi("left"),lb={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},sb={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){switch(t){case"rtl":return 1;case"ltr":default:return 0}}},nb={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).reduce(function(a,l){return a|ob(l.value)},0)}},ob=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},ib={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},rb={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return t.type===20&&t.value==="normal"?0:t.type===17||t.type===15?t.number:0}},Ro;(function(e){e.NORMAL="normal",e.STRICT="strict"})(Ro||(Ro={}));var db={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"strict":return Ro.STRICT;case"normal":default:return Ro.NORMAL}}},ub={name:"line-height",initialValue:"normal",prefix:!1,type:4},mu=function(e,t){return ia(e)&&e.value==="normal"?1.2*t:e.type===17?t*e.number:Da(e)?_a(e,t):t},cb={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return t.type===20&&t.value==="none"?null:md.parse(e,t)}},Ab={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){switch(t){case"inside":return 0;case"outside":default:return 1}}},Ur={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},bi=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},pb=bi("top"),fb=bi("right"),mb=bi("bottom"),hb=bi("left"),_b={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).map(function(a){switch(a.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},vb={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-word":return"break-word";case"normal":default:return"normal"}}},wi=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},gb=wi("top"),yb=wi("right"),bb=wi("bottom"),wb=wi("left"),Cb={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},kb={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Bb={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Er(t[0],"none")?[]:zl(t).map(function(a){for(var l={color:es.TRANSPARENT,offsetX:Ga,offsetY:Ga,blur:Ga},s=0,i=0;i<a.length;i++){var c=a[i];ys(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:l.blur=c,s++):l.color=hs.parse(e,c)}return l})}},xb={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Sb={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(e,t){if(t.type===20&&t.value==="none")return null;if(t.type===18){var a=Eb[t.name];if(typeof a>"u")throw new Error('Attempting to parse an unsupported transform function "'+t.name+'"');return a(t.values)}return null}},Fb=function(e){var t=e.filter(function(a){return a.type===17}).map(function(a){return a.number});return t.length===6?t:null},$b=function(e){var t=e.filter(function(f){return f.type===17}).map(function(f){return f.number}),a=t[0],l=t[1];t[2],t[3];var s=t[4],i=t[5];t[6],t[7],t[8],t[9],t[10],t[11];var c=t[12],p=t[13];return t[14],t[15],t.length===16?[a,l,s,i,c,p]:null},Eb={matrix:Fb,matrix3d:$b},hu={type:16,number:50,flags:Nn},Ub=[hu,hu],Ib={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(e,t){var a=t.filter(Da);return a.length!==2?Ub:[a[0],a[1]]}},Qb={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},En;(function(e){e.NORMAL="normal",e.BREAK_ALL="break-all",e.KEEP_ALL="keep-all"})(En||(En={}));var Db={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"break-all":return En.BREAK_ALL;case"keep-all":return En.KEEP_ALL;case"normal":default:return En.NORMAL}}},Vb={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(e,t){if(t.type===20)return{auto:!0,order:0};if(cn(t))return{auto:!1,order:t.number};throw new Error("Invalid z-index number parsed")}},XA={name:"time",parse:function(e,t){if(t.type===15)switch(t.unit.toLowerCase()){case"s":return 1e3*t.number;case"ms":return t.number}throw new Error("Unsupported time type")}},Tb={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(e,t){return cn(t)?t.number:1}},Mb={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Lb={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(e,t){return t.filter(ia).map(function(a){switch(a.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(a){return a!==0})}},Rb={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(e,t){var a=[],l=[];return t.forEach(function(s){switch(s.type){case 20:case 0:a.push(s.value);break;case 17:a.push(s.number.toString());break;case 4:l.push(a.join(" ")),a.length=0;break}}),a.length&&l.push(a.join(" ")),l.map(function(s){return s.indexOf(" ")===-1?s:"'"+s+"'"})}},Ob={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Pb={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(e,t){if(cn(t))return t.number;if(ia(t))switch(t.value){case"bold":return 700;case"normal":default:return 400}return 400}},Hb={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.filter(ia).map(function(a){return a.value})}},Nb={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){switch(t){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Ma=function(e,t){return(e&t)!==0},Kb={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(t.length===0)return[];var a=t[0];return a.type===20&&a.value==="none"?[]:t}},Gb={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;for(var l=[],s=t.filter(VA),i=0;i<s.length;i++){var c=s[i],p=s[i+1];if(c.type===20){var f=p&&cn(p)?p.number:1;l.push({counter:c.value,increment:f})}}return l}},zb={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return[];for(var a=[],l=t.filter(VA),s=0;s<l.length;s++){var i=l[s],c=l[s+1];if(ia(i)&&i.value!=="none"){var p=c&&cn(c)?c.number:0;a.push({counter:i.value,reset:p})}}return a}},jb={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(e,t){return t.filter(Kn).map(function(a){return XA.parse(e,a)})}},qb={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(e,t){if(t.length===0)return null;var a=t[0];if(a.type===20&&a.value==="none")return null;var l=[],s=t.filter(y1);if(s.length%2!==0)return null;for(var i=0;i<s.length;i+=2){var c=s[i].value,p=s[i+1].value;l.push({open:c,close:p})}return l}},_u=function(e,t,a){if(!e)return"";var l=e[Math.min(t,e.length-1)];return l?a?l.open:l.close:""},Yb={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return t.length===1&&Er(t[0],"none")?[]:zl(t).map(function(a){for(var l={color:255,offsetX:Ga,offsetY:Ga,blur:Ga,spread:Ga,inset:!1},s=0,i=0;i<a.length;i++){var c=a[i];Er(c,"inset")?l.inset=!0:ys(c)?(s===0?l.offsetX=c:s===1?l.offsetY=c:s===2?l.blur=c:l.spread=c,s++):l.color=hs.parse(e,c)}return l})}},Wb={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(e,t){var a=[0,1,2],l=[];return t.filter(ia).forEach(function(s){switch(s.value){case"stroke":l.push(1);break;case"fill":l.push(0);break;case"markers":l.push(2);break}}),a.forEach(function(s){l.indexOf(s)===-1&&l.push(s)}),l}},Jb={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},Xb={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Kn(t)?t.number:0}},Zb=function(){function e(t,a){var l,s;this.animationDuration=ut(t,jb,a.animationDuration),this.backgroundClip=ut(t,C1,a.backgroundClip),this.backgroundColor=ut(t,k1,a.backgroundColor),this.backgroundImage=ut(t,D1,a.backgroundImage),this.backgroundOrigin=ut(t,V1,a.backgroundOrigin),this.backgroundPosition=ut(t,T1,a.backgroundPosition),this.backgroundRepeat=ut(t,M1,a.backgroundRepeat),this.backgroundSize=ut(t,R1,a.backgroundSize),this.borderTopColor=ut(t,P1,a.borderTopColor),this.borderRightColor=ut(t,H1,a.borderRightColor),this.borderBottomColor=ut(t,N1,a.borderBottomColor),this.borderLeftColor=ut(t,K1,a.borderLeftColor),this.borderTopLeftRadius=ut(t,G1,a.borderTopLeftRadius),this.borderTopRightRadius=ut(t,z1,a.borderTopRightRadius),this.borderBottomRightRadius=ut(t,j1,a.borderBottomRightRadius),this.borderBottomLeftRadius=ut(t,q1,a.borderBottomLeftRadius),this.borderTopStyle=ut(t,Y1,a.borderTopStyle),this.borderRightStyle=ut(t,W1,a.borderRightStyle),this.borderBottomStyle=ut(t,J1,a.borderBottomStyle),this.borderLeftStyle=ut(t,X1,a.borderLeftStyle),this.borderTopWidth=ut(t,Z1,a.borderTopWidth),this.borderRightWidth=ut(t,eb,a.borderRightWidth),this.borderBottomWidth=ut(t,tb,a.borderBottomWidth),this.borderLeftWidth=ut(t,ab,a.borderLeftWidth),this.boxShadow=ut(t,Yb,a.boxShadow),this.color=ut(t,lb,a.color),this.direction=ut(t,sb,a.direction),this.display=ut(t,nb,a.display),this.float=ut(t,ib,a.cssFloat),this.fontFamily=ut(t,Rb,a.fontFamily),this.fontSize=ut(t,Ob,a.fontSize),this.fontStyle=ut(t,Nb,a.fontStyle),this.fontVariant=ut(t,Hb,a.fontVariant),this.fontWeight=ut(t,Pb,a.fontWeight),this.letterSpacing=ut(t,rb,a.letterSpacing),this.lineBreak=ut(t,db,a.lineBreak),this.lineHeight=ut(t,ub,a.lineHeight),this.listStyleImage=ut(t,cb,a.listStyleImage),this.listStylePosition=ut(t,Ab,a.listStylePosition),this.listStyleType=ut(t,Ur,a.listStyleType),this.marginTop=ut(t,pb,a.marginTop),this.marginRight=ut(t,fb,a.marginRight),this.marginBottom=ut(t,mb,a.marginBottom),this.marginLeft=ut(t,hb,a.marginLeft),this.opacity=ut(t,Tb,a.opacity);var i=ut(t,_b,a.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=ut(t,vb,a.overflowWrap),this.paddingTop=ut(t,gb,a.paddingTop),this.paddingRight=ut(t,yb,a.paddingRight),this.paddingBottom=ut(t,bb,a.paddingBottom),this.paddingLeft=ut(t,wb,a.paddingLeft),this.paintOrder=ut(t,Wb,a.paintOrder),this.position=ut(t,kb,a.position),this.textAlign=ut(t,Cb,a.textAlign),this.textDecorationColor=ut(t,Mb,(l=a.textDecorationColor)!==null&&l!==void 0?l:a.color),this.textDecorationLine=ut(t,Lb,(s=a.textDecorationLine)!==null&&s!==void 0?s:a.textDecoration),this.textShadow=ut(t,Bb,a.textShadow),this.textTransform=ut(t,xb,a.textTransform),this.transform=ut(t,Sb,a.transform),this.transformOrigin=ut(t,Ib,a.transformOrigin),this.visibility=ut(t,Qb,a.visibility),this.webkitTextStrokeColor=ut(t,Jb,a.webkitTextStrokeColor),this.webkitTextStrokeWidth=ut(t,Xb,a.webkitTextStrokeWidth),this.wordBreak=ut(t,Db,a.wordBreak),this.zIndex=ut(t,Vb,a.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},e.prototype.isTransparent=function(){return _s(this.backgroundColor)},e.prototype.isTransformed=function(){return this.transform!==null},e.prototype.isPositioned=function(){return this.position!==0},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return this.float!==0},e.prototype.isInlineLevel=function(){return Ma(this.display,4)||Ma(this.display,33554432)||Ma(this.display,268435456)||Ma(this.display,536870912)||Ma(this.display,67108864)||Ma(this.display,134217728)},e}(),e0=function(){function e(t,a){this.content=ut(t,Kb,a.content),this.quotes=ut(t,qb,a.quotes)}return e}(),vu=function(){function e(t,a){this.counterIncrement=ut(t,Gb,a.counterIncrement),this.counterReset=ut(t,zb,a.counterReset)}return e}(),ut=function(e,t,a){var l=new QA,s=a!==null&&typeof a<"u"?a.toString():t.initialValue;l.write(s);var i=new DA(l.read());switch(t.type){case 2:var c=i.parseComponentValue();return t.parse(e,ia(c)?c.value:t.initialValue);case 0:return t.parse(e,i.parseComponentValue());case 1:return t.parse(e,i.parseComponentValues());case 4:return i.parseComponentValue();case 3:switch(t.format){case"angle":return mi.parse(e,i.parseComponentValue());case"color":return hs.parse(e,i.parseComponentValue());case"image":return md.parse(e,i.parseComponentValue());case"length":var p=i.parseComponentValue();return ys(p)?p:Ga;case"length-percentage":var f=i.parseComponentValue();return Da(f)?f:Ga;case"time":return XA.parse(e,i.parseComponentValue())}break}},t0="data-html2canvas-debug",a0=function(e){var t=e.getAttribute(t0);switch(t){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},Ir=function(e,t){var a=a0(e);return a===1||t===a},jl=function(){function e(t,a){if(this.context=t,this.textNodes=[],this.elements=[],this.flags=0,Ir(a,3))debugger;this.styles=new Zb(t,window.getComputedStyle(a,null)),Vr(a)&&(this.styles.animationDuration.some(function(l){return l>0})&&(a.style.animationDuration="0s"),this.styles.transform!==null&&(a.style.transform="none")),this.bounds=pi(this.context,a),Ir(a,4)&&(this.flags|=16)}return e}(),l0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",gu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ao=0;Ao<gu.length;Ao++)xn[gu.charCodeAt(Ao)]=Ao;var s0=function(e){var t=e.length*.75,a=e.length,l,s=0,i,c,p,f;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var _=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(t):new Array(t),g=Array.isArray(_)?_:new Uint8Array(_);for(l=0;l<a;l+=4)i=xn[e.charCodeAt(l)],c=xn[e.charCodeAt(l+1)],p=xn[e.charCodeAt(l+2)],f=xn[e.charCodeAt(l+3)],g[s++]=i<<2|c>>4,g[s++]=(c&15)<<4|p>>2,g[s++]=(p&3)<<6|f&63;return _},n0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=2)a.push(e[l+1]<<8|e[l]);return a},o0=function(e){for(var t=e.length,a=[],l=0;l<t;l+=4)a.push(e[l+3]<<24|e[l+2]<<16|e[l+1]<<8|e[l]);return a},Es=5,hd=11,Ri=2,i0=hd-Es,ZA=65536>>Es,r0=1<<Es,Oi=r0-1,d0=1024>>Es,u0=ZA+d0,c0=u0,A0=32,p0=c0+A0,f0=65536>>hd,m0=1<<i0,h0=m0-1,yu=function(e,t,a){return e.slice?e.slice(t,a):new Uint16Array(Array.prototype.slice.call(e,t,a))},_0=function(e,t,a){return e.slice?e.slice(t,a):new Uint32Array(Array.prototype.slice.call(e,t,a))},v0=function(e,t){var a=s0(e),l=Array.isArray(a)?o0(a):new Uint32Array(a),s=Array.isArray(a)?n0(a):new Uint16Array(a),i=24,c=yu(s,i/2,l[4]/2),p=l[5]===2?yu(s,(i+l[4])/2):_0(l,Math.ceil((i+l[4])/4));return new g0(l[0],l[1],l[2],l[3],c,p)},g0=function(){function e(t,a,l,s,i,c){this.initialValue=t,this.errorValue=a,this.highStart=l,this.highValueIndex=s,this.index=i,this.data=c}return e.prototype.get=function(t){var a;if(t>=0){if(t<55296||t>56319&&t<=65535)return a=this.index[t>>Es],a=(a<<Ri)+(t&Oi),this.data[a];if(t<=65535)return a=this.index[ZA+(t-55296>>Es)],a=(a<<Ri)+(t&Oi),this.data[a];if(t<this.highStart)return a=p0-f0+(t>>hd),a=this.index[a],a+=t>>Es&h0,a=this.index[a],a=(a<<Ri)+(t&Oi),this.data[a];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),bu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var po=0;po<bu.length;po++)y0[bu.charCodeAt(po)]=po;var b0=1,Pi=2,Hi=3,wu=4,Cu=5,w0=7,ku=8,Ni=9,Ki=10,Bu=11,xu=12,Su=13,Fu=14,Gi=15,C0=function(e){for(var t=[],a=0,l=e.length;a<l;){var s=e.charCodeAt(a++);if(s>=55296&&s<=56319&&a<l){var i=e.charCodeAt(a++);(i&64512)===56320?t.push(((s&1023)<<10)+(i&1023)+65536):(t.push(s),a--)}else t.push(s)}return t},k0=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(String.fromCodePoint)return String.fromCodePoint.apply(String,e);var a=e.length;if(!a)return"";for(var l=[],s=-1,i="";++s<a;){var c=e[s];c<=65535?l.push(c):(c-=65536,l.push((c>>10)+55296,c%1024+56320)),(s+1===a||l.length>16384)&&(i+=String.fromCharCode.apply(String,l),l.length=0)}return i},B0=v0(l0),Cl="×",zi="÷",x0=function(e){return B0.get(e)},S0=function(e,t,a){var l=a-2,s=t[l],i=t[a-1],c=t[a];if(i===Pi&&c===Hi)return Cl;if(i===Pi||i===Hi||i===wu||c===Pi||c===Hi||c===wu)return zi;if(i===ku&&[ku,Ni,Bu,xu].indexOf(c)!==-1||(i===Bu||i===Ni)&&(c===Ni||c===Ki)||(i===xu||i===Ki)&&c===Ki||c===Su||c===Cu||c===w0||i===b0)return Cl;if(i===Su&&c===Fu){for(;s===Cu;)s=t[--l];if(s===Fu)return Cl}if(i===Gi&&c===Gi){for(var p=0;s===Gi;)p++,s=t[--l];if(p%2===0)return Cl}return zi},F0=function(e){var t=C0(e),a=t.length,l=0,s=0,i=t.map(x0);return{next:function(){if(l>=a)return{done:!0,value:null};for(var c=Cl;l<a&&(c=S0(t,i,++l))===Cl;);if(c!==Cl||l===a){var p=k0.apply(null,t.slice(s,l));return s=l,{value:p,done:!1}}return{done:!0,value:null}}}},$0=function(e){for(var t=F0(e),a=[],l;!(l=t.next()).done;)l.value&&a.push(l.value.slice());return a},E0=function(e){var t=123;if(e.createRange){var a=e.createRange();if(a.getBoundingClientRect){var l=e.createElement("boundtest");l.style.height=t+"px",l.style.display="block",e.body.appendChild(l),a.selectNode(l);var s=a.getBoundingClientRect(),i=Math.round(s.height);if(e.body.removeChild(l),i===t)return!0}}return!1},U0=function(e){var t=e.createElement("boundtest");t.style.width="50px",t.style.display="block",t.style.fontSize="12px",t.style.letterSpacing="0px",t.style.wordSpacing="0px",e.body.appendChild(t);var a=e.createRange();t.innerHTML=typeof"".repeat=="function"?"👨".repeat(10):"";var l=t.firstChild,s=fi(l.data).map(function(f){return $a(f)}),i=0,c={},p=s.every(function(f,_){a.setStart(l,i),a.setEnd(l,i+f.length);var g=a.getBoundingClientRect();i+=f.length;var y=g.x>c.x||g.y>c.y;return c=g,_===0?!0:y});return e.body.removeChild(t),p},I0=function(){return typeof new Image().crossOrigin<"u"},Q0=function(){return typeof new XMLHttpRequest().responseType=="string"},D0=function(e){var t=new Image,a=e.createElement("canvas"),l=a.getContext("2d");if(!l)return!1;t.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{l.drawImage(t,0,0),a.toDataURL()}catch{return!1}return!0},$u=function(e){return e[0]===0&&e[1]===255&&e[2]===0&&e[3]===255},V0=function(e){var t=e.createElement("canvas"),a=100;t.width=a,t.height=a;var l=t.getContext("2d");if(!l)return Promise.reject(!1);l.fillStyle="rgb(0, 255, 0)",l.fillRect(0,0,a,a);var s=new Image,i=t.toDataURL();s.src=i;var c=Qr(a,a,0,0,s);return l.fillStyle="red",l.fillRect(0,0,a,a),Eu(c).then(function(p){l.drawImage(p,0,0);var f=l.getImageData(0,0,a,a).data;l.fillStyle="red",l.fillRect(0,0,a,a);var _=e.createElement("div");return _.style.backgroundImage="url("+i+")",_.style.height=a+"px",$u(f)?Eu(Qr(a,a,0,0,_)):Promise.reject(!1)}).then(function(p){return l.drawImage(p,0,0),$u(l.getImageData(0,0,a,a).data)}).catch(function(){return!1})},Qr=function(e,t,a,l,s){var i="http://www.w3.org/2000/svg",c=document.createElementNS(i,"svg"),p=document.createElementNS(i,"foreignObject");return c.setAttributeNS(null,"width",e.toString()),c.setAttributeNS(null,"height",t.toString()),p.setAttributeNS(null,"width","100%"),p.setAttributeNS(null,"height","100%"),p.setAttributeNS(null,"x",a.toString()),p.setAttributeNS(null,"y",l.toString()),p.setAttributeNS(null,"externalResourcesRequired","true"),c.appendChild(p),p.appendChild(s),c},Eu=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){return t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Na={get SUPPORT_RANGE_BOUNDS(){var e=E0(document);return Object.defineProperty(Na,"SUPPORT_RANGE_BOUNDS",{value:e}),e},get SUPPORT_WORD_BREAKING(){var e=Na.SUPPORT_RANGE_BOUNDS&&U0(document);return Object.defineProperty(Na,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=D0(document);return Object.defineProperty(Na,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e=typeof Array.from=="function"&&typeof window.fetch=="function"?V0(document):Promise.resolve(!1);return Object.defineProperty(Na,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=I0();return Object.defineProperty(Na,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e=Q0();return Object.defineProperty(Na,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Na,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Na,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Un=function(){function e(t,a){this.text=t,this.bounds=a}return e}(),T0=function(e,t,a,l){var s=R0(t,a),i=[],c=0;return s.forEach(function(p){if(a.textDecorationLine.length||p.trim().length>0)if(Na.SUPPORT_RANGE_BOUNDS){var f=Uu(l,c,p.length).getClientRects();if(f.length>1){var _=_d(p),g=0;_.forEach(function(v){i.push(new Un(v,ss.fromDOMRectList(e,Uu(l,g+c,v.length).getClientRects()))),g+=v.length})}else i.push(new Un(p,ss.fromDOMRectList(e,f)))}else{var y=l.splitText(p.length);i.push(new Un(p,M0(e,l))),l=y}else Na.SUPPORT_RANGE_BOUNDS||(l=l.splitText(p.length));c+=p.length}),i},M0=function(e,t){var a=t.ownerDocument;if(a){var l=a.createElement("html2canvaswrapper");l.appendChild(t.cloneNode(!0));var s=t.parentNode;if(s){s.replaceChild(l,t);var i=pi(e,l);return l.firstChild&&s.replaceChild(l.firstChild,l),i}}return ss.EMPTY},Uu=function(e,t,a){var l=e.ownerDocument;if(!l)throw new Error("Node has no owner document");var s=l.createRange();return s.setStart(e,t),s.setEnd(e,t+a),s},_d=function(e){if(Na.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(a){return a.segment})}return $0(e)},L0=function(e,t){if(Na.SUPPORT_NATIVE_TEXT_SEGMENTATION){var a=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(a.segment(e)).map(function(l){return l.segment})}return P0(e,t)},R0=function(e,t){return t.letterSpacing!==0?_d(e):L0(e,t)},O0=[32,160,4961,65792,65793,4153,4241],P0=function(e,t){for(var a=fy(e,{lineBreak:t.lineBreak,wordBreak:t.overflowWrap==="break-word"?"break-word":t.wordBreak}),l=[],s,i=function(){if(s.value){var c=s.value.slice(),p=fi(c),f="";p.forEach(function(_){O0.indexOf(_)===-1?f+=$a(_):(f.length&&l.push(f),l.push($a(_)),f="")}),f.length&&l.push(f)}};!(s=a.next()).done;)i();return l},H0=function(){function e(t,a,l){this.text=N0(a.data,l.textTransform),this.textBounds=T0(t,this.text,l,a)}return e}(),N0=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(K0,G0);case 2:return e.toUpperCase();default:return e}},K0=/(^|\s|:|-|\(|\))([a-z])/g,G0=function(e,t,a){return e.length>0?t+a.toUpperCase():e},ep=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.src=l.currentSrc||l.src,s.intrinsicWidth=l.naturalWidth,s.intrinsicHeight=l.naturalHeight,s.context.cache.addImage(s.src),s}return t}(jl),tp=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l,s.intrinsicWidth=l.width,s.intrinsicHeight=l.height,s}return t}(jl),ap=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=new XMLSerializer,c=pi(a,l);return l.setAttribute("width",c.width+"px"),l.setAttribute("height",c.height+"px"),s.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(l)),s.intrinsicWidth=l.width.baseVal.value,s.intrinsicHeight=l.height.baseVal.value,s.context.cache.addImage(s.svg),s}return t}(jl),lp=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(jl),Dr=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.start=l.start,s.reversed=typeof l.reversed=="boolean"&&l.reversed===!0,s}return t}(jl),z0=[{type:15,flags:0,unit:"px",number:3}],j0=[{type:16,flags:0,number:50}],q0=function(e){return e.width>e.height?new ss(e.left+(e.width-e.height)/2,e.top,e.height,e.height):e.width<e.height?new ss(e.left,e.top+(e.height-e.width)/2,e.width,e.width):e},Y0=function(e){var t=e.type===W0?new Array(e.value.length+1).join("•"):e.value;return t.length===0?e.placeholder||"":t},Oo="checkbox",Po="radio",W0="password",Iu=707406591,vd=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;switch(s.type=l.type.toLowerCase(),s.checked=l.checked,s.value=Y0(l),(s.type===Oo||s.type===Po)&&(s.styles.backgroundColor=3739148031,s.styles.borderTopColor=s.styles.borderRightColor=s.styles.borderBottomColor=s.styles.borderLeftColor=2779096575,s.styles.borderTopWidth=s.styles.borderRightWidth=s.styles.borderBottomWidth=s.styles.borderLeftWidth=1,s.styles.borderTopStyle=s.styles.borderRightStyle=s.styles.borderBottomStyle=s.styles.borderLeftStyle=1,s.styles.backgroundClip=[0],s.styles.backgroundOrigin=[0],s.bounds=q0(s.bounds)),s.type){case Oo:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=z0;break;case Po:s.styles.borderTopRightRadius=s.styles.borderTopLeftRadius=s.styles.borderBottomRightRadius=s.styles.borderBottomLeftRadius=j0;break}return s}return t}(jl),sp=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this,i=l.options[l.selectedIndex||0];return s.value=i&&i.text||"",s}return t}(jl),np=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.value=l.value,s}return t}(jl),op=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;s.src=l.src,s.width=parseInt(l.width,10)||0,s.height=parseInt(l.height,10)||0,s.backgroundColor=s.styles.backgroundColor;try{if(l.contentWindow&&l.contentWindow.document&&l.contentWindow.document.documentElement){s.tree=rp(a,l.contentWindow.document.documentElement);var i=l.contentWindow.document.documentElement?$n(a,getComputedStyle(l.contentWindow.document.documentElement).backgroundColor):es.TRANSPARENT,c=l.contentWindow.document.body?$n(a,getComputedStyle(l.contentWindow.document.body).backgroundColor):es.TRANSPARENT;s.backgroundColor=_s(i)?_s(c)?s.styles.backgroundColor:c:i}}catch{}return s}return t}(jl),J0=["OL","UL","MENU"],$o=function(e,t,a,l){for(var s=t.firstChild,i=void 0;s;s=i)if(i=s.nextSibling,dp(s)&&s.data.trim().length>0)a.textNodes.push(new H0(e,s,a.styles));else if(Xs(s))if(pp(s)&&s.assignedNodes)s.assignedNodes().forEach(function(p){return $o(e,p,a,l)});else{var c=ip(e,s);c.styles.isVisible()&&(X0(s,c,l)?c.flags|=4:Z0(c.styles)&&(c.flags|=2),J0.indexOf(s.tagName)!==-1&&(c.flags|=8),a.elements.push(c),s.slot,s.shadowRoot?$o(e,s.shadowRoot,c,l):!Ho(s)&&!up(s)&&!No(s)&&$o(e,s,c,l))}},ip=function(e,t){return Tr(t)?new ep(e,t):cp(t)?new tp(e,t):up(t)?new ap(e,t):ew(t)?new lp(e,t):tw(t)?new Dr(e,t):aw(t)?new vd(e,t):No(t)?new sp(e,t):Ho(t)?new np(e,t):Ap(t)?new op(e,t):new jl(e,t)},rp=function(e,t){var a=ip(e,t);return a.flags|=4,$o(e,t,a,a),a},X0=function(e,t,a){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||gd(e)&&a.styles.isTransparent()},Z0=function(e){return e.isPositioned()||e.isFloating()},dp=function(e){return e.nodeType===Node.TEXT_NODE},Xs=function(e){return e.nodeType===Node.ELEMENT_NODE},Vr=function(e){return Xs(e)&&typeof e.style<"u"&&!Eo(e)},Eo=function(e){return typeof e.className=="object"},ew=function(e){return e.tagName==="LI"},tw=function(e){return e.tagName==="OL"},aw=function(e){return e.tagName==="INPUT"},lw=function(e){return e.tagName==="HTML"},up=function(e){return e.tagName==="svg"},gd=function(e){return e.tagName==="BODY"},cp=function(e){return e.tagName==="CANVAS"},Qu=function(e){return e.tagName==="VIDEO"},Tr=function(e){return e.tagName==="IMG"},Ap=function(e){return e.tagName==="IFRAME"},Du=function(e){return e.tagName==="STYLE"},sw=function(e){return e.tagName==="SCRIPT"},Ho=function(e){return e.tagName==="TEXTAREA"},No=function(e){return e.tagName==="SELECT"},pp=function(e){return e.tagName==="SLOT"},Vu=function(e){return e.tagName.indexOf("-")>0},nw=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(t){var a=this.counters[t];return a&&a.length?a[a.length-1]:1},e.prototype.getCounterValues=function(t){var a=this.counters[t];return a||[]},e.prototype.pop=function(t){var a=this;t.forEach(function(l){return a.counters[l].pop()})},e.prototype.parse=function(t){var a=this,l=t.counterIncrement,s=t.counterReset,i=!0;l!==null&&l.forEach(function(p){var f=a.counters[p.counter];f&&p.increment!==0&&(i=!1,f.length||f.push(1),f[Math.max(0,f.length-1)]+=p.increment)});var c=[];return i&&s.forEach(function(p){var f=a.counters[p.counter];c.push(p.counter),f||(f=a.counters[p.counter]=[]),f.push(p.reset)}),c},e}(),Tu={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Mu={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},ow={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},iw={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Ks=function(e,t,a,l,s,i){return e<t||e>a?On(e,s,i.length>0):l.integers.reduce(function(c,p,f){for(;e>=p;)e-=p,c+=l.values[f];return c},"")+i},fp=function(e,t,a,l){var s="";do a||e--,s=l(e)+s,e/=t;while(e*t>=t);return s},Fa=function(e,t,a,l,s){var i=a-t+1;return(e<0?"-":"")+(fp(Math.abs(e),i,l,function(c){return $a(Math.floor(c%i)+t)})+s)},Bs=function(e,t,a){a===void 0&&(a=". ");var l=t.length;return fp(Math.abs(e),l,!1,function(s){return t[Math.floor(s%l)]})+a},qs=1,rs=2,ds=4,Sn=8,Wl=function(e,t,a,l,s,i){if(e<-9999||e>9999)return On(e,4,s.length>0);var c=Math.abs(e),p=s;if(c===0)return t[0]+p;for(var f=0;c>0&&f<=4;f++){var _=c%10;_===0&&Ma(i,qs)&&p!==""?p=t[_]+p:_>1||_===1&&f===0||_===1&&f===1&&Ma(i,rs)||_===1&&f===1&&Ma(i,ds)&&e>100||_===1&&f>1&&Ma(i,Sn)?p=t[_]+(f>0?a[f-1]:"")+p:_===1&&f>0&&(p=a[f-1]+p),c=Math.floor(c/10)}return(e<0?l:"")+p},Lu="十百千萬",Ru="拾佰仟萬",Ou="マイナス",ji="마이너스",On=function(e,t,a){var l=a?". ":"",s=a?"、":"",i=a?", ":"",c=a?" ":"";switch(t){case 0:return"•"+c;case 1:return"◦"+c;case 2:return"◾"+c;case 5:var p=Fa(e,48,57,!0,l);return p.length<4?"0"+p:p;case 4:return Bs(e,"〇一二三四五六七八九",s);case 6:return Ks(e,1,3999,Tu,3,l).toLowerCase();case 7:return Ks(e,1,3999,Tu,3,l);case 8:return Fa(e,945,969,!1,l);case 9:return Fa(e,97,122,!1,l);case 10:return Fa(e,65,90,!1,l);case 11:return Fa(e,1632,1641,!0,l);case 12:case 49:return Ks(e,1,9999,Mu,3,l);case 35:return Ks(e,1,9999,Mu,3,l).toLowerCase();case 13:return Fa(e,2534,2543,!0,l);case 14:case 30:return Fa(e,6112,6121,!0,l);case 15:return Bs(e,"子丑寅卯辰巳午未申酉戌亥",s);case 16:return Bs(e,"甲乙丙丁戊己庚辛壬癸",s);case 17:case 48:return Wl(e,"零一二三四五六七八九",Lu,"負",s,rs|ds|Sn);case 47:return Wl(e,"零壹貳參肆伍陸柒捌玖",Ru,"負",s,qs|rs|ds|Sn);case 42:return Wl(e,"零一二三四五六七八九",Lu,"负",s,rs|ds|Sn);case 41:return Wl(e,"零壹贰叁肆伍陆柒捌玖",Ru,"负",s,qs|rs|ds|Sn);case 26:return Wl(e,"〇一二三四五六七八九","十百千万",Ou,s,0);case 25:return Wl(e,"零壱弐参四伍六七八九","拾百千万",Ou,s,qs|rs|ds);case 31:return Wl(e,"영일이삼사오육칠팔구","십백천만",ji,i,qs|rs|ds);case 33:return Wl(e,"零一二三四五六七八九","十百千萬",ji,i,0);case 32:return Wl(e,"零壹貳參四五六七八九","拾百千",ji,i,qs|rs|ds);case 18:return Fa(e,2406,2415,!0,l);case 20:return Ks(e,1,19999,iw,3,l);case 21:return Fa(e,2790,2799,!0,l);case 22:return Fa(e,2662,2671,!0,l);case 22:return Ks(e,1,10999,ow,3,l);case 23:return Bs(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Bs(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Fa(e,3302,3311,!0,l);case 28:return Bs(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",s);case 29:return Bs(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",s);case 34:return Fa(e,3792,3801,!0,l);case 37:return Fa(e,6160,6169,!0,l);case 38:return Fa(e,4160,4169,!0,l);case 39:return Fa(e,2918,2927,!0,l);case 40:return Fa(e,1776,1785,!0,l);case 43:return Fa(e,3046,3055,!0,l);case 44:return Fa(e,3174,3183,!0,l);case 45:return Fa(e,3664,3673,!0,l);case 46:return Fa(e,3872,3881,!0,l);case 3:default:return Fa(e,48,57,!0,l)}},mp="data-html2canvas-ignore",Pu=function(){function e(t,a,l){if(this.context=t,this.options=l,this.scrolledElements=[],this.referenceElement=a,this.counters=new nw,this.quoteDepth=0,!a.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(a.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(t,a){var l=this,s=rw(t,a);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=t.defaultView.pageXOffset,c=t.defaultView.pageYOffset,p=s.contentWindow,f=p.document,_=cw(s).then(function(){return al(l,void 0,void 0,function(){var g,y;return Ja(this,function(v){switch(v.label){case 0:return this.scrolledElements.forEach(mw),p&&(p.scrollTo(a.left,a.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(p.scrollY!==a.top||p.scrollX!==a.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(p.scrollX-a.left,p.scrollY-a.top,0,0))),g=this.options.onclone,y=this.clonedReferenceElement,typeof y>"u"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:f.fonts&&f.fonts.ready?[4,f.fonts.ready]:[3,2];case 1:v.sent(),v.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,uw(f)]:[3,4];case 3:v.sent(),v.label=4;case 4:return typeof g=="function"?[2,Promise.resolve().then(function(){return g(f,y)}).then(function(){return s})]:[2,s]}})})});return f.open(),f.write(pw(document.doctype)+"<html></html>"),fw(this.referenceElement.ownerDocument,i,c),f.replaceChild(f.adoptNode(this.documentElement),f.documentElement),f.close(),_},e.prototype.createElementClone=function(t){if(Ir(t,2))debugger;if(cp(t))return this.createCanvasClone(t);if(Qu(t))return this.createVideoClone(t);if(Du(t))return this.createStyleClone(t);var a=t.cloneNode(!1);return Tr(a)&&(Tr(t)&&t.currentSrc&&t.currentSrc!==t.src&&(a.src=t.currentSrc,a.srcset=""),a.loading==="lazy"&&(a.loading="eager")),Vu(a)?this.createCustomElementClone(a):a},e.prototype.createCustomElementClone=function(t){var a=document.createElement("html2canvascustomelement");return qi(t.style,a),a},e.prototype.createStyleClone=function(t){try{var a=t.sheet;if(a&&a.cssRules){var l=[].slice.call(a.cssRules,0).reduce(function(i,c){return c&&typeof c.cssText=="string"?i+c.cssText:i},""),s=t.cloneNode(!1);return s.textContent=l,s}}catch(i){if(this.context.logger.error("Unable to access cssRules property",i),i.name!=="SecurityError")throw i}return t.cloneNode(!1)},e.prototype.createCanvasClone=function(t){var a;if(this.options.inlineImages&&t.ownerDocument){var l=t.ownerDocument.createElement("img");try{return l.src=t.toDataURL(),l}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",t)}}var s=t.cloneNode(!1);try{s.width=t.width,s.height=t.height;var i=t.getContext("2d"),c=s.getContext("2d");if(c)if(!this.options.allowTaint&&i)c.putImageData(i.getImageData(0,0,t.width,t.height),0,0);else{var p=(a=t.getContext("webgl2"))!==null&&a!==void 0?a:t.getContext("webgl");if(p){var f=p.getContextAttributes();(f==null?void 0:f.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",t)}c.drawImage(t,0,0)}return s}catch{this.context.logger.info("Unable to clone canvas as it is tainted",t)}return s},e.prototype.createVideoClone=function(t){var a=t.ownerDocument.createElement("canvas");a.width=t.offsetWidth,a.height=t.offsetHeight;var l=a.getContext("2d");try{return l&&(l.drawImage(t,0,0,a.width,a.height),this.options.allowTaint||l.getImageData(0,0,a.width,a.height)),a}catch{this.context.logger.info("Unable to clone video as it is tainted",t)}var s=t.ownerDocument.createElement("canvas");return s.width=t.offsetWidth,s.height=t.offsetHeight,s},e.prototype.appendChildNode=function(t,a,l){(!Xs(a)||!sw(a)&&!a.hasAttribute(mp)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(a)))&&(!this.options.copyStyles||!Xs(a)||!Du(a))&&t.appendChild(this.cloneNode(a,l))},e.prototype.cloneChildNodes=function(t,a,l){for(var s=this,i=t.shadowRoot?t.shadowRoot.firstChild:t.firstChild;i;i=i.nextSibling)if(Xs(i)&&pp(i)&&typeof i.assignedNodes=="function"){var c=i.assignedNodes();c.length&&c.forEach(function(p){return s.appendChildNode(a,p,l)})}else this.appendChildNode(a,i,l)},e.prototype.cloneNode=function(t,a){if(dp(t))return document.createTextNode(t.data);if(!t.ownerDocument)return t.cloneNode(!1);var l=t.ownerDocument.defaultView;if(l&&Xs(t)&&(Vr(t)||Eo(t))){var s=this.createElementClone(t);s.style.transitionProperty="none";var i=l.getComputedStyle(t),c=l.getComputedStyle(t,":before"),p=l.getComputedStyle(t,":after");this.referenceElement===t&&Vr(s)&&(this.clonedReferenceElement=s),gd(s)&&vw(s);var f=this.counters.parse(new vu(this.context,i)),_=this.resolvePseudoContent(t,s,c,In.BEFORE);Vu(t)&&(a=!0),Qu(t)||this.cloneChildNodes(t,s,a),_&&s.insertBefore(_,s.firstChild);var g=this.resolvePseudoContent(t,s,p,In.AFTER);return g&&s.appendChild(g),this.counters.pop(f),(i&&(this.options.copyStyles||Eo(t))&&!Ap(t)||a)&&qi(i,s),(t.scrollTop!==0||t.scrollLeft!==0)&&this.scrolledElements.push([s,t.scrollLeft,t.scrollTop]),(Ho(t)||No(t))&&(Ho(s)||No(s))&&(s.value=t.value),s}return t.cloneNode(!1)},e.prototype.resolvePseudoContent=function(t,a,l,s){var i=this;if(l){var c=l.content,p=a.ownerDocument;if(!(!p||!c||c==="none"||c==="-moz-alt-content"||l.display==="none")){this.counters.parse(new vu(this.context,l));var f=new e0(this.context,l),_=p.createElement("html2canvaspseudoelement");qi(l,_),f.content.forEach(function(y){if(y.type===0)_.appendChild(p.createTextNode(y.value));else if(y.type===22){var v=p.createElement("img");v.src=y.value,v.style.opacity="1",_.appendChild(v)}else if(y.type===18){if(y.name==="attr"){var w=y.values.filter(ia);w.length&&_.appendChild(p.createTextNode(t.getAttribute(w[0].value)||""))}else if(y.name==="counter"){var k=y.values.filter(on),b=k[0],S=k[1];if(b&&ia(b)){var $=i.counters.getCounterValue(b.value),D=S&&ia(S)?Ur.parse(i.context,S.value):3;_.appendChild(p.createTextNode(On($,D,!1)))}}else if(y.name==="counters"){var F=y.values.filter(on),b=F[0],B=F[1],S=F[2];if(b&&ia(b)){var U=i.counters.getCounterValues(b.value),Q=S&&ia(S)?Ur.parse(i.context,S.value):3,V=B&&B.type===0?B.value:"",I=U.map(function(L){return On(L,Q,!1)}).join(V);_.appendChild(p.createTextNode(I))}}}else if(y.type===20)switch(y.value){case"open-quote":_.appendChild(p.createTextNode(_u(f.quotes,i.quoteDepth++,!0)));break;case"close-quote":_.appendChild(p.createTextNode(_u(f.quotes,--i.quoteDepth,!1)));break;default:_.appendChild(p.createTextNode(y.value))}}),_.className=Mr+" "+Lr;var g=s===In.BEFORE?" "+Mr:" "+Lr;return Eo(a)?a.className.baseValue+=g:a.className+=g,_}}},e.destroy=function(t){return t.parentNode?(t.parentNode.removeChild(t),!0):!1},e}(),In;(function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"})(In||(In={}));var rw=function(e,t){var a=e.createElement("iframe");return a.className="html2canvas-container",a.style.visibility="hidden",a.style.position="fixed",a.style.left="-10000px",a.style.top="0px",a.style.border="0",a.width=t.width.toString(),a.height=t.height.toString(),a.scrolling="no",a.setAttribute(mp,"true"),e.body.appendChild(a),a},dw=function(e){return new Promise(function(t){if(e.complete){t();return}if(!e.src){t();return}e.onload=t,e.onerror=t})},uw=function(e){return Promise.all([].slice.call(e.images,0).map(dw))},cw=function(e){return new Promise(function(t,a){var l=e.contentWindow;if(!l)return a("No window assigned for iframe");var s=l.document;l.onload=e.onload=function(){l.onload=e.onload=null;var i=setInterval(function(){s.body.childNodes.length>0&&s.readyState==="complete"&&(clearInterval(i),t(e))},50)}})},Aw=["all","d","content"],qi=function(e,t){for(var a=e.length-1;a>=0;a--){var l=e.item(a);Aw.indexOf(l)===-1&&t.style.setProperty(l,e.getPropertyValue(l))}return t},pw=function(e){var t="";return e&&(t+="<!DOCTYPE ",e.name&&(t+=e.name),e.internalSubset&&(t+=e.internalSubset),e.publicId&&(t+='"'+e.publicId+'"'),e.systemId&&(t+='"'+e.systemId+'"'),t+=">"),t},fw=function(e,t,a){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||a!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,a)},mw=function(e){var t=e[0],a=e[1],l=e[2];t.scrollLeft=a,t.scrollTop=l},hw=":before",_w=":after",Mr="___html2canvas___pseudoelement_before",Lr="___html2canvas___pseudoelement_after",Hu=`{ | |
| 19 | 19 | content: "" !important; |
| 20 | 20 | display: none !important; |
| 21 | -}`,T0=function(e){M0(e,"."+kr+D0+Su+` | |
| 22 | - .`+xr+V0+Su)},M0=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},NA=function(){function e(){}return e.getOrigin=function(t){var a=e._link;return a?(a.href=t,a.href=a.href,a.protocol+a.hostname+a.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),L0=function(){function e(t,a){this.context=t,this._options=a,this._cache={}}return e.prototype.addImage=function(t){var a=Promise.resolve();return this.has(t)||(Hi(t)||P0(t))&&(this._cache[t]=this.loadImage(t)).catch(function(){}),a},e.prototype.match=function(t){return this._cache[t]},e.prototype.loadImage=function(t){return el(this,void 0,void 0,function(){var a,l,s,i,c=this;return Ya(this,function(p){switch(p.label){case 0:return a=NA.isSameOrigin(t),l=!Oi(t)&&this._options.useCORS===!0&&Ga.SUPPORT_CORS_IMAGES&&!a,s=!Oi(t)&&!a&&!Hi(t)&&typeof this._options.proxy=="string"&&Ga.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!Oi(t)&&!Hi(t)&&!s&&!l?[2]:(i=t,s?[4,this.proxy(i)]:[3,2]);case 1:i=p.sent(),p.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(m,_){var g=new Image;g.onload=function(){return m(g)},g.onerror=_,(N0(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return m(g)},500),c._options.imageTimeout>0&&setTimeout(function(){return _("Timed out ("+c._options.imageTimeout+"ms) loading image")},c._options.imageTimeout)})];case 3:return[2,p.sent()]}})})},e.prototype.has=function(t){return typeof this._cache[t]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(t){var a=this,l=this._options.proxy;if(!l)throw new Error("No proxy defined");var s=t.substring(0,256);return new Promise(function(i,c){var p=Ga.SUPPORT_RESPONSE_TYPE?"blob":"text",m=new XMLHttpRequest;m.onload=function(){if(m.status===200)if(p==="text")i(m.response);else{var y=new FileReader;y.addEventListener("load",function(){return i(y.result)},!1),y.addEventListener("error",function(v){return c(v)},!1),y.readAsDataURL(m.response)}else c("Failed to proxy resource "+s+" with status code "+m.status)},m.onerror=c;var _=l.indexOf("?")>-1?"&":"?";if(m.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&m instanceof XMLHttpRequest&&(m.responseType=p),a._options.imageTimeout){var g=a._options.imageTimeout;m.timeout=g,m.ontimeout=function(){return c("Timed out ("+g+"ms) proxying "+s)}}m.send()})},e}(),R0=/^data:image\/svg\+xml/i,O0=/^data:image\/.*;base64,/i,H0=/^data:image\/.*/i,P0=function(e){return Ga.SUPPORT_SVG_DRAWING||!K0(e)},Oi=function(e){return H0.test(e)},N0=function(e){return O0.test(e)},Hi=function(e){return e.substr(0,4)==="blob"},K0=function(e){return e.substr(-3).toLowerCase()==="svg"||R0.test(e)},it=function(){function e(t,a){this.type=0,this.x=t,this.y=a}return e.prototype.add=function(t,a){return new e(this.x+t,this.y+a)},e}(),Ls=function(e,t,a){return new it(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},oo=function(){function e(t,a,l,s){this.type=1,this.start=t,this.startControl=a,this.endControl=l,this.end=s}return e.prototype.subdivide=function(t,a){var l=Ls(this.start,this.startControl,t),s=Ls(this.startControl,this.endControl,t),i=Ls(this.endControl,this.end,t),c=Ls(l,s,t),p=Ls(s,i,t),m=Ls(c,p,t);return a?new e(this.start,l,c,m):new e(m,p,i,this.end)},e.prototype.add=function(t,a){return new e(this.start.add(t,a),this.startControl.add(t,a),this.endControl.add(t,a),this.end.add(t,a))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),wl=function(e){return e.type===1},G0=function(){function e(t){var a=t.styles,l=t.bounds,s=hn(a.borderTopLeftRadius,l.width,l.height),i=s[0],c=s[1],p=hn(a.borderTopRightRadius,l.width,l.height),m=p[0],_=p[1],g=hn(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],C=hn(a.borderBottomLeftRadius,l.width,l.height),b=C[0],w=C[1],x=[];x.push((i+m)/l.width),x.push((b+y)/l.width),x.push((c+w)/l.height),x.push((_+v)/l.height);var F=Math.max.apply(Math,x);F>1&&(i/=F,c/=F,m/=F,_/=F,y/=F,v/=F,b/=F,w/=F);var L=l.width-m,U=l.height-v,S=l.width-y,M=l.height-w,I=a.borderTopWidth,T=a.borderRightWidth,Q=a.borderBottomWidth,E=a.borderLeftWidth,D=ma(a.paddingTop,t.bounds.width),H=ma(a.paddingRight,t.bounds.width),P=ma(a.paddingBottom,t.bounds.width),G=ma(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||c>0?ya(l.left+E/3,l.top+I/3,i-E/3,c-I/3,Wt.TOP_LEFT):new it(l.left+E/3,l.top+I/3),this.topRightBorderDoubleOuterBox=i>0||c>0?ya(l.left+L,l.top+I/3,m-T/3,_-I/3,Wt.TOP_RIGHT):new it(l.left+l.width-T/3,l.top+I/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?ya(l.left+S,l.top+U,y-T/3,v-Q/3,Wt.BOTTOM_RIGHT):new it(l.left+l.width-T/3,l.top+l.height-Q/3),this.bottomLeftBorderDoubleOuterBox=b>0||w>0?ya(l.left+E/3,l.top+M,b-E/3,w-Q/3,Wt.BOTTOM_LEFT):new it(l.left+E/3,l.top+l.height-Q/3),this.topLeftBorderDoubleInnerBox=i>0||c>0?ya(l.left+E*2/3,l.top+I*2/3,i-E*2/3,c-I*2/3,Wt.TOP_LEFT):new it(l.left+E*2/3,l.top+I*2/3),this.topRightBorderDoubleInnerBox=i>0||c>0?ya(l.left+L,l.top+I*2/3,m-T*2/3,_-I*2/3,Wt.TOP_RIGHT):new it(l.left+l.width-T*2/3,l.top+I*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?ya(l.left+S,l.top+U,y-T*2/3,v-Q*2/3,Wt.BOTTOM_RIGHT):new it(l.left+l.width-T*2/3,l.top+l.height-Q*2/3),this.bottomLeftBorderDoubleInnerBox=b>0||w>0?ya(l.left+E*2/3,l.top+M,b-E*2/3,w-Q*2/3,Wt.BOTTOM_LEFT):new it(l.left+E*2/3,l.top+l.height-Q*2/3),this.topLeftBorderStroke=i>0||c>0?ya(l.left+E/2,l.top+I/2,i-E/2,c-I/2,Wt.TOP_LEFT):new it(l.left+E/2,l.top+I/2),this.topRightBorderStroke=i>0||c>0?ya(l.left+L,l.top+I/2,m-T/2,_-I/2,Wt.TOP_RIGHT):new it(l.left+l.width-T/2,l.top+I/2),this.bottomRightBorderStroke=y>0||v>0?ya(l.left+S,l.top+U,y-T/2,v-Q/2,Wt.BOTTOM_RIGHT):new it(l.left+l.width-T/2,l.top+l.height-Q/2),this.bottomLeftBorderStroke=b>0||w>0?ya(l.left+E/2,l.top+M,b-E/2,w-Q/2,Wt.BOTTOM_LEFT):new it(l.left+E/2,l.top+l.height-Q/2),this.topLeftBorderBox=i>0||c>0?ya(l.left,l.top,i,c,Wt.TOP_LEFT):new it(l.left,l.top),this.topRightBorderBox=m>0||_>0?ya(l.left+L,l.top,m,_,Wt.TOP_RIGHT):new it(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?ya(l.left+S,l.top+U,y,v,Wt.BOTTOM_RIGHT):new it(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=b>0||w>0?ya(l.left,l.top+M,b,w,Wt.BOTTOM_LEFT):new it(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||c>0?ya(l.left+E,l.top+I,Math.max(0,i-E),Math.max(0,c-I),Wt.TOP_LEFT):new it(l.left+E,l.top+I),this.topRightPaddingBox=m>0||_>0?ya(l.left+Math.min(L,l.width-T),l.top+I,L>l.width+T?0:Math.max(0,m-T),Math.max(0,_-I),Wt.TOP_RIGHT):new it(l.left+l.width-T,l.top+I),this.bottomRightPaddingBox=y>0||v>0?ya(l.left+Math.min(S,l.width-E),l.top+Math.min(U,l.height-Q),Math.max(0,y-T),Math.max(0,v-Q),Wt.BOTTOM_RIGHT):new it(l.left+l.width-T,l.top+l.height-Q),this.bottomLeftPaddingBox=b>0||w>0?ya(l.left+E,l.top+Math.min(M,l.height-Q),Math.max(0,b-E),Math.max(0,w-Q),Wt.BOTTOM_LEFT):new it(l.left+E,l.top+l.height-Q),this.topLeftContentBox=i>0||c>0?ya(l.left+E+G,l.top+I+D,Math.max(0,i-(E+G)),Math.max(0,c-(I+D)),Wt.TOP_LEFT):new it(l.left+E+G,l.top+I+D),this.topRightContentBox=m>0||_>0?ya(l.left+Math.min(L,l.width+E+G),l.top+I+D,L>l.width+E+G?0:m-E+G,_-(I+D),Wt.TOP_RIGHT):new it(l.left+l.width-(T+H),l.top+I+D),this.bottomRightContentBox=y>0||v>0?ya(l.left+Math.min(S,l.width-(E+G)),l.top+Math.min(U,l.height+I+D),Math.max(0,y-(T+H)),v-(Q+P),Wt.BOTTOM_RIGHT):new it(l.left+l.width-(T+H),l.top+l.height-(Q+P)),this.bottomLeftContentBox=b>0||w>0?ya(l.left+E+G,l.top+M,Math.max(0,b-(E+G)),w-(Q+P),Wt.BOTTOM_LEFT):new it(l.left+E+G,l.top+l.height-(Q+P))}return e}(),Wt;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Wt||(Wt={}));var ya=function(e,t,a,l,s){var i=4*((Math.sqrt(2)-1)/3),c=a*i,p=l*i,m=e+a,_=t+l;switch(s){case Wt.TOP_LEFT:return new oo(new it(e,_),new it(e,_-p),new it(m-c,t),new it(m,t));case Wt.TOP_RIGHT:return new oo(new it(e,t),new it(e+c,t),new it(m,_-p),new it(m,_));case Wt.BOTTOM_RIGHT:return new oo(new it(m,t),new it(m,t+p),new it(e+c,_),new it(e,_));case Wt.BOTTOM_LEFT:default:return new oo(new it(m,_),new it(m-c,_),new it(e,t+p),new it(e,t))}},Vo=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},j0=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},To=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},z0=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),io=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),q0=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),Y0=function(e){return e.type===0},KA=function(e){return e.type===1},W0=function(e){return e.type===2},Fu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},X0=function(e,t,a,l,s){return e.map(function(i,c){switch(c){case 0:return i.add(t,a);case 1:return i.add(t+l,a);case 2:return i.add(t+l,a+s);case 3:return i.add(t,a+s)}return i})},GA=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),jA=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new G0(this.container),this.container.styles.opacity<1&&this.effects.push(new q0(this.container.styles.opacity)),this.container.styles.transform!==null){var l=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new z0(l,s,i))}if(this.container.styles.overflowX!==0){var c=Vo(this.curves),p=To(this.curves);Fu(c,p)?this.effects.push(new io(c,6)):(this.effects.push(new io(c,2)),this.effects.push(new io(p,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,l=this.parent,s=this.effects.slice(0);l;){var i=l.effects.filter(function(m){return!KA(m)});if(a||l.container.styles.position!==0||!l.parent){if(s.unshift.apply(s,i),a=[2,3].indexOf(l.container.styles.position)===-1,l.container.styles.overflowX!==0){var c=Vo(l.curves),p=To(l.curves);Fu(c,p)||s.unshift(new io(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(m){return Ta(m.target,t)})},e}(),Sr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=Ta(s.flags,4),c=Ta(s.flags,2),p=new jA(s,e);Ta(s.styles.display,2048)&&l.push(p);var m=Ta(s.flags,8)?[]:l;if(i||c){var _=i||s.styles.isPositioned()?a:t,g=new GA(p);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var y=s.styles.zIndex.order;if(y<0){var v=0;_.negativeZIndex.some(function(b,w){return y>b.element.container.styles.zIndex.order?(v=w,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var C=0;_.positiveZIndex.some(function(b,w){return y>=b.element.container.styles.zIndex.order?(C=w+1,!1):C>0}),_.positiveZIndex.splice(C,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);Sr(p,g,i?g:a,m)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),Sr(p,t,a,m);Ta(s.flags,8)&&zA(s,m)})},zA=function(e,t){for(var a=e instanceof wr?e.start:1,l=e instanceof wr?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof EA&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=In(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},J0=function(e){var t=new jA(e,null),a=new GA(t),l=[];return Sr(t,a,a,l),zA(t.container,l),a},$u=function(e,t){switch(t){case 0:return kl(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return kl(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return kl(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return kl(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Z0=function(e,t){switch(t){case 0:return kl(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return kl(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return kl(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return kl(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},ew=function(e,t){switch(t){case 0:return kl(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return kl(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return kl(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return kl(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},tw=function(e,t){switch(t){case 0:return ro(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return ro(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return ro(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return ro(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},ro=function(e,t){var a=[];return wl(e)?a.push(e.subdivide(.5,!1)):a.push(e),wl(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},kl=function(e,t,a,l){var s=[];return wl(e)?s.push(e.subdivide(.5,!1)):s.push(e),wl(a)?s.push(a.subdivide(.5,!0)):s.push(a),wl(l)?s.push(l.subdivide(.5,!0).reverse()):s.push(l),wl(t)?s.push(t.subdivide(.5,!1).reverse()):s.push(t),s},qA=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},Mo=function(e){var t=e.styles,a=e.bounds,l=ma(t.paddingLeft,a.width),s=ma(t.paddingRight,a.width),i=ma(t.paddingTop,a.width),c=ma(t.paddingBottom,a.width);return a.add(l+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+l+s),-(t.borderTopWidth+t.borderBottomWidth+i+c))},aw=function(e,t){return e===0?t.bounds:e===2?Mo(t):qA(t)},lw=function(e,t){return e===0?t.bounds:e===2?Mo(t):qA(t)},Pi=function(e,t,a){var l=aw(Ps(e.styles.backgroundOrigin,t),e),s=lw(Ps(e.styles.backgroundClip,t),e),i=sw(Ps(e.styles.backgroundSize,t),a,l),c=i[0],p=i[1],m=hn(Ps(e.styles.backgroundPosition,t),l.width-c,l.height-p),_=nw(Ps(e.styles.backgroundRepeat,t),m,i,l,s),g=Math.round(l.left+m[0]),y=Math.round(l.top+m[1]);return[_,g,y,c,p]},Rs=function(e){return sa(e)&&e.value===Ys.AUTO},uo=function(e){return typeof e=="number"},sw=function(e,t,a){var l=t[0],s=t[1],i=t[2],c=e[0],p=e[1];if(!c)return[0,0];if(Da(c)&&p&&Da(p))return[ma(c,a.width),ma(p,a.height)];var m=uo(i);if(sa(c)&&(c.value===Ys.CONTAIN||c.value===Ys.COVER)){if(uo(i)){var _=a.width/a.height;return _<i!=(c.value===Ys.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var g=uo(l),y=uo(s),v=g||y;if(Rs(c)&&(!p||Rs(p))){if(g&&y)return[l,s];if(!m&&!v)return[a.width,a.height];if(v&&m){var C=g?l:s*i,b=y?s:l/i;return[C,b]}var w=g?l:a.width,x=y?s:a.height;return[w,x]}if(m){var F=0,L=0;return Da(c)?F=ma(c,a.width):Da(p)&&(L=ma(p,a.height)),Rs(c)?F=L*i:(!p||Rs(p))&&(L=F/i),[F,L]}var U=null,S=null;if(Da(c)?U=ma(c,a.width):p&&Da(p)&&(S=ma(p,a.height)),U!==null&&(!p||Rs(p))&&(S=g&&y?U/l*s:a.height),S!==null&&Rs(c)&&(U=g&&y?S/s*l:a.width),U!==null&&S!==null)return[U,S];throw new Error("Unable to calculate background-size for element")},Ps=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},nw=function(e,t,a,l,s){var i=t[0],c=t[1],p=a[0],m=a[1];switch(e){case 2:return[new it(Math.round(l.left),Math.round(l.top+c)),new it(Math.round(l.left+l.width),Math.round(l.top+c)),new it(Math.round(l.left+l.width),Math.round(m+l.top+c)),new it(Math.round(l.left),Math.round(m+l.top+c))];case 3:return[new it(Math.round(l.left+i),Math.round(l.top)),new it(Math.round(l.left+i+p),Math.round(l.top)),new it(Math.round(l.left+i+p),Math.round(l.height+l.top)),new it(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new it(Math.round(l.left+i),Math.round(l.top+c)),new it(Math.round(l.left+i+p),Math.round(l.top+c)),new it(Math.round(l.left+i+p),Math.round(l.top+c+m)),new it(Math.round(l.left+i),Math.round(l.top+c+m))];default:return[new it(Math.round(s.left),Math.round(s.top)),new it(Math.round(s.left+s.width),Math.round(s.top)),new it(Math.round(s.left+s.width),Math.round(s.height+s.top)),new it(Math.round(s.left),Math.round(s.height+s.top))]}},ow="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Eu="Hidden Text",iw=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var l=this._document.createElement("div"),s=this._document.createElement("img"),i=this._document.createElement("span"),c=this._document.body;l.style.visibility="hidden",l.style.fontFamily=t,l.style.fontSize=a,l.style.margin="0",l.style.padding="0",l.style.whiteSpace="nowrap",c.appendChild(l),s.src=ow,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=a,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(Eu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Eu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var m=s.offsetTop-l.offsetTop+2;return c.removeChild(l),{baseline:p,middle:m}},e.prototype.getMetrics=function(t,a){var l=t+" "+a;return typeof this._data[l]>"u"&&(this._data[l]=this.parseMetrics(t,a)),this._data[l]},e}(),YA=function(){function e(t,a){this.context=t,this.options=a}return e}(),rw=1e4,dw=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s._activeEffects=[],s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),l.canvas||(s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px"),s.fontMetrics=new iw(document),s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.ctx.textBaseline="bottom",s._activeEffects=[],s.context.logger.debug("Canvas renderer initialized ("+l.width+"x"+l.height+") with scale "+l.scale),s}return t.prototype.applyEffects=function(a){for(var l=this;this._activeEffects.length;)this.popEffect();a.forEach(function(s){return l.applyEffect(s)})},t.prototype.applyEffect=function(a){this.ctx.save(),W0(a)&&(this.ctx.globalAlpha=a.opacity),Y0(a)&&(this.ctx.translate(a.offsetX,a.offsetY),this.ctx.transform(a.matrix[0],a.matrix[1],a.matrix[2],a.matrix[3],a.matrix[4],a.matrix[5]),this.ctx.translate(-a.offsetX,-a.offsetY)),KA(a)&&(this.path(a.path),this.ctx.clip()),this._activeEffects.push(a)},t.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},t.prototype.renderStack=function(a){return el(this,void 0,void 0,function(){var l;return Ya(this,function(s){switch(s.label){case 0:return l=a.element.container.styles,l.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return el(this,void 0,void 0,function(){return Ya(this,function(l){switch(l.label){case 0:if(Ta(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return l.sent(),[4,this.renderNodeContent(a)];case 2:l.sent(),l.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(a,l,s){var i=this;if(l===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+s);else{var c=od(a.text);c.reduce(function(p,m){return i.ctx.fillText(m,p,a.bounds.top+s),p+i.ctx.measureText(m).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(c){return c==="normal"||c==="small-caps"}).join(""),s=fw(a.fontFamily).join(", "),i=Mn(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,l,a.fontWeight,i,s].join(" "),s,i]},t.prototype.renderTextNode=function(a,l){return el(this,void 0,void 0,function(){var s,i,c,p,m,_,g,y,v=this;return Ya(this,function(C){return s=this.createFontStyle(l),i=s[0],c=s[1],p=s[2],this.ctx.font=i,this.ctx.direction=l.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",m=this.fontMetrics.getMetrics(c,p),_=m.baseline,g=m.middle,y=l.paintOrder,a.textBounds.forEach(function(b){y.forEach(function(w){switch(w){case 0:v.ctx.fillStyle=Oa(l.color),v.renderTextWithLetterSpacing(b,l.letterSpacing,_);var x=l.textShadow;x.length&&b.text.trim().length&&(x.slice(0).reverse().forEach(function(F){v.ctx.shadowColor=Oa(F.color),v.ctx.shadowOffsetX=F.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=F.offsetY.number*v.options.scale,v.ctx.shadowBlur=F.blur.number,v.renderTextWithLetterSpacing(b,l.letterSpacing,_)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),l.textDecorationLine.length&&(v.ctx.fillStyle=Oa(l.textDecorationColor||l.color),l.textDecorationLine.forEach(function(F){switch(F){case 1:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top+_),b.bounds.width,1);break;case 2:v.ctx.fillRect(b.bounds.left,Math.round(b.bounds.top),b.bounds.width,1);break;case 3:v.ctx.fillRect(b.bounds.left,Math.ceil(b.bounds.top+g),b.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&b.text.trim().length&&(v.ctx.strokeStyle=Oa(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(b.text,b.bounds.left,b.bounds.top+_)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,l,s){if(s&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var i=Mo(a),c=To(l);this.path(c),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(s,0,0,a.intrinsicWidth,a.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return el(this,void 0,void 0,function(){var l,s,i,c,p,m,L,L,_,g,y,v,S,C,b,M,w,x,F,L,U,S,M;return Ya(this,function(I){switch(I.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,s=a.curves,i=l.styles,c=0,p=l.textNodes,I.label=1;case 1:return c<p.length?(m=p[c],[4,this.renderTextNode(m,i)]):[3,4];case 2:I.sent(),I.label=3;case 3:return c++,[3,1];case 4:if(!(l instanceof SA))return[3,8];I.label=5;case 5:return I.trys.push([5,7,,8]),[4,this.context.cache.match(l.src)];case 6:return L=I.sent(),this.renderReplacedElement(l,s,L),[3,8];case 7:return I.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof FA&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof $A))return[3,12];I.label=9;case 9:return I.trys.push([9,11,,12]),[4,this.context.cache.match(l.svg)];case 10:return L=I.sent(),this.renderReplacedElement(l,s,L),[3,12];case 11:return I.sent(),this.context.logger.error("Error loading svg "+l.svg.substring(0,255)),[3,12];case 12:return l instanceof QA&&l.tree?(_=new t(this.context,{scale:this.options.scale,backgroundColor:l.backgroundColor,x:0,y:0,width:l.width,height:l.height}),[4,_.render(l.tree)]):[3,14];case 13:g=I.sent(),l.width&&l.height&&this.ctx.drawImage(g,0,0,l.width,l.height,l.bounds.left,l.bounds.top,l.bounds.width,l.bounds.height),I.label=14;case 14:if(l instanceof id&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===Uo?l.checked&&(this.ctx.save(),this.path([new it(l.bounds.left+y*.39363,l.bounds.top+y*.79),new it(l.bounds.left+y*.16,l.bounds.top+y*.5549),new it(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new it(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new it(l.bounds.left+y*.72983,l.bounds.top+y*.23),new it(l.bounds.left+y*.84,l.bounds.top+y*.34085),new it(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Oa(_u),this.ctx.fill(),this.ctx.restore()):l.type===Io&&l.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(l.bounds.left+y/2,l.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=Oa(_u),this.ctx.fill(),this.ctx.restore())),uw(l)&&l.value.length){switch(v=this.createFontStyle(i),S=v[0],C=v[1],b=this.fontMetrics.getMetrics(S,C).baseline,this.ctx.font=S,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Aw(l.styles.textAlign),M=Mo(l),w=0,l.styles.textAlign){case 1:w+=M.width/2;break;case 2:w+=M.width;break}x=M.add(w,0,0,-M.height/2+1),this.ctx.save(),this.path([new it(M.left,M.top),new it(M.left+M.width,M.top),new it(M.left+M.width,M.top+M.height),new it(M.left,M.top+M.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Cn(l.value,x),i.letterSpacing,b),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ta(l.styles.display,2048))return[3,20];if(l.styles.listStyleImage===null)return[3,19];if(F=l.styles.listStyleImage,F.type!==0)return[3,18];L=void 0,U=F.url,I.label=15;case 15:return I.trys.push([15,17,,18]),[4,this.context.cache.match(U)];case 16:return L=I.sent(),this.ctx.drawImage(L,l.bounds.left-(L.width+10),l.bounds.top),[3,18];case 17:return I.sent(),this.context.logger.error("Error loading list-style-image "+U),[3,18];case 18:return[3,20];case 19:a.listValue&&l.styles.listStyleType!==-1&&(S=this.createFontStyle(i)[0],this.ctx.font=S,this.ctx.fillStyle=Oa(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",M=new Xl(l.bounds.left,l.bounds.top+ma(l.styles.paddingTop,l.bounds.width),l.bounds.width,eu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Cn(a.listValue,M),i.letterSpacing,eu(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),I.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return el(this,void 0,void 0,function(){var l,s,F,i,c,F,p,m,F,_,g,F,y,v,F,C,b,F,w,x,F;return Ya(this,function(L){switch(L.label){case 0:if(Ta(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:L.sent(),l=0,s=a.negativeZIndex,L.label=2;case 2:return l<s.length?(F=s[l],[4,this.renderStack(F)]):[3,5];case 3:L.sent(),L.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:L.sent(),i=0,c=a.nonInlineLevel,L.label=7;case 7:return i<c.length?(F=c[i],[4,this.renderNode(F)]):[3,10];case 8:L.sent(),L.label=9;case 9:return i++,[3,7];case 10:p=0,m=a.nonPositionedFloats,L.label=11;case 11:return p<m.length?(F=m[p],[4,this.renderStack(F)]):[3,14];case 12:L.sent(),L.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,L.label=15;case 15:return _<g.length?(F=g[_],[4,this.renderStack(F)]):[3,18];case 16:L.sent(),L.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,L.label=19;case 19:return y<v.length?(F=v[y],[4,this.renderNode(F)]):[3,22];case 20:L.sent(),L.label=21;case 21:return y++,[3,19];case 22:C=0,b=a.zeroOrAutoZIndexOrTransformedOrOpacity,L.label=23;case 23:return C<b.length?(F=b[C],[4,this.renderStack(F)]):[3,26];case 24:L.sent(),L.label=25;case 25:return C++,[3,23];case 26:w=0,x=a.positiveZIndex,L.label=27;case 27:return w<x.length?(F=x[w],[4,this.renderStack(F)]):[3,30];case 28:L.sent(),L.label=29;case 29:return w++,[3,27];case 30:return[2]}})})},t.prototype.mask=function(a){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(a.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(a){this.ctx.beginPath(),this.formatPath(a),this.ctx.closePath()},t.prototype.formatPath=function(a){var l=this;a.forEach(function(s,i){var c=wl(s)?s.start:s;i===0?l.ctx.moveTo(c.x,c.y):l.ctx.lineTo(c.x,c.y),wl(s)&&l.ctx.bezierCurveTo(s.startControl.x,s.startControl.y,s.endControl.x,s.endControl.y,s.end.x,s.end.y)})},t.prototype.renderRepeat=function(a,l,s,i){this.path(a),this.ctx.fillStyle=l,this.ctx.translate(s,i),this.ctx.fill(),this.ctx.translate(-s,-i)},t.prototype.resizeImage=function(a,l,s){var i;if(a.width===l&&a.height===s)return a;var c=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,p=c.createElement("canvas");p.width=Math.max(1,l),p.height=Math.max(1,s);var m=p.getContext("2d");return m.drawImage(a,0,0,a.width,a.height,0,0,l,s),p},t.prototype.renderBackgroundImage=function(a){return el(this,void 0,void 0,function(){var l,s,i,c,p,m;return Ya(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(g){var y,v,C,D,Z,W,G,J,Q,b,D,Z,W,G,J,w,x,F,L,U,S,M,I,T,Q,E,D,H,P,G,J,oe,Z,W,pe,N,j,q,X,ie,ge,fe;return Ya(this,function(he){switch(he.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,he.label=1;case 1:return he.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=he.sent(),[3,4];case 3:return he.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(C=Pi(a,l,[y.width,y.height,y.width/y.height]),D=C[0],Z=C[1],W=C[2],G=C[3],J=C[4],Q=i.ctx.createPattern(i.resizeImage(y,G,J),"repeat"),i.renderRepeat(D,Q,Z,W)),[3,6];case 5:Y1(g)?(b=Pi(a,l,[null,null,null]),D=b[0],Z=b[1],W=b[2],G=b[3],J=b[4],w=K1(g.angle,G,J),x=w[0],F=w[1],L=w[2],U=w[3],S=w[4],M=document.createElement("canvas"),M.width=G,M.height=J,I=M.getContext("2d"),T=I.createLinearGradient(F,U,L,S),Jd(g.stops,x).forEach(function(le){return T.addColorStop(le.stop,Oa(le.color))}),I.fillStyle=T,I.fillRect(0,0,G,J),G>0&&J>0&&(Q=i.ctx.createPattern(M,"repeat"),i.renderRepeat(D,Q,Z,W))):W1(g)&&(E=Pi(a,l,[null,null,null]),D=E[0],H=E[1],P=E[2],G=E[3],J=E[4],oe=g.position.length===0?[ld]:g.position,Z=ma(oe[0],G),W=ma(oe[oe.length-1],J),pe=G1(g,Z,W,G,J),N=pe[0],j=pe[1],N>0&&j>0&&(q=i.ctx.createRadialGradient(H+Z,P+W,0,H+Z,P+W,N),Jd(g.stops,N*2).forEach(function(le){return q.addColorStop(le.stop,Oa(le.color))}),i.path(D),i.ctx.fillStyle=q,N!==j?(X=a.bounds.left+.5*a.bounds.width,ie=a.bounds.top+.5*a.bounds.height,ge=j/N,fe=1/ge,i.ctx.save(),i.ctx.translate(X,ie),i.ctx.transform(1,0,0,ge,0,0),i.ctx.translate(-X,-ie),i.ctx.fillRect(H,fe*(P-ie)+ie,G,J*fe),i.ctx.restore()):i.ctx.fill())),he.label=6;case 6:return l--,[2]}})},i=this,c=0,p=a.styles.backgroundImage.slice(0).reverse(),_.label=1;case 1:return c<p.length?(m=p[c],[5,s(m)]):[3,4];case 2:_.sent(),_.label=3;case 3:return c++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,l,s){return el(this,void 0,void 0,function(){return Ya(this,function(i){return this.path($u(s,l)),this.ctx.fillStyle=Oa(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return el(this,void 0,void 0,function(){var c,p;return Ya(this,function(m){switch(m.label){case 0:return l<3?[4,this.renderSolidBorder(a,s,i)]:[3,2];case 1:return m.sent(),[2];case 2:return c=Z0(i,s),this.path(c),this.ctx.fillStyle=Oa(a),this.ctx.fill(),p=ew(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return el(this,void 0,void 0,function(){var l,s,i,c,p,m,_,g,y=this;return Ya(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,s=!us(l.backgroundColor)||l.backgroundImage.length,i=[{style:l.borderTopStyle,color:l.borderTopColor,width:l.borderTopWidth},{style:l.borderRightStyle,color:l.borderRightColor,width:l.borderRightWidth},{style:l.borderBottomStyle,color:l.borderBottomColor,width:l.borderBottomWidth},{style:l.borderLeftStyle,color:l.borderLeftColor,width:l.borderLeftWidth}],c=cw(Ps(l.backgroundClip,0),a.curves),s||l.boxShadow.length?(this.ctx.save(),this.path(c),this.ctx.clip(),us(l.backgroundColor)||(this.ctx.fillStyle=Oa(l.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),l.boxShadow.slice(0).reverse().forEach(function(C){y.ctx.save();var b=Vo(a.curves),w=C.inset?0:rw,x=X0(b,-w+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(y.path(b),y.ctx.clip(),y.mask(x)):(y.mask(b),y.ctx.clip(),y.path(x)),y.ctx.shadowOffsetX=C.offsetX.number+w,y.ctx.shadowOffsetY=C.offsetY.number,y.ctx.shadowColor=Oa(C.color),y.ctx.shadowBlur=C.blur.number,y.ctx.fillStyle=C.inset?Oa(C.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:p=0,m=0,_=i,v.label=3;case 3:return m<_.length?(g=_[m],g.style!==0&&!us(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return g.style!==3?[3,7]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,3)];case 6:return v.sent(),[3,11];case 7:return g.style!==4?[3,9]:[4,this.renderDoubleBorder(g.color,g.width,p,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,p,a.curves)];case 10:v.sent(),v.label=11;case 11:p++,v.label=12;case 12:return m++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,s,i,c){return el(this,void 0,void 0,function(){var p,m,_,g,y,v,C,b,w,x,F,L,U,S,M,I,M,I;return Ya(this,function(T){return this.ctx.save(),p=tw(i,s),m=$u(i,s),c===2&&(this.path(m),this.ctx.clip()),wl(m[0])?(_=m[0].start.x,g=m[0].start.y):(_=m[0].x,g=m[0].y),wl(m[1])?(y=m[1].end.x,v=m[1].end.y):(y=m[1].x,v=m[1].y),s===0||s===2?C=Math.abs(_-y):C=Math.abs(g-v),this.ctx.beginPath(),c===3?this.formatPath(p):this.formatPath(m.slice(0,2)),b=l<3?l*3:l*2,w=l<3?l*2:l,c===3&&(b=l,w=l),x=!0,C<=b*2?x=!1:C<=b*2+w?(F=C/(2*b+w),b*=F,w*=F):(L=Math.floor((C+w)/(b+w)),U=(C-L*b)/(L-1),S=(C-(L+1)*b)/L,w=S<=0||Math.abs(w-U)<Math.abs(w-S)?U:S),x&&(c===3?this.ctx.setLineDash([0,b+w]):this.ctx.setLineDash([b,w])),c===3?(this.ctx.lineCap="round",this.ctx.lineWidth=l):this.ctx.lineWidth=l*2+1.1,this.ctx.strokeStyle=Oa(a),this.ctx.stroke(),this.ctx.setLineDash([]),c===2&&(wl(m[0])&&(M=m[3],I=m[0],this.ctx.beginPath(),this.formatPath([new it(M.end.x,M.end.y),new it(I.start.x,I.start.y)]),this.ctx.stroke()),wl(m[1])&&(M=m[1],I=m[2],this.ctx.beginPath(),this.formatPath([new it(M.end.x,M.end.y),new it(I.start.x,I.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return el(this,void 0,void 0,function(){var l;return Ya(this,function(s){switch(s.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Oa(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),l=J0(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(YA),uw=function(e){return e instanceof IA||e instanceof UA?!0:e instanceof id&&e.type!==Io&&e.type!==Uo},cw=function(e,t){switch(e){case 0:return Vo(t);case 2:return j0(t);case 1:default:return To(t)}},Aw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},pw=["-apple-system","system-ui"],fw=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return pw.indexOf(t)===-1}):e},mw=function(e){Il(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),s.options=l,s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px",s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+l.width+"x"+l.height+" at "+l.x+","+l.y+") with scale "+l.scale),s}return t.prototype.render=function(a){return el(this,void 0,void 0,function(){var l,s;return Ya(this,function(i){switch(i.label){case 0:return l=br(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,hw(l)];case 1:return s=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Oa(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(s,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(YA),hw=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},_w=function(){function e(t){var a=t.id,l=t.enabled;this.id=a,this.enabled=l,this.start=Date.now()}return e.prototype.debug=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Hn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Hn([this.id,this.getTime()+"ms"],t))},e.prototype.warn=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Hn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.error=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Hn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),vw=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new _w({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new L0(this,t)}return e.instanceCount=1,e}(),gw=function(e,t){return t===void 0&&(t={}),yw(e,t)};typeof window<"u"&&NA.setContext(window);var yw=function(e,t){return el(void 0,void 0,void 0,function(){var a,l,s,i,c,p,m,_,g,y,v,C,b,w,x,F,L,U,S,M,T,I,T,Q,E,D,H,P,G,J,oe,Z,W,pe,N,j,q,X,ie,ge;return Ya(this,function(fe){switch(fe.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(a=e.ownerDocument,!a)throw new Error("Element is not attached to a Document");if(l=a.defaultView,!l)throw new Error("Document is not attached to a Window");return s={allowTaint:(Q=t.allowTaint)!==null&&Q!==void 0?Q:!1,imageTimeout:(E=t.imageTimeout)!==null&&E!==void 0?E:15e3,proxy:t.proxy,useCORS:(D=t.useCORS)!==null&&D!==void 0?D:!1},i=or({logging:(H=t.logging)!==null&&H!==void 0?H:!0,cache:t.cache},s),c={windowWidth:(P=t.windowWidth)!==null&&P!==void 0?P:l.innerWidth,windowHeight:(G=t.windowHeight)!==null&&G!==void 0?G:l.innerHeight,scrollX:(J=t.scrollX)!==null&&J!==void 0?J:l.pageXOffset,scrollY:(oe=t.scrollY)!==null&&oe!==void 0?oe:l.pageYOffset},p=new Xl(c.scrollX,c.scrollY,c.windowWidth,c.windowHeight),m=new vw(i,p),_=(Z=t.foreignObjectRendering)!==null&&Z!==void 0?Z:!1,g={allowTaint:(W=t.allowTaint)!==null&&W!==void 0?W:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},m.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),y=new xu(m,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=fe.sent(),b=rd(v)||b0(v)?Xv(v.ownerDocument):si(m,v),w=b.width,x=b.height,F=b.left,L=b.top,U=bw(m,v,t.backgroundColor),S={canvas:t.canvas,backgroundColor:U,scale:(N=(pe=t.scale)!==null&&pe!==void 0?pe:l.devicePixelRatio)!==null&&N!==void 0?N:1,x:((j=t.x)!==null&&j!==void 0?j:0)+F,y:((q=t.y)!==null&&q!==void 0?q:0)+L,width:(X=t.width)!==null&&X!==void 0?X:Math.ceil(w),height:(ie=t.height)!==null&&ie!==void 0?ie:Math.ceil(x)},_?(m.logger.debug("Document cloned, using foreign object rendering"),T=new mw(m,S),[4,T.render(v)]):[3,3];case 2:return M=fe.sent(),[3,5];case 3:return m.logger.debug("Document cloned, element located at "+F+","+L+" with size "+w+"x"+x+" using computed rendering"),m.logger.debug("Starting DOM parsing"),I=VA(m,v),U===I.styles.backgroundColor&&(I.styles.backgroundColor=zl.TRANSPARENT),m.logger.debug("Starting renderer for element at "+S.x+","+S.y+" with size "+S.width+"x"+S.height),T=new dw(m,S),[4,T.render(I)];case 4:M=fe.sent(),fe.label=5;case 5:return(!((ge=t.removeContainer)!==null&&ge!==void 0)||ge)&&(xu.destroy(C)||m.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),m.logger.debug("Finished rendering"),[2,M]}})})},bw=function(e,t,a){var l=t.ownerDocument,s=l.documentElement?bn(e,getComputedStyle(l.documentElement).backgroundColor):zl.TRANSPARENT,i=l.body?bn(e,getComputedStyle(l.body).backgroundColor):zl.TRANSPARENT,c=typeof a=="string"?bn(e,a):a===null?zl.TRANSPARENT:4294967295;return t===l.documentElement?us(s)?us(i)?c:i:s:c};const ka={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&gw(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(s=>{const i=document.createElement("a");i.download="chart-screenshot.png",i.href=s.toDataURL(),i.click()})},a=e;return(l,s)=>(r(),$(Xe,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:d(()=>[n(ee,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Ni={exports:{}};/** @license | |
| 21 | +}`,vw=function(e){gw(e,"."+Mr+hw+Hu+` | |
| 22 | + .`+Lr+_w+Hu)},gw=function(e,t){var a=e.ownerDocument;if(a){var l=a.createElement("style");l.textContent=t,e.appendChild(l)}},hp=function(){function e(){}return e.getOrigin=function(t){var a=e._link;return a?(a.href=t,a.href=a.href,a.protocol+a.hostname+a.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),yw=function(){function e(t,a){this.context=t,this._options=a,this._cache={}}return e.prototype.addImage=function(t){var a=Promise.resolve();return this.has(t)||(Wi(t)||kw(t))&&(this._cache[t]=this.loadImage(t)).catch(function(){}),a},e.prototype.match=function(t){return this._cache[t]},e.prototype.loadImage=function(t){return al(this,void 0,void 0,function(){var a,l,s,i,c=this;return Ja(this,function(p){switch(p.label){case 0:return a=hp.isSameOrigin(t),l=!Yi(t)&&this._options.useCORS===!0&&Na.SUPPORT_CORS_IMAGES&&!a,s=!Yi(t)&&!a&&!Wi(t)&&typeof this._options.proxy=="string"&&Na.SUPPORT_CORS_XHR&&!l,!a&&this._options.allowTaint===!1&&!Yi(t)&&!Wi(t)&&!s&&!l?[2]:(i=t,s?[4,this.proxy(i)]:[3,2]);case 1:i=p.sent(),p.label=2;case 2:return this.context.logger.debug("Added image "+t.substring(0,256)),[4,new Promise(function(f,_){var g=new Image;g.onload=function(){return f(g)},g.onerror=_,(Bw(i)||l)&&(g.crossOrigin="anonymous"),g.src=i,g.complete===!0&&setTimeout(function(){return f(g)},500),c._options.imageTimeout>0&&setTimeout(function(){return _("Timed out ("+c._options.imageTimeout+"ms) loading image")},c._options.imageTimeout)})];case 3:return[2,p.sent()]}})})},e.prototype.has=function(t){return typeof this._cache[t]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(t){var a=this,l=this._options.proxy;if(!l)throw new Error("No proxy defined");var s=t.substring(0,256);return new Promise(function(i,c){var p=Na.SUPPORT_RESPONSE_TYPE?"blob":"text",f=new XMLHttpRequest;f.onload=function(){if(f.status===200)if(p==="text")i(f.response);else{var y=new FileReader;y.addEventListener("load",function(){return i(y.result)},!1),y.addEventListener("error",function(v){return c(v)},!1),y.readAsDataURL(f.response)}else c("Failed to proxy resource "+s+" with status code "+f.status)},f.onerror=c;var _=l.indexOf("?")>-1?"&":"?";if(f.open("GET",""+l+_+"url="+encodeURIComponent(t)+"&responseType="+p),p!=="text"&&f instanceof XMLHttpRequest&&(f.responseType=p),a._options.imageTimeout){var g=a._options.imageTimeout;f.timeout=g,f.ontimeout=function(){return c("Timed out ("+g+"ms) proxying "+s)}}f.send()})},e}(),bw=/^data:image\/svg\+xml/i,ww=/^data:image\/.*;base64,/i,Cw=/^data:image\/.*/i,kw=function(e){return Na.SUPPORT_SVG_DRAWING||!xw(e)},Yi=function(e){return Cw.test(e)},Bw=function(e){return ww.test(e)},Wi=function(e){return e.substr(0,4)==="blob"},xw=function(e){return e.substr(-3).toLowerCase()==="svg"||bw.test(e)},rt=function(){function e(t,a){this.type=0,this.x=t,this.y=a}return e.prototype.add=function(t,a){return new e(this.x+t,this.y+a)},e}(),Gs=function(e,t,a){return new rt(e.x+(t.x-e.x)*a,e.y+(t.y-e.y)*a)},fo=function(){function e(t,a,l,s){this.type=1,this.start=t,this.startControl=a,this.endControl=l,this.end=s}return e.prototype.subdivide=function(t,a){var l=Gs(this.start,this.startControl,t),s=Gs(this.startControl,this.endControl,t),i=Gs(this.endControl,this.end,t),c=Gs(l,s,t),p=Gs(s,i,t),f=Gs(c,p,t);return a?new e(this.start,l,c,f):new e(f,p,i,this.end)},e.prototype.add=function(t,a){return new e(this.start.add(t,a),this.startControl.add(t,a),this.endControl.add(t,a),this.end.add(t,a))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Sl=function(e){return e.type===1},Sw=function(){function e(t){var a=t.styles,l=t.bounds,s=Bn(a.borderTopLeftRadius,l.width,l.height),i=s[0],c=s[1],p=Bn(a.borderTopRightRadius,l.width,l.height),f=p[0],_=p[1],g=Bn(a.borderBottomRightRadius,l.width,l.height),y=g[0],v=g[1],w=Bn(a.borderBottomLeftRadius,l.width,l.height),k=w[0],b=w[1],S=[];S.push((i+f)/l.width),S.push((k+y)/l.width),S.push((c+b)/l.height),S.push((_+v)/l.height);var $=Math.max.apply(Math,S);$>1&&(i/=$,c/=$,f/=$,_/=$,y/=$,v/=$,k/=$,b/=$);var D=l.width-f,F=l.height-v,B=l.width-y,U=l.height-b,Q=a.borderTopWidth,V=a.borderRightWidth,I=a.borderBottomWidth,M=a.borderLeftWidth,O=_a(a.paddingTop,t.bounds.width),L=_a(a.paddingRight,t.bounds.width),H=_a(a.paddingBottom,t.bounds.width),j=_a(a.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||c>0?Ca(l.left+M/3,l.top+Q/3,i-M/3,c-Q/3,la.TOP_LEFT):new rt(l.left+M/3,l.top+Q/3),this.topRightBorderDoubleOuterBox=i>0||c>0?Ca(l.left+D,l.top+Q/3,f-V/3,_-Q/3,la.TOP_RIGHT):new rt(l.left+l.width-V/3,l.top+Q/3),this.bottomRightBorderDoubleOuterBox=y>0||v>0?Ca(l.left+B,l.top+F,y-V/3,v-I/3,la.BOTTOM_RIGHT):new rt(l.left+l.width-V/3,l.top+l.height-I/3),this.bottomLeftBorderDoubleOuterBox=k>0||b>0?Ca(l.left+M/3,l.top+U,k-M/3,b-I/3,la.BOTTOM_LEFT):new rt(l.left+M/3,l.top+l.height-I/3),this.topLeftBorderDoubleInnerBox=i>0||c>0?Ca(l.left+M*2/3,l.top+Q*2/3,i-M*2/3,c-Q*2/3,la.TOP_LEFT):new rt(l.left+M*2/3,l.top+Q*2/3),this.topRightBorderDoubleInnerBox=i>0||c>0?Ca(l.left+D,l.top+Q*2/3,f-V*2/3,_-Q*2/3,la.TOP_RIGHT):new rt(l.left+l.width-V*2/3,l.top+Q*2/3),this.bottomRightBorderDoubleInnerBox=y>0||v>0?Ca(l.left+B,l.top+F,y-V*2/3,v-I*2/3,la.BOTTOM_RIGHT):new rt(l.left+l.width-V*2/3,l.top+l.height-I*2/3),this.bottomLeftBorderDoubleInnerBox=k>0||b>0?Ca(l.left+M*2/3,l.top+U,k-M*2/3,b-I*2/3,la.BOTTOM_LEFT):new rt(l.left+M*2/3,l.top+l.height-I*2/3),this.topLeftBorderStroke=i>0||c>0?Ca(l.left+M/2,l.top+Q/2,i-M/2,c-Q/2,la.TOP_LEFT):new rt(l.left+M/2,l.top+Q/2),this.topRightBorderStroke=i>0||c>0?Ca(l.left+D,l.top+Q/2,f-V/2,_-Q/2,la.TOP_RIGHT):new rt(l.left+l.width-V/2,l.top+Q/2),this.bottomRightBorderStroke=y>0||v>0?Ca(l.left+B,l.top+F,y-V/2,v-I/2,la.BOTTOM_RIGHT):new rt(l.left+l.width-V/2,l.top+l.height-I/2),this.bottomLeftBorderStroke=k>0||b>0?Ca(l.left+M/2,l.top+U,k-M/2,b-I/2,la.BOTTOM_LEFT):new rt(l.left+M/2,l.top+l.height-I/2),this.topLeftBorderBox=i>0||c>0?Ca(l.left,l.top,i,c,la.TOP_LEFT):new rt(l.left,l.top),this.topRightBorderBox=f>0||_>0?Ca(l.left+D,l.top,f,_,la.TOP_RIGHT):new rt(l.left+l.width,l.top),this.bottomRightBorderBox=y>0||v>0?Ca(l.left+B,l.top+F,y,v,la.BOTTOM_RIGHT):new rt(l.left+l.width,l.top+l.height),this.bottomLeftBorderBox=k>0||b>0?Ca(l.left,l.top+U,k,b,la.BOTTOM_LEFT):new rt(l.left,l.top+l.height),this.topLeftPaddingBox=i>0||c>0?Ca(l.left+M,l.top+Q,Math.max(0,i-M),Math.max(0,c-Q),la.TOP_LEFT):new rt(l.left+M,l.top+Q),this.topRightPaddingBox=f>0||_>0?Ca(l.left+Math.min(D,l.width-V),l.top+Q,D>l.width+V?0:Math.max(0,f-V),Math.max(0,_-Q),la.TOP_RIGHT):new rt(l.left+l.width-V,l.top+Q),this.bottomRightPaddingBox=y>0||v>0?Ca(l.left+Math.min(B,l.width-M),l.top+Math.min(F,l.height-I),Math.max(0,y-V),Math.max(0,v-I),la.BOTTOM_RIGHT):new rt(l.left+l.width-V,l.top+l.height-I),this.bottomLeftPaddingBox=k>0||b>0?Ca(l.left+M,l.top+Math.min(U,l.height-I),Math.max(0,k-M),Math.max(0,b-I),la.BOTTOM_LEFT):new rt(l.left+M,l.top+l.height-I),this.topLeftContentBox=i>0||c>0?Ca(l.left+M+j,l.top+Q+O,Math.max(0,i-(M+j)),Math.max(0,c-(Q+O)),la.TOP_LEFT):new rt(l.left+M+j,l.top+Q+O),this.topRightContentBox=f>0||_>0?Ca(l.left+Math.min(D,l.width+M+j),l.top+Q+O,D>l.width+M+j?0:f-M+j,_-(Q+O),la.TOP_RIGHT):new rt(l.left+l.width-(V+L),l.top+Q+O),this.bottomRightContentBox=y>0||v>0?Ca(l.left+Math.min(B,l.width-(M+j)),l.top+Math.min(F,l.height+Q+O),Math.max(0,y-(V+L)),v-(I+H),la.BOTTOM_RIGHT):new rt(l.left+l.width-(V+L),l.top+l.height-(I+H)),this.bottomLeftContentBox=k>0||b>0?Ca(l.left+M+j,l.top+U,Math.max(0,k-(M+j)),b-(I+H),la.BOTTOM_LEFT):new rt(l.left+M+j,l.top+l.height-(I+H))}return e}(),la;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(la||(la={}));var Ca=function(e,t,a,l,s){var i=4*((Math.sqrt(2)-1)/3),c=a*i,p=l*i,f=e+a,_=t+l;switch(s){case la.TOP_LEFT:return new fo(new rt(e,_),new rt(e,_-p),new rt(f-c,t),new rt(f,t));case la.TOP_RIGHT:return new fo(new rt(e,t),new rt(e+c,t),new rt(f,_-p),new rt(f,_));case la.BOTTOM_RIGHT:return new fo(new rt(f,t),new rt(f,t+p),new rt(e+c,_),new rt(e,_));case la.BOTTOM_LEFT:default:return new fo(new rt(f,_),new rt(f-c,_),new rt(e,t+p),new rt(e,t))}},Ko=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Fw=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},Go=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},$w=function(){function e(t,a,l){this.offsetX=t,this.offsetY=a,this.matrix=l,this.type=0,this.target=6}return e}(),mo=function(){function e(t,a){this.path=t,this.target=a,this.type=1}return e}(),Ew=function(){function e(t){this.opacity=t,this.type=2,this.target=6}return e}(),Uw=function(e){return e.type===0},_p=function(e){return e.type===1},Iw=function(e){return e.type===2},Nu=function(e,t){return e.length===t.length?e.some(function(a,l){return a===t[l]}):!1},Qw=function(e,t,a,l,s){return e.map(function(i,c){switch(c){case 0:return i.add(t,a);case 1:return i.add(t+l,a);case 2:return i.add(t+l,a+s);case 3:return i.add(t,a+s)}return i})},vp=function(){function e(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),gp=function(){function e(t,a){if(this.container=t,this.parent=a,this.effects=[],this.curves=new Sw(this.container),this.container.styles.opacity<1&&this.effects.push(new Ew(this.container.styles.opacity)),this.container.styles.transform!==null){var l=this.container.bounds.left+this.container.styles.transformOrigin[0].number,s=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new $w(l,s,i))}if(this.container.styles.overflowX!==0){var c=Ko(this.curves),p=Go(this.curves);Nu(c,p)?this.effects.push(new mo(c,6)):(this.effects.push(new mo(c,2)),this.effects.push(new mo(p,4)))}}return e.prototype.getEffects=function(t){for(var a=[2,3].indexOf(this.container.styles.position)===-1,l=this.parent,s=this.effects.slice(0);l;){var i=l.effects.filter(function(f){return!_p(f)});if(a||l.container.styles.position!==0||!l.parent){if(s.unshift.apply(s,i),a=[2,3].indexOf(l.container.styles.position)===-1,l.container.styles.overflowX!==0){var c=Ko(l.curves),p=Go(l.curves);Nu(c,p)||s.unshift(new mo(p,6))}}else s.unshift.apply(s,i);l=l.parent}return s.filter(function(f){return Ma(f.target,t)})},e}(),Rr=function(e,t,a,l){e.container.elements.forEach(function(s){var i=Ma(s.flags,4),c=Ma(s.flags,2),p=new gp(s,e);Ma(s.styles.display,2048)&&l.push(p);var f=Ma(s.flags,8)?[]:l;if(i||c){var _=i||s.styles.isPositioned()?a:t,g=new vp(p);if(s.styles.isPositioned()||s.styles.opacity<1||s.styles.isTransformed()){var y=s.styles.zIndex.order;if(y<0){var v=0;_.negativeZIndex.some(function(k,b){return y>k.element.container.styles.zIndex.order?(v=b,!1):v>0}),_.negativeZIndex.splice(v,0,g)}else if(y>0){var w=0;_.positiveZIndex.some(function(k,b){return y>=k.element.container.styles.zIndex.order?(w=b+1,!1):w>0}),_.positiveZIndex.splice(w,0,g)}else _.zeroOrAutoZIndexOrTransformedOrOpacity.push(g)}else s.styles.isFloating()?_.nonPositionedFloats.push(g):_.nonPositionedInlineLevel.push(g);Rr(p,g,i?g:a,f)}else s.styles.isInlineLevel()?t.inlineLevel.push(p):t.nonInlineLevel.push(p),Rr(p,t,a,f);Ma(s.flags,8)&&yp(s,f)})},yp=function(e,t){for(var a=e instanceof Dr?e.start:1,l=e instanceof Dr?e.reversed:!1,s=0;s<t.length;s++){var i=t[s];i.container instanceof lp&&typeof i.container.value=="number"&&i.container.value!==0&&(a=i.container.value),i.listValue=On(a,i.container.styles.listStyleType,!0),a+=l?-1:1}},Dw=function(e){var t=new gp(e,null),a=new vp(t),l=[];return Rr(t,a,a,l),yp(t.container,l),a},Ku=function(e,t){switch(t){case 0:return El(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return El(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return El(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return El(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Vw=function(e,t){switch(t){case 0:return El(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return El(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return El(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return El(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},Tw=function(e,t){switch(t){case 0:return El(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return El(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return El(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return El(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Mw=function(e,t){switch(t){case 0:return ho(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return ho(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return ho(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return ho(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},ho=function(e,t){var a=[];return Sl(e)?a.push(e.subdivide(.5,!1)):a.push(e),Sl(t)?a.push(t.subdivide(.5,!0)):a.push(t),a},El=function(e,t,a,l){var s=[];return Sl(e)?s.push(e.subdivide(.5,!1)):s.push(e),Sl(a)?s.push(a.subdivide(.5,!0)):s.push(a),Sl(l)?s.push(l.subdivide(.5,!0).reverse()):s.push(l),Sl(t)?s.push(t.subdivide(.5,!1).reverse()):s.push(t),s},bp=function(e){var t=e.bounds,a=e.styles;return t.add(a.borderLeftWidth,a.borderTopWidth,-(a.borderRightWidth+a.borderLeftWidth),-(a.borderTopWidth+a.borderBottomWidth))},zo=function(e){var t=e.styles,a=e.bounds,l=_a(t.paddingLeft,a.width),s=_a(t.paddingRight,a.width),i=_a(t.paddingTop,a.width),c=_a(t.paddingBottom,a.width);return a.add(l+t.borderLeftWidth,i+t.borderTopWidth,-(t.borderRightWidth+t.borderLeftWidth+l+s),-(t.borderTopWidth+t.borderBottomWidth+i+c))},Lw=function(e,t){return e===0?t.bounds:e===2?zo(t):bp(t)},Rw=function(e,t){return e===0?t.bounds:e===2?zo(t):bp(t)},Ji=function(e,t,a){var l=Lw(Ys(e.styles.backgroundOrigin,t),e),s=Rw(Ys(e.styles.backgroundClip,t),e),i=Ow(Ys(e.styles.backgroundSize,t),a,l),c=i[0],p=i[1],f=Bn(Ys(e.styles.backgroundPosition,t),l.width-c,l.height-p),_=Pw(Ys(e.styles.backgroundRepeat,t),f,i,l,s),g=Math.round(l.left+f[0]),y=Math.round(l.top+f[1]);return[_,g,y,c,p]},zs=function(e){return ia(e)&&e.value===tn.AUTO},_o=function(e){return typeof e=="number"},Ow=function(e,t,a){var l=t[0],s=t[1],i=t[2],c=e[0],p=e[1];if(!c)return[0,0];if(Da(c)&&p&&Da(p))return[_a(c,a.width),_a(p,a.height)];var f=_o(i);if(ia(c)&&(c.value===tn.CONTAIN||c.value===tn.COVER)){if(_o(i)){var _=a.width/a.height;return _<i!=(c.value===tn.COVER)?[a.width,a.width/i]:[a.height*i,a.height]}return[a.width,a.height]}var g=_o(l),y=_o(s),v=g||y;if(zs(c)&&(!p||zs(p))){if(g&&y)return[l,s];if(!f&&!v)return[a.width,a.height];if(v&&f){var w=g?l:s*i,k=y?s:l/i;return[w,k]}var b=g?l:a.width,S=y?s:a.height;return[b,S]}if(f){var $=0,D=0;return Da(c)?$=_a(c,a.width):Da(p)&&(D=_a(p,a.height)),zs(c)?$=D*i:(!p||zs(p))&&(D=$/i),[$,D]}var F=null,B=null;if(Da(c)?F=_a(c,a.width):p&&Da(p)&&(B=_a(p,a.height)),F!==null&&(!p||zs(p))&&(B=g&&y?F/l*s:a.height),B!==null&&zs(c)&&(F=g&&y?B/s*l:a.width),F!==null&&B!==null)return[F,B];throw new Error("Unable to calculate background-size for element")},Ys=function(e,t){var a=e[t];return typeof a>"u"?e[0]:a},Pw=function(e,t,a,l,s){var i=t[0],c=t[1],p=a[0],f=a[1];switch(e){case 2:return[new rt(Math.round(l.left),Math.round(l.top+c)),new rt(Math.round(l.left+l.width),Math.round(l.top+c)),new rt(Math.round(l.left+l.width),Math.round(f+l.top+c)),new rt(Math.round(l.left),Math.round(f+l.top+c))];case 3:return[new rt(Math.round(l.left+i),Math.round(l.top)),new rt(Math.round(l.left+i+p),Math.round(l.top)),new rt(Math.round(l.left+i+p),Math.round(l.height+l.top)),new rt(Math.round(l.left+i),Math.round(l.height+l.top))];case 1:return[new rt(Math.round(l.left+i),Math.round(l.top+c)),new rt(Math.round(l.left+i+p),Math.round(l.top+c)),new rt(Math.round(l.left+i+p),Math.round(l.top+c+f)),new rt(Math.round(l.left+i),Math.round(l.top+c+f))];default:return[new rt(Math.round(s.left),Math.round(s.top)),new rt(Math.round(s.left+s.width),Math.round(s.top)),new rt(Math.round(s.left+s.width),Math.round(s.height+s.top)),new rt(Math.round(s.left),Math.round(s.height+s.top))]}},Hw="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",Gu="Hidden Text",Nw=function(){function e(t){this._data={},this._document=t}return e.prototype.parseMetrics=function(t,a){var l=this._document.createElement("div"),s=this._document.createElement("img"),i=this._document.createElement("span"),c=this._document.body;l.style.visibility="hidden",l.style.fontFamily=t,l.style.fontSize=a,l.style.margin="0",l.style.padding="0",l.style.whiteSpace="nowrap",c.appendChild(l),s.src=Hw,s.width=1,s.height=1,s.style.margin="0",s.style.padding="0",s.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=a,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(Gu)),l.appendChild(i),l.appendChild(s);var p=s.offsetTop-i.offsetTop+2;l.removeChild(i),l.appendChild(this._document.createTextNode(Gu)),l.style.lineHeight="normal",s.style.verticalAlign="super";var f=s.offsetTop-l.offsetTop+2;return c.removeChild(l),{baseline:p,middle:f}},e.prototype.getMetrics=function(t,a){var l=t+" "+a;return typeof this._data[l]>"u"&&(this._data[l]=this.parseMetrics(t,a)),this._data[l]},e}(),wp=function(){function e(t,a){this.context=t,this.options=a}return e}(),Kw=1e4,Gw=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s._activeEffects=[],s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),l.canvas||(s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px"),s.fontMetrics=new Nw(document),s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.ctx.textBaseline="bottom",s._activeEffects=[],s.context.logger.debug("Canvas renderer initialized ("+l.width+"x"+l.height+") with scale "+l.scale),s}return t.prototype.applyEffects=function(a){for(var l=this;this._activeEffects.length;)this.popEffect();a.forEach(function(s){return l.applyEffect(s)})},t.prototype.applyEffect=function(a){this.ctx.save(),Iw(a)&&(this.ctx.globalAlpha=a.opacity),Uw(a)&&(this.ctx.translate(a.offsetX,a.offsetY),this.ctx.transform(a.matrix[0],a.matrix[1],a.matrix[2],a.matrix[3],a.matrix[4],a.matrix[5]),this.ctx.translate(-a.offsetX,-a.offsetY)),_p(a)&&(this.path(a.path),this.ctx.clip()),this._activeEffects.push(a)},t.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},t.prototype.renderStack=function(a){return al(this,void 0,void 0,function(){var l;return Ja(this,function(s){switch(s.label){case 0:return l=a.element.container.styles,l.isVisible()?[4,this.renderStackContent(a)]:[3,2];case 1:s.sent(),s.label=2;case 2:return[2]}})})},t.prototype.renderNode=function(a){return al(this,void 0,void 0,function(){return Ja(this,function(l){switch(l.label){case 0:if(Ma(a.container.flags,16))debugger;return a.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(a)]:[3,3];case 1:return l.sent(),[4,this.renderNodeContent(a)];case 2:l.sent(),l.label=3;case 3:return[2]}})})},t.prototype.renderTextWithLetterSpacing=function(a,l,s){var i=this;if(l===0)this.ctx.fillText(a.text,a.bounds.left,a.bounds.top+s);else{var c=_d(a.text);c.reduce(function(p,f){return i.ctx.fillText(f,p,a.bounds.top+s),p+i.ctx.measureText(f).width},a.bounds.left)}},t.prototype.createFontStyle=function(a){var l=a.fontVariant.filter(function(c){return c==="normal"||c==="small-caps"}).join(""),s=Ww(a.fontFamily).join(", "),i=Kn(a.fontSize)?""+a.fontSize.number+a.fontSize.unit:a.fontSize.number+"px";return[[a.fontStyle,l,a.fontWeight,i,s].join(" "),s,i]},t.prototype.renderTextNode=function(a,l){return al(this,void 0,void 0,function(){var s,i,c,p,f,_,g,y,v=this;return Ja(this,function(w){return s=this.createFontStyle(l),i=s[0],c=s[1],p=s[2],this.ctx.font=i,this.ctx.direction=l.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",f=this.fontMetrics.getMetrics(c,p),_=f.baseline,g=f.middle,y=l.paintOrder,a.textBounds.forEach(function(k){y.forEach(function(b){switch(b){case 0:v.ctx.fillStyle=Ra(l.color),v.renderTextWithLetterSpacing(k,l.letterSpacing,_);var S=l.textShadow;S.length&&k.text.trim().length&&(S.slice(0).reverse().forEach(function($){v.ctx.shadowColor=Ra($.color),v.ctx.shadowOffsetX=$.offsetX.number*v.options.scale,v.ctx.shadowOffsetY=$.offsetY.number*v.options.scale,v.ctx.shadowBlur=$.blur.number,v.renderTextWithLetterSpacing(k,l.letterSpacing,_)}),v.ctx.shadowColor="",v.ctx.shadowOffsetX=0,v.ctx.shadowOffsetY=0,v.ctx.shadowBlur=0),l.textDecorationLine.length&&(v.ctx.fillStyle=Ra(l.textDecorationColor||l.color),l.textDecorationLine.forEach(function($){switch($){case 1:v.ctx.fillRect(k.bounds.left,Math.round(k.bounds.top+_),k.bounds.width,1);break;case 2:v.ctx.fillRect(k.bounds.left,Math.round(k.bounds.top),k.bounds.width,1);break;case 3:v.ctx.fillRect(k.bounds.left,Math.ceil(k.bounds.top+g),k.bounds.width,1);break}}));break;case 1:l.webkitTextStrokeWidth&&k.text.trim().length&&(v.ctx.strokeStyle=Ra(l.webkitTextStrokeColor),v.ctx.lineWidth=l.webkitTextStrokeWidth,v.ctx.lineJoin=window.chrome?"miter":"round",v.ctx.strokeText(k.text,k.bounds.left,k.bounds.top+_)),v.ctx.strokeStyle="",v.ctx.lineWidth=0,v.ctx.lineJoin="miter";break}})}),[2]})})},t.prototype.renderReplacedElement=function(a,l,s){if(s&&a.intrinsicWidth>0&&a.intrinsicHeight>0){var i=zo(a),c=Go(l);this.path(c),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(s,0,0,a.intrinsicWidth,a.intrinsicHeight,i.left,i.top,i.width,i.height),this.ctx.restore()}},t.prototype.renderNodeContent=function(a){return al(this,void 0,void 0,function(){var l,s,i,c,p,f,D,D,_,g,y,v,B,w,k,U,b,S,$,D,F,B,U;return Ja(this,function(Q){switch(Q.label){case 0:this.applyEffects(a.getEffects(4)),l=a.container,s=a.curves,i=l.styles,c=0,p=l.textNodes,Q.label=1;case 1:return c<p.length?(f=p[c],[4,this.renderTextNode(f,i)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return c++,[3,1];case 4:if(!(l instanceof ep))return[3,8];Q.label=5;case 5:return Q.trys.push([5,7,,8]),[4,this.context.cache.match(l.src)];case 6:return D=Q.sent(),this.renderReplacedElement(l,s,D),[3,8];case 7:return Q.sent(),this.context.logger.error("Error loading image "+l.src),[3,8];case 8:if(l instanceof tp&&this.renderReplacedElement(l,s,l.canvas),!(l instanceof ap))return[3,12];Q.label=9;case 9:return Q.trys.push([9,11,,12]),[4,this.context.cache.match(l.svg)];case 10:return D=Q.sent(),this.renderReplacedElement(l,s,D),[3,12];case 11:return Q.sent(),this.context.logger.error("Error loading svg "+l.svg.substring(0,255)),[3,12];case 12:return l instanceof op&&l.tree?(_=new t(this.context,{scale:this.options.scale,backgroundColor:l.backgroundColor,x:0,y:0,width:l.width,height:l.height}),[4,_.render(l.tree)]):[3,14];case 13:g=Q.sent(),l.width&&l.height&&this.ctx.drawImage(g,0,0,l.width,l.height,l.bounds.left,l.bounds.top,l.bounds.width,l.bounds.height),Q.label=14;case 14:if(l instanceof vd&&(y=Math.min(l.bounds.width,l.bounds.height),l.type===Oo?l.checked&&(this.ctx.save(),this.path([new rt(l.bounds.left+y*.39363,l.bounds.top+y*.79),new rt(l.bounds.left+y*.16,l.bounds.top+y*.5549),new rt(l.bounds.left+y*.27347,l.bounds.top+y*.44071),new rt(l.bounds.left+y*.39694,l.bounds.top+y*.5649),new rt(l.bounds.left+y*.72983,l.bounds.top+y*.23),new rt(l.bounds.left+y*.84,l.bounds.top+y*.34085),new rt(l.bounds.left+y*.39363,l.bounds.top+y*.79)]),this.ctx.fillStyle=Ra(Iu),this.ctx.fill(),this.ctx.restore()):l.type===Po&&l.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(l.bounds.left+y/2,l.bounds.top+y/2,y/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ra(Iu),this.ctx.fill(),this.ctx.restore())),zw(l)&&l.value.length){switch(v=this.createFontStyle(i),B=v[0],w=v[1],k=this.fontMetrics.getMetrics(B,w).baseline,this.ctx.font=B,this.ctx.fillStyle=Ra(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=qw(l.styles.textAlign),U=zo(l),b=0,l.styles.textAlign){case 1:b+=U.width/2;break;case 2:b+=U.width;break}S=U.add(b,0,0,-U.height/2+1),this.ctx.save(),this.path([new rt(U.left,U.top),new rt(U.left+U.width,U.top),new rt(U.left+U.width,U.top+U.height),new rt(U.left,U.top+U.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Un(l.value,S),i.letterSpacing,k),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Ma(l.styles.display,2048))return[3,20];if(l.styles.listStyleImage===null)return[3,19];if($=l.styles.listStyleImage,$.type!==0)return[3,18];D=void 0,F=$.url,Q.label=15;case 15:return Q.trys.push([15,17,,18]),[4,this.context.cache.match(F)];case 16:return D=Q.sent(),this.ctx.drawImage(D,l.bounds.left-(D.width+10),l.bounds.top),[3,18];case 17:return Q.sent(),this.context.logger.error("Error loading list-style-image "+F),[3,18];case 18:return[3,20];case 19:a.listValue&&l.styles.listStyleType!==-1&&(B=this.createFontStyle(i)[0],this.ctx.font=B,this.ctx.fillStyle=Ra(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",U=new ss(l.bounds.left,l.bounds.top+_a(l.styles.paddingTop,l.bounds.width),l.bounds.width,mu(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Un(a.listValue,U),i.letterSpacing,mu(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),Q.label=20;case 20:return[2]}})})},t.prototype.renderStackContent=function(a){return al(this,void 0,void 0,function(){var l,s,$,i,c,$,p,f,$,_,g,$,y,v,$,w,k,$,b,S,$;return Ja(this,function(D){switch(D.label){case 0:if(Ma(a.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(a.element)];case 1:D.sent(),l=0,s=a.negativeZIndex,D.label=2;case 2:return l<s.length?($=s[l],[4,this.renderStack($)]):[3,5];case 3:D.sent(),D.label=4;case 4:return l++,[3,2];case 5:return[4,this.renderNodeContent(a.element)];case 6:D.sent(),i=0,c=a.nonInlineLevel,D.label=7;case 7:return i<c.length?($=c[i],[4,this.renderNode($)]):[3,10];case 8:D.sent(),D.label=9;case 9:return i++,[3,7];case 10:p=0,f=a.nonPositionedFloats,D.label=11;case 11:return p<f.length?($=f[p],[4,this.renderStack($)]):[3,14];case 12:D.sent(),D.label=13;case 13:return p++,[3,11];case 14:_=0,g=a.nonPositionedInlineLevel,D.label=15;case 15:return _<g.length?($=g[_],[4,this.renderStack($)]):[3,18];case 16:D.sent(),D.label=17;case 17:return _++,[3,15];case 18:y=0,v=a.inlineLevel,D.label=19;case 19:return y<v.length?($=v[y],[4,this.renderNode($)]):[3,22];case 20:D.sent(),D.label=21;case 21:return y++,[3,19];case 22:w=0,k=a.zeroOrAutoZIndexOrTransformedOrOpacity,D.label=23;case 23:return w<k.length?($=k[w],[4,this.renderStack($)]):[3,26];case 24:D.sent(),D.label=25;case 25:return w++,[3,23];case 26:b=0,S=a.positiveZIndex,D.label=27;case 27:return b<S.length?($=S[b],[4,this.renderStack($)]):[3,30];case 28:D.sent(),D.label=29;case 29:return b++,[3,27];case 30:return[2]}})})},t.prototype.mask=function(a){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(a.slice(0).reverse()),this.ctx.closePath()},t.prototype.path=function(a){this.ctx.beginPath(),this.formatPath(a),this.ctx.closePath()},t.prototype.formatPath=function(a){var l=this;a.forEach(function(s,i){var c=Sl(s)?s.start:s;i===0?l.ctx.moveTo(c.x,c.y):l.ctx.lineTo(c.x,c.y),Sl(s)&&l.ctx.bezierCurveTo(s.startControl.x,s.startControl.y,s.endControl.x,s.endControl.y,s.end.x,s.end.y)})},t.prototype.renderRepeat=function(a,l,s,i){this.path(a),this.ctx.fillStyle=l,this.ctx.translate(s,i),this.ctx.fill(),this.ctx.translate(-s,-i)},t.prototype.resizeImage=function(a,l,s){var i;if(a.width===l&&a.height===s)return a;var c=(i=this.canvas.ownerDocument)!==null&&i!==void 0?i:document,p=c.createElement("canvas");p.width=Math.max(1,l),p.height=Math.max(1,s);var f=p.getContext("2d");return f.drawImage(a,0,0,a.width,a.height,0,0,l,s),p},t.prototype.renderBackgroundImage=function(a){return al(this,void 0,void 0,function(){var l,s,i,c,p,f;return Ja(this,function(_){switch(_.label){case 0:l=a.styles.backgroundImage.length-1,s=function(g){var y,v,w,O,Z,ne,j,W,I,k,O,Z,ne,j,W,b,S,$,D,F,B,U,Q,V,I,M,O,L,H,j,W,G,Z,ne,ce,z,ue,ie,J,N,ae,oe;return Ja(this,function(fe){switch(fe.label){case 0:if(g.type!==0)return[3,5];y=void 0,v=g.url,fe.label=1;case 1:return fe.trys.push([1,3,,4]),[4,i.context.cache.match(v)];case 2:return y=fe.sent(),[3,4];case 3:return fe.sent(),i.context.logger.error("Error loading background-image "+v),[3,4];case 4:return y&&(w=Ji(a,l,[y.width,y.height,y.width/y.height]),O=w[0],Z=w[1],ne=w[2],j=w[3],W=w[4],I=i.ctx.createPattern(i.resizeImage(y,j,W),"repeat"),i.renderRepeat(O,I,Z,ne)),[3,6];case 5:U1(g)?(k=Ji(a,l,[null,null,null]),O=k[0],Z=k[1],ne=k[2],j=k[3],W=k[4],b=x1(g.angle,j,W),S=b[0],$=b[1],D=b[2],F=b[3],B=b[4],U=document.createElement("canvas"),U.width=j,U.height=W,Q=U.getContext("2d"),V=Q.createLinearGradient($,F,D,B),pu(g.stops,S).forEach(function(re){return V.addColorStop(re.stop,Ra(re.color))}),Q.fillStyle=V,Q.fillRect(0,0,j,W),j>0&&W>0&&(I=i.ctx.createPattern(U,"repeat"),i.renderRepeat(O,I,Z,ne))):I1(g)&&(M=Ji(a,l,[null,null,null]),O=M[0],L=M[1],H=M[2],j=M[3],W=M[4],G=g.position.length===0?[fd]:g.position,Z=_a(G[0],j),ne=_a(G[G.length-1],W),ce=S1(g,Z,ne,j,W),z=ce[0],ue=ce[1],z>0&&ue>0&&(ie=i.ctx.createRadialGradient(L+Z,H+ne,0,L+Z,H+ne,z),pu(g.stops,z*2).forEach(function(re){return ie.addColorStop(re.stop,Ra(re.color))}),i.path(O),i.ctx.fillStyle=ie,z!==ue?(J=a.bounds.left+.5*a.bounds.width,N=a.bounds.top+.5*a.bounds.height,ae=ue/z,oe=1/ae,i.ctx.save(),i.ctx.translate(J,N),i.ctx.transform(1,0,0,ae,0,0),i.ctx.translate(-J,-N),i.ctx.fillRect(L,oe*(H-N)+N,j,W*oe),i.ctx.restore()):i.ctx.fill())),fe.label=6;case 6:return l--,[2]}})},i=this,c=0,p=a.styles.backgroundImage.slice(0).reverse(),_.label=1;case 1:return c<p.length?(f=p[c],[5,s(f)]):[3,4];case 2:_.sent(),_.label=3;case 3:return c++,[3,1];case 4:return[2]}})})},t.prototype.renderSolidBorder=function(a,l,s){return al(this,void 0,void 0,function(){return Ja(this,function(i){return this.path(Ku(s,l)),this.ctx.fillStyle=Ra(a),this.ctx.fill(),[2]})})},t.prototype.renderDoubleBorder=function(a,l,s,i){return al(this,void 0,void 0,function(){var c,p;return Ja(this,function(f){switch(f.label){case 0:return l<3?[4,this.renderSolidBorder(a,s,i)]:[3,2];case 1:return f.sent(),[2];case 2:return c=Vw(i,s),this.path(c),this.ctx.fillStyle=Ra(a),this.ctx.fill(),p=Tw(i,s),this.path(p),this.ctx.fill(),[2]}})})},t.prototype.renderNodeBackgroundAndBorders=function(a){return al(this,void 0,void 0,function(){var l,s,i,c,p,f,_,g,y=this;return Ja(this,function(v){switch(v.label){case 0:return this.applyEffects(a.getEffects(2)),l=a.container.styles,s=!_s(l.backgroundColor)||l.backgroundImage.length,i=[{style:l.borderTopStyle,color:l.borderTopColor,width:l.borderTopWidth},{style:l.borderRightStyle,color:l.borderRightColor,width:l.borderRightWidth},{style:l.borderBottomStyle,color:l.borderBottomColor,width:l.borderBottomWidth},{style:l.borderLeftStyle,color:l.borderLeftColor,width:l.borderLeftWidth}],c=jw(Ys(l.backgroundClip,0),a.curves),s||l.boxShadow.length?(this.ctx.save(),this.path(c),this.ctx.clip(),_s(l.backgroundColor)||(this.ctx.fillStyle=Ra(l.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(a.container)]):[3,2];case 1:v.sent(),this.ctx.restore(),l.boxShadow.slice(0).reverse().forEach(function(w){y.ctx.save();var k=Ko(a.curves),b=w.inset?0:Kw,S=Qw(k,-b+(w.inset?1:-1)*w.spread.number,(w.inset?1:-1)*w.spread.number,w.spread.number*(w.inset?-2:2),w.spread.number*(w.inset?-2:2));w.inset?(y.path(k),y.ctx.clip(),y.mask(S)):(y.mask(k),y.ctx.clip(),y.path(S)),y.ctx.shadowOffsetX=w.offsetX.number+b,y.ctx.shadowOffsetY=w.offsetY.number,y.ctx.shadowColor=Ra(w.color),y.ctx.shadowBlur=w.blur.number,y.ctx.fillStyle=w.inset?Ra(w.color):"rgba(0,0,0,1)",y.ctx.fill(),y.ctx.restore()}),v.label=2;case 2:p=0,f=0,_=i,v.label=3;case 3:return f<_.length?(g=_[f],g.style!==0&&!_s(g.color)&&g.width>0?g.style!==2?[3,5]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,2)]:[3,11]):[3,13];case 4:return v.sent(),[3,11];case 5:return g.style!==3?[3,7]:[4,this.renderDashedDottedBorder(g.color,g.width,p,a.curves,3)];case 6:return v.sent(),[3,11];case 7:return g.style!==4?[3,9]:[4,this.renderDoubleBorder(g.color,g.width,p,a.curves)];case 8:return v.sent(),[3,11];case 9:return[4,this.renderSolidBorder(g.color,p,a.curves)];case 10:v.sent(),v.label=11;case 11:p++,v.label=12;case 12:return f++,[3,3];case 13:return[2]}})})},t.prototype.renderDashedDottedBorder=function(a,l,s,i,c){return al(this,void 0,void 0,function(){var p,f,_,g,y,v,w,k,b,S,$,D,F,B,U,Q,U,Q;return Ja(this,function(V){return this.ctx.save(),p=Mw(i,s),f=Ku(i,s),c===2&&(this.path(f),this.ctx.clip()),Sl(f[0])?(_=f[0].start.x,g=f[0].start.y):(_=f[0].x,g=f[0].y),Sl(f[1])?(y=f[1].end.x,v=f[1].end.y):(y=f[1].x,v=f[1].y),s===0||s===2?w=Math.abs(_-y):w=Math.abs(g-v),this.ctx.beginPath(),c===3?this.formatPath(p):this.formatPath(f.slice(0,2)),k=l<3?l*3:l*2,b=l<3?l*2:l,c===3&&(k=l,b=l),S=!0,w<=k*2?S=!1:w<=k*2+b?($=w/(2*k+b),k*=$,b*=$):(D=Math.floor((w+b)/(k+b)),F=(w-D*k)/(D-1),B=(w-(D+1)*k)/D,b=B<=0||Math.abs(b-F)<Math.abs(b-B)?F:B),S&&(c===3?this.ctx.setLineDash([0,k+b]):this.ctx.setLineDash([k,b])),c===3?(this.ctx.lineCap="round",this.ctx.lineWidth=l):this.ctx.lineWidth=l*2+1.1,this.ctx.strokeStyle=Ra(a),this.ctx.stroke(),this.ctx.setLineDash([]),c===2&&(Sl(f[0])&&(U=f[3],Q=f[0],this.ctx.beginPath(),this.formatPath([new rt(U.end.x,U.end.y),new rt(Q.start.x,Q.start.y)]),this.ctx.stroke()),Sl(f[1])&&(U=f[1],Q=f[2],this.ctx.beginPath(),this.formatPath([new rt(U.end.x,U.end.y),new rt(Q.start.x,Q.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},t.prototype.render=function(a){return al(this,void 0,void 0,function(){var l;return Ja(this,function(s){switch(s.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ra(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),l=Dw(a),[4,this.renderStack(l)];case 1:return s.sent(),this.applyEffects([]),[2,this.canvas]}})})},t}(wp),zw=function(e){return e instanceof np||e instanceof sp?!0:e instanceof vd&&e.type!==Po&&e.type!==Oo},jw=function(e,t){switch(e){case 0:return Ko(t);case 2:return Fw(t);case 1:default:return Go(t)}},qw=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Yw=["-apple-system","system-ui"],Ww=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(t){return Yw.indexOf(t)===-1}):e},Jw=function(e){Rl(t,e);function t(a,l){var s=e.call(this,a,l)||this;return s.canvas=l.canvas?l.canvas:document.createElement("canvas"),s.ctx=s.canvas.getContext("2d"),s.options=l,s.canvas.width=Math.floor(l.width*l.scale),s.canvas.height=Math.floor(l.height*l.scale),s.canvas.style.width=l.width+"px",s.canvas.style.height=l.height+"px",s.ctx.scale(s.options.scale,s.options.scale),s.ctx.translate(-l.x,-l.y),s.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+l.width+"x"+l.height+" at "+l.x+","+l.y+") with scale "+l.scale),s}return t.prototype.render=function(a){return al(this,void 0,void 0,function(){var l,s;return Ja(this,function(i){switch(i.label){case 0:return l=Qr(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,a),[4,Xw(l)];case 1:return s=i.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ra(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(s,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},t}(wp),Xw=function(e){return new Promise(function(t,a){var l=new Image;l.onload=function(){t(l)},l.onerror=a,l.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},Zw=function(){function e(t){var a=t.id,l=t.enabled;this.id=a,this.enabled=l,this.start=Date.now()}return e.prototype.debug=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,qn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.getTime=function(){return Date.now()-this.start},e.prototype.info=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,qn([this.id,this.getTime()+"ms"],t))},e.prototype.warn=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,qn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.prototype.error=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,qn([this.id,this.getTime()+"ms"],t)):this.info.apply(this,t))},e.instances={},e}(),eC=function(){function e(t,a){var l;this.windowBounds=a,this.instanceName="#"+e.instanceCount++,this.logger=new Zw({id:this.instanceName,enabled:t.logging}),this.cache=(l=t.cache)!==null&&l!==void 0?l:new yw(this,t)}return e.instanceCount=1,e}(),tC=function(e,t){return t===void 0&&(t={}),aC(e,t)};typeof window<"u"&&hp.setContext(window);var aC=function(e,t){return al(void 0,void 0,void 0,function(){var a,l,s,i,c,p,f,_,g,y,v,w,k,b,S,$,D,F,B,U,V,Q,V,I,M,O,L,H,j,W,G,Z,ne,ce,z,ue,ie,J,N,ae;return Ja(this,function(oe){switch(oe.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(a=e.ownerDocument,!a)throw new Error("Element is not attached to a Document");if(l=a.defaultView,!l)throw new Error("Document is not attached to a Window");return s={allowTaint:(I=t.allowTaint)!==null&&I!==void 0?I:!1,imageTimeout:(M=t.imageTimeout)!==null&&M!==void 0?M:15e3,proxy:t.proxy,useCORS:(O=t.useCORS)!==null&&O!==void 0?O:!1},i=vr({logging:(L=t.logging)!==null&&L!==void 0?L:!0,cache:t.cache},s),c={windowWidth:(H=t.windowWidth)!==null&&H!==void 0?H:l.innerWidth,windowHeight:(j=t.windowHeight)!==null&&j!==void 0?j:l.innerHeight,scrollX:(W=t.scrollX)!==null&&W!==void 0?W:l.pageXOffset,scrollY:(G=t.scrollY)!==null&&G!==void 0?G:l.pageYOffset},p=new ss(c.scrollX,c.scrollY,c.windowWidth,c.windowHeight),f=new eC(i,p),_=(Z=t.foreignObjectRendering)!==null&&Z!==void 0?Z:!1,g={allowTaint:(ne=t.allowTaint)!==null&&ne!==void 0?ne:!1,onclone:t.onclone,ignoreElements:t.ignoreElements,inlineImages:_,copyStyles:_},f.logger.debug("Starting document clone with size "+p.width+"x"+p.height+" scrolled to "+-p.left+","+-p.top),y=new Pu(f,e,g),v=y.clonedReferenceElement,v?[4,y.toIFrame(a,p)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return w=oe.sent(),k=gd(v)||lw(v)?Qg(v.ownerDocument):pi(f,v),b=k.width,S=k.height,$=k.left,D=k.top,F=lC(f,v,t.backgroundColor),B={canvas:t.canvas,backgroundColor:F,scale:(z=(ce=t.scale)!==null&&ce!==void 0?ce:l.devicePixelRatio)!==null&&z!==void 0?z:1,x:((ue=t.x)!==null&&ue!==void 0?ue:0)+$,y:((ie=t.y)!==null&&ie!==void 0?ie:0)+D,width:(J=t.width)!==null&&J!==void 0?J:Math.ceil(b),height:(N=t.height)!==null&&N!==void 0?N:Math.ceil(S)},_?(f.logger.debug("Document cloned, using foreign object rendering"),V=new Jw(f,B),[4,V.render(v)]):[3,3];case 2:return U=oe.sent(),[3,5];case 3:return f.logger.debug("Document cloned, element located at "+$+","+D+" with size "+b+"x"+S+" using computed rendering"),f.logger.debug("Starting DOM parsing"),Q=rp(f,v),F===Q.styles.backgroundColor&&(Q.styles.backgroundColor=es.TRANSPARENT),f.logger.debug("Starting renderer for element at "+B.x+","+B.y+" with size "+B.width+"x"+B.height),V=new Gw(f,B),[4,V.render(Q)];case 4:U=oe.sent(),oe.label=5;case 5:return(!((ae=t.removeContainer)!==null&&ae!==void 0)||ae)&&(Pu.destroy(w)||f.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),f.logger.debug("Finished rendering"),[2,U]}})})},lC=function(e,t,a){var l=t.ownerDocument,s=l.documentElement?$n(e,getComputedStyle(l.documentElement).backgroundColor):es.TRANSPARENT,i=l.body?$n(e,getComputedStyle(l.body).backgroundColor):es.TRANSPARENT,c=typeof a=="string"?$n(e,a):a===null?es.TRANSPARENT:4294967295;return t===l.documentElement?_s(s)?_s(i)?c:i:s:c};const Sa={__name:"Screenshot",props:{targetRef:{type:[Object,null],required:!1},size:{type:String,default:"small"}},setup(e){const t=()=>{a.targetRef&&tC(a.targetRef,{useCORS:!0,scale:2,backgroundColor:null,scrollY:-window.scrollY}).then(s=>{const i=document.createElement("a");i.download="chart-screenshot.png",i.href=s.toDataURL(),i.click()})},a=e;return(l,s)=>(r(),E(at,{tag:"button",onClick:t,size:e.size,title:l.$t("Screenshot")},{default:d(()=>[n(Y,{name:"Screenshot"})]),_:1},8,["size","title"]))}};var Xi={exports:{}};/** @license | |
| 23 | 23 | * |
| 24 | 24 | * Colour Palette Generator script. |
| 25 | 25 | * Copyright (c) 2014 Google Inc. |
| 26 | 26 | * |
| @@ -96,16 +96,15 @@ | ||
| 96 | 96 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 97 | 97 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 98 | 98 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 99 | 99 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 100 | - */var Uu;function ww(){return Uu||(Uu=1,function(e){var t=function(){var a=Array.prototype,l=function(_,g,y){return a.slice.apply(_,a.slice.call(arguments,1))},s="function",i=1e9,c=function(_,g,y,v){if(g|=0,g==0)return[];if(typeof _!==s){var C=c.listSchemes(_,g);if(!C.length)return null;_=C[(y||0)%C.length]}var b=l(arguments,2);return b[0]=g,_.apply(_,b)};c.Scheme=function(_,g){var y={},v=0,C=i,b=function(){if(arguments.length<=1)return w.color_func.bind(w);var x=l(arguments);return function(F){return x[0]=F,w.color_func.apply(w,x)}},w=function(x,F){if(x|=0,!x)return[];var L=x;if(x=Math.abs(x),x<=v){for(var U=Math.max(x,C);!(U in y);++U);var S=y[U];if(U>x){var M="shrinking_takes_head"in S?S.shrinking_takes_head:w.shrinking_takes_head;if(M)S=S.slice(0,x),U=x;else return c.generate(function(I){return S[Math.round(I)]},L,0,S.length-1)}return S=S.slice(),L<0&&S.reverse(),S}else return w.color_func?c.generate(b.apply(w,arguments),L,0,1,w.color_func_cyclic):null};return w.scheme_name=_,w.groups=g?typeof g=="string"?[g]:g:[],w.max=0,w.cbf_max=i,w.addPalette=function(x,F){var L=x.length;L&&(y[L]=x,C=Math.min(C,L),v=Math.max(v,L),w.max=Math.max(w.max,L),!F&&L!=1&&(w.cbf_max=Math.min(w.cbf_max,L-1)))},w.addPalettes=function(x,F,L){F=F||x.length;for(var U=0;U<F;++U)U in x&&w.addPalette(x[U],!0);w.cbf_max=Math.min(w.cbf_max,L||1)},w.shrinkByTakingHead=function(x,F){F!==void 0?F in y&&(y[F].shrinking_takes_head=!!x):w.shrinking_takes_head=!!x},w.setColorFunction=function(x,F,L){w.color_func=x,w.color_func_cyclic=!!L,w.max=i,!F&&w.cbf_max===i&&(w.cbf_max=1)},w.color=function(x,F){return w.color_func?w.color_func.apply(this,arguments):null},w},c.Scheme.fromPalettes=function(_,g,y,v,C){var b=c.Scheme(_,g);return b.addPalettes.apply(b,l(arguments,2)),b},c.Scheme.withColorFunction=function(_,g,y,v,C){var b=c.Scheme(_,g);return b.setColorFunction.apply(b,l(arguments,2)),b};var p={};c.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(g){(p["g-"+g]=p["g-"+g]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},c.listSchemes=function(_,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof _=="string"?[_]:_).forEach(function(v){var C=v.substring(v.length-4)==="-cbf";C&&(v=v.substring(0,v.length-4));for(var b=p["g-"+v]||p["n-"+v]||[],w=0,x;x=b[w];++w)(C?x.cbf:x.max)>=g&&y.push(x)}),y.sort(function(v,C){return v.scheme_name>=C.scheme_name?v.scheme_name>C.scheme_name?1:0:-1}),y},c.generate=function(_,g,y,v,C){if(Math.abs(g)<1)return[];if(y=y===void 0?0:y,v=v===void 0?1:v,Math.abs(g)<2)return[_(y)];for(var b=Math.abs(g),w=y,x=[],F=(v-y)/(C?b:b-1);--b>=0;w+=F)x.push(_(w));return g<0&&x.reverse(),x};var m=function(_){return _>0?_<1?_:1:0};return c.rgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=Number(Math.round(m(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.linearRgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=m(v),v<=.0031308?v=12.92*v:v=1.055*Math.pow(v,.4166666666666667)-.055,v=Number(Math.round(v*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:m(g),C=y===void 0?1:m(y),b=C*(1-v*Math.abs(_%2-1)),w=C*(1-v);switch(Math.floor(_)%6){case 0:return c.rgbColor(C,b,w);case 1:return c.rgbColor(b,C,w);case 2:return c.rgbColor(w,C,b);case 3:return c.rgbColor(w,b,C);case 4:return c.rgbColor(b,w,C);default:return c.rgbColor(C,w,b)}},c.register(c.Scheme.withColorFunction("rainbow","qualitative",c.hsvColor,!1,!0)),c}();t.ColorFunction,t.Palette,t.PalettesList,t.SchemeType,function(){var a=t.Scheme.fromPalettes("mpn65","qualitative",[["ff0029","377eb8","66a61e","984ea3","00d2d5","ff7f00","af8d00","7f80cd","b3e900","c42e60","a65628","f781bf","8dd3c7","bebada","fb8072","80b1d3","fdb462","fccde5","bc80bd","ffed6f","c4eaff","cf8c00","1b9e77","d95f02","e7298a","e6ab02","a6761d","0097ff","00d067","000000","252525","525252","737373","969696","bdbdbd","f43600","4ba93b","5779bb","927acc","97ee3f","bf3947","9f5b00","f48758","8caed6","f2b94f","eff26e","e43872","d9b100","9d7a00","698cff","d9d9d9","00d27e","d06800","009f82","c49200","cbe8ff","fecddf","c27eb6","8cd2ce","c4b8d9","f883b0","a49100","f48800","27d0df","a04a9b"]]);a.shrinkByTakingHead(!0),t.register(a)}(),function(){var a=t.rgbColor,l=function(i,c){for(var p=arguments.length-1,m=arguments[p];p>1;)m=m*i+arguments[--p];return m},s=function(i){var c=l(Math.abs(i),1,.278393,.230389,972e-6,.078108);return c*=c,c*=c,c=1-1/c,i<0?-c:c};t.register(t.Scheme.fromPalettes("tol","qualitative",[["4477aa"],["4477aa","cc6677"],["4477aa","ddcc77","cc6677"],["4477aa","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","882255","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","aa4466","882255","aa4499"]],12,12)),t.tolSequentialColor=function(i){return a(1-.392*(1+s((i-.869)/.255)),1.021-.456*(1+s((i-.527)/.376)),1-.493*(1+s((i-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(i){var c=l(i,.572,1.524,-1.811)/l(i,1,-.291,.1574);return a(l(i,.235,-2.13,26.92,-65.5,63.5,-22.36),c*c,1/l(i,1.579,-4.03,12.92,-31.4,48.6,-23.36))},t.register(t.Scheme.withColorFunction("tol-dv","diverging",t.tolDivergingColor,!0)),t.tolRainbowColor=function(i){return a(l(i,.472,-.567,4.05)/l(i,1,8.72,-19.17,14.1),l(i,.108932,-1.22635,27.284,-98.577,163.3,-131.395,40.634),1/l(i,1.97,3.54,-68.5,243,-297,125))},t.register(t.Scheme.withColorFunction("tol-rainbow","qualitative",t.tolRainbowColor,!0))}(),function(){t.register(t.Scheme.fromPalettes("sol-base","sequential",[["002b36","073642","586e75","657b83","839496","93a1a1","eee8d5","fdf6e3"]],1,8)),t.register(t.Scheme.fromPalettes("sol-accent","qualitative",[["b58900","cb4b16","dc322f","d33682","6c71c4","268bd2","2aa198","859900"]]))}(),function(){var a={YlGn:{type:"sequential",cbf:42,3:["f7fcb9","addd8e","31a354"],4:["ffffcc","c2e699","78c679","238443"],5:["ffffcc","c2e699","78c679","31a354","006837"],6:["ffffcc","d9f0a3","addd8e","78c679","31a354","006837"],7:["ffffcc","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],8:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],9:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","006837","004529"]},YlGnBu:{type:"sequential",cbf:42,3:["edf8b1","7fcdbb","2c7fb8"],4:["ffffcc","a1dab4","41b6c4","225ea8"],5:["ffffcc","a1dab4","41b6c4","2c7fb8","253494"],6:["ffffcc","c7e9b4","7fcdbb","41b6c4","2c7fb8","253494"],7:["ffffcc","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],8:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],9:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","253494","081d58"]},GnBu:{type:"sequential",cbf:42,3:["e0f3db","a8ddb5","43a2ca"],4:["f0f9e8","bae4bc","7bccc4","2b8cbe"],5:["f0f9e8","bae4bc","7bccc4","43a2ca","0868ac"],6:["f0f9e8","ccebc5","a8ddb5","7bccc4","43a2ca","0868ac"],7:["f0f9e8","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],8:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],9:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","0868ac","084081"]},BuGn:{type:"sequential",cbf:42,3:["e5f5f9","99d8c9","2ca25f"],4:["edf8fb","b2e2e2","66c2a4","238b45"],5:["edf8fb","b2e2e2","66c2a4","2ca25f","006d2c"],6:["edf8fb","ccece6","99d8c9","66c2a4","2ca25f","006d2c"],7:["edf8fb","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],8:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],9:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","006d2c","00441b"]},PuBuGn:{type:"sequential",cbf:42,3:["ece2f0","a6bddb","1c9099"],4:["f6eff7","bdc9e1","67a9cf","02818a"],5:["f6eff7","bdc9e1","67a9cf","1c9099","016c59"],6:["f6eff7","d0d1e6","a6bddb","67a9cf","1c9099","016c59"],7:["f6eff7","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],8:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],9:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016c59","014636"]},PuBu:{type:"sequential",cbf:42,3:["ece7f2","a6bddb","2b8cbe"],4:["f1eef6","bdc9e1","74a9cf","0570b0"],5:["f1eef6","bdc9e1","74a9cf","2b8cbe","045a8d"],6:["f1eef6","d0d1e6","a6bddb","74a9cf","2b8cbe","045a8d"],7:["f1eef6","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],8:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],9:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","045a8d","023858"]},BuPu:{type:"sequential",cbf:42,3:["e0ecf4","9ebcda","8856a7"],4:["edf8fb","b3cde3","8c96c6","88419d"],5:["edf8fb","b3cde3","8c96c6","8856a7","810f7c"],6:["edf8fb","bfd3e6","9ebcda","8c96c6","8856a7","810f7c"],7:["edf8fb","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],8:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],9:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","810f7c","4d004b"]},RdPu:{type:"sequential",cbf:42,3:["fde0dd","fa9fb5","c51b8a"],4:["feebe2","fbb4b9","f768a1","ae017e"],5:["feebe2","fbb4b9","f768a1","c51b8a","7a0177"],6:["feebe2","fcc5c0","fa9fb5","f768a1","c51b8a","7a0177"],7:["feebe2","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],8:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],9:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177","49006a"]},PuRd:{type:"sequential",cbf:42,3:["e7e1ef","c994c7","dd1c77"],4:["f1eef6","d7b5d8","df65b0","ce1256"],5:["f1eef6","d7b5d8","df65b0","dd1c77","980043"],6:["f1eef6","d4b9da","c994c7","df65b0","dd1c77","980043"],7:["f1eef6","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],8:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],9:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","980043","67001f"]},OrRd:{type:"sequential",cbf:42,3:["fee8c8","fdbb84","e34a33"],4:["fef0d9","fdcc8a","fc8d59","d7301f"],5:["fef0d9","fdcc8a","fc8d59","e34a33","b30000"],6:["fef0d9","fdd49e","fdbb84","fc8d59","e34a33","b30000"],7:["fef0d9","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],8:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],9:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","b30000","7f0000"]},YlOrRd:{type:"sequential",cbf:42,3:["ffeda0","feb24c","f03b20"],4:["ffffb2","fecc5c","fd8d3c","e31a1c"],5:["ffffb2","fecc5c","fd8d3c","f03b20","bd0026"],6:["ffffb2","fed976","feb24c","fd8d3c","f03b20","bd0026"],7:["ffffb2","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],8:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],9:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","bd0026","800026"]},YlOrBr:{type:"sequential",cbf:42,3:["fff7bc","fec44f","d95f0e"],4:["ffffd4","fed98e","fe9929","cc4c02"],5:["ffffd4","fed98e","fe9929","d95f0e","993404"],6:["ffffd4","fee391","fec44f","fe9929","d95f0e","993404"],7:["ffffd4","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],8:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],9:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","993404","662506"]},Purples:{type:"sequential",cbf:42,3:["efedf5","bcbddc","756bb1"],4:["f2f0f7","cbc9e2","9e9ac8","6a51a3"],5:["f2f0f7","cbc9e2","9e9ac8","756bb1","54278f"],6:["f2f0f7","dadaeb","bcbddc","9e9ac8","756bb1","54278f"],7:["f2f0f7","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],8:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],9:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","54278f","3f007d"]},Blues:{type:"sequential",cbf:42,3:["deebf7","9ecae1","3182bd"],4:["eff3ff","bdd7e7","6baed6","2171b5"],5:["eff3ff","bdd7e7","6baed6","3182bd","08519c"],6:["eff3ff","c6dbef","9ecae1","6baed6","3182bd","08519c"],7:["eff3ff","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],8:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],9:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","08519c","08306b"]},Greens:{type:"sequential",cbf:42,3:["e5f5e0","a1d99b","31a354"],4:["edf8e9","bae4b3","74c476","238b45"],5:["edf8e9","bae4b3","74c476","31a354","006d2c"],6:["edf8e9","c7e9c0","a1d99b","74c476","31a354","006d2c"],7:["edf8e9","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],8:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],9:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","006d2c","00441b"]},Oranges:{type:"sequential",cbf:42,3:["fee6ce","fdae6b","e6550d"],4:["feedde","fdbe85","fd8d3c","d94701"],5:["feedde","fdbe85","fd8d3c","e6550d","a63603"],6:["feedde","fdd0a2","fdae6b","fd8d3c","e6550d","a63603"],7:["feedde","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],8:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],9:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","a63603","7f2704"]},Reds:{type:"sequential",cbf:42,3:["fee0d2","fc9272","de2d26"],4:["fee5d9","fcae91","fb6a4a","cb181d"],5:["fee5d9","fcae91","fb6a4a","de2d26","a50f15"],6:["fee5d9","fcbba1","fc9272","fb6a4a","de2d26","a50f15"],7:["fee5d9","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],8:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],9:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","a50f15","67000d"]},Greys:{type:"sequential",cbf:42,3:["f0f0f0","bdbdbd","636363"],4:["f7f7f7","cccccc","969696","525252"],5:["f7f7f7","cccccc","969696","636363","252525"],6:["f7f7f7","d9d9d9","bdbdbd","969696","636363","252525"],7:["f7f7f7","d9d9d9","bdbdbd","969696","737373","525252","252525"],8:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525"],9:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525","000000"]},PuOr:{type:"diverging",cbf:42,3:["f1a340","f7f7f7","998ec3"],4:["e66101","fdb863","b2abd2","5e3c99"],5:["e66101","fdb863","f7f7f7","b2abd2","5e3c99"],6:["b35806","f1a340","fee0b6","d8daeb","998ec3","542788"],7:["b35806","f1a340","fee0b6","f7f7f7","d8daeb","998ec3","542788"],8:["b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788"],9:["b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788"],10:["7f3b08","b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788","2d004b"],11:["7f3b08","b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788","2d004b"]},BrBG:{type:"diverging",cbf:42,3:["d8b365","f5f5f5","5ab4ac"],4:["a6611a","dfc27d","80cdc1","018571"],5:["a6611a","dfc27d","f5f5f5","80cdc1","018571"],6:["8c510a","d8b365","f6e8c3","c7eae5","5ab4ac","01665e"],7:["8c510a","d8b365","f6e8c3","f5f5f5","c7eae5","5ab4ac","01665e"],8:["8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e"],9:["8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e"],10:["543005","8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e","003c30"],11:["543005","8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e","003c30"]},PRGn:{type:"diverging",cbf:42,3:["af8dc3","f7f7f7","7fbf7b"],4:["7b3294","c2a5cf","a6dba0","008837"],5:["7b3294","c2a5cf","f7f7f7","a6dba0","008837"],6:["762a83","af8dc3","e7d4e8","d9f0d3","7fbf7b","1b7837"],7:["762a83","af8dc3","e7d4e8","f7f7f7","d9f0d3","7fbf7b","1b7837"],8:["762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837"],9:["762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837"],10:["40004b","762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837","00441b"],11:["40004b","762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837","00441b"]},PiYG:{type:"diverging",cbf:42,3:["e9a3c9","f7f7f7","a1d76a"],4:["d01c8b","f1b6da","b8e186","4dac26"],5:["d01c8b","f1b6da","f7f7f7","b8e186","4dac26"],6:["c51b7d","e9a3c9","fde0ef","e6f5d0","a1d76a","4d9221"],7:["c51b7d","e9a3c9","fde0ef","f7f7f7","e6f5d0","a1d76a","4d9221"],8:["c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221"],9:["c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221"],10:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221","276419"],11:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221","276419"]},RdBu:{type:"diverging",cbf:42,3:["ef8a62","f7f7f7","67a9cf"],4:["ca0020","f4a582","92c5de","0571b0"],5:["ca0020","f4a582","f7f7f7","92c5de","0571b0"],6:["b2182b","ef8a62","fddbc7","d1e5f0","67a9cf","2166ac"],7:["b2182b","ef8a62","fddbc7","f7f7f7","d1e5f0","67a9cf","2166ac"],8:["b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac"],9:["b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac","053061"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac","053061"]},RdGy:{type:"diverging",cbf:42,3:["ef8a62","ffffff","999999"],4:["ca0020","f4a582","bababa","404040"],5:["ca0020","f4a582","ffffff","bababa","404040"],6:["b2182b","ef8a62","fddbc7","e0e0e0","999999","4d4d4d"],7:["b2182b","ef8a62","fddbc7","ffffff","e0e0e0","999999","4d4d4d"],8:["b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d"],9:["b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d","1a1a1a"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d","1a1a1a"]},RdYlBu:{type:"diverging",cbf:42,3:["fc8d59","ffffbf","91bfdb"],4:["d7191c","fdae61","abd9e9","2c7bb6"],5:["d7191c","fdae61","ffffbf","abd9e9","2c7bb6"],6:["d73027","fc8d59","fee090","e0f3f8","91bfdb","4575b4"],7:["d73027","fc8d59","fee090","ffffbf","e0f3f8","91bfdb","4575b4"],8:["d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4"],9:["d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4"],10:["a50026","d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4","313695"],11:["a50026","d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4","313695"]},Spectral:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","99d594"],4:["d7191c","fdae61","abdda4","2b83ba"],5:["d7191c","fdae61","ffffbf","abdda4","2b83ba"],6:["d53e4f","fc8d59","fee08b","e6f598","99d594","3288bd"],7:["d53e4f","fc8d59","fee08b","ffffbf","e6f598","99d594","3288bd"],8:["d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd"],9:["d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd"],10:["9e0142","d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd","5e4fa2"],11:["9e0142","d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd","5e4fa2"]},RdYlGn:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","91cf60"],4:["d7191c","fdae61","a6d96a","1a9641"],5:["d7191c","fdae61","ffffbf","a6d96a","1a9641"],6:["d73027","fc8d59","fee08b","d9ef8b","91cf60","1a9850"],7:["d73027","fc8d59","fee08b","ffffbf","d9ef8b","91cf60","1a9850"],8:["d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850"],9:["d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850"],10:["a50026","d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850","006837"],11:["a50026","d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850","006837"]},Accent:{type:"qualitative",cbf:0,3:["7fc97f","beaed4","fdc086"],4:["7fc97f","beaed4","fdc086","ffff99"],5:["7fc97f","beaed4","fdc086","ffff99","386cb0"],6:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f"],7:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17"],8:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17","666666"]},Dark2:{type:"qualitative",cbf:3,3:["1b9e77","d95f02","7570b3"],4:["1b9e77","d95f02","7570b3","e7298a"],5:["1b9e77","d95f02","7570b3","e7298a","66a61e"],6:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02"],7:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d"],8:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d","666666"]},Paired:{type:"qualitative",cbf:4,3:["a6cee3","1f78b4","b2df8a"],4:["a6cee3","1f78b4","b2df8a","33a02c"],5:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99"],6:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c"],7:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f"],8:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00"],9:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6"],10:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a"],11:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99"],12:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99","b15928"]},Pastel1:{type:"qualitative",cbf:0,3:["fbb4ae","b3cde3","ccebc5"],4:["fbb4ae","b3cde3","ccebc5","decbe4"],5:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6"],6:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc"],7:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd"],8:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec"],9:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec","f2f2f2"]},Pastel2:{type:"qualitative",cbf:0,3:["b3e2cd","fdcdac","cbd5e8"],4:["b3e2cd","fdcdac","cbd5e8","f4cae4"],5:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9"],6:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae"],7:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc"],8:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc","cccccc"]},Set1:{type:"qualitative",cbf:0,3:["e41a1c","377eb8","4daf4a"],4:["e41a1c","377eb8","4daf4a","984ea3"],5:["e41a1c","377eb8","4daf4a","984ea3","ff7f00"],6:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33"],7:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628"],8:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf"],9:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf","999999"]},Set2:{type:"qualitative",cbf:3,3:["66c2a5","fc8d62","8da0cb"],4:["66c2a5","fc8d62","8da0cb","e78ac3"],5:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854"],6:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f"],7:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494"],8:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494","b3b3b3"]},Set3:{type:"qualitative",cbf:0,3:["8dd3c7","ffffb3","bebada"],4:["8dd3c7","ffffb3","bebada","fb8072"],5:["8dd3c7","ffffb3","bebada","fb8072","80b1d3"],6:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462"],7:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69"],8:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5"],9:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9"],10:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd"],11:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5"],12:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5","ffed6f"]}};for(var l in a){var s=a[l];s=t.Scheme.fromPalettes("cb-"+l,[s.type,"cb-"+s.type],s,12,s.cbf),t.register(s)}}(),e.exports&&(e.exports=t)}(Ni)),Ni.exports}ww();class Cw extends sl{constructor(){super(...arguments);Oe(this,"data",{dashboard:[{name:"sales_growth_chart",type:"line"}],order:[{name:"gross_sale_by_day_chart",type:""},{name:"order_completion_time_chart",type:""},{name:"item_count_distribution_chart",type:""},{name:"gross_sale_by_hour_chart",type:""},{name:"order_value_distribution_chart",type:""},{name:"avg_order_gross_chart",type:""},{name:"avg_order_items_chart",type:""},{name:"order_chart",type:""}],revenue:[{name:"revenue_chart",type:"line"}],refund:[{name:"refund_chart",type:"line"}],subscription:[{name:"subscription_chart",type:"line"},{name:"retention_chart",type:"line"},{name:"daily_signups_chart",type:"line"}],product:[{name:"product_chart",type:"bar"}]});Oe(this,"storageKey","chart-type");Oe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Lt.get(this.storageKey);this.data.dashboard=a.dashboard??this.data.dashboard,this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund,this.data.subscription=a.subscription??this.data.subscription}addListener(a,l){this.listeners[a]=l}async onChange(a,l,s){const c=this.data[a].findIndex(p=>p.name===l);c!==-1?this.data[a][c].type=s:this.data[a].push({name:l,type:s}),this.syncStorage();for(let p in this.listeners)this.listeners[p](this.applicableFilters)}getChartType(a,l){const i=this.data[a].find(c=>c.name===l);return i?i.type:null}syncStorage(){Lt.set(this.storageKey,this.applicableFilters.chartType)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{chartType:{dashboard:this.data.dashboard,order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,subscription:this.data.subscription}}}}const va=Cw.init();function Es(e){const t=at(e[0]).format("MMMM D, YYYY"),a=at(e[1]).format("MMMM D, YYYY");return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Us(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Ha[parseInt(l)-1]} ${s}`}else if(t.length===2){const[a,l]=t;return`${Ha[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function Ql(e){return e.map(t=>Us(t.group))}const Ra=Te.colors.report,Bw={[Ra.light_gray]:Ra.cyan_blue,[Ra.light_gray_cyan_blue]:Ra.cyan_blue_dark,[Ra.blue]:Ra.royal_blue,[Ra.royal_blue]:Ra.dark_blue,[Ra.medium_slate_blue]:Ra.dark_purple,[Ra.dark_cyan_blue_16]:Ra.dark_cyan_blue_40,[Ra.dark_cyan_blue_24]:Ra.dark_cyan_blue_40,[Ra.blue]:Ra.blue_dark_mode,[Ra.purple]:Ra.purple_dark_mode};function za(e){return Bw[e]}function dl(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const kw={class:"fct-gross-sale-vs-net-revenue-wrap"},xw={class:"fct-btn-group sm"},Sw={__name:"SalesGrowthChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(null);V("daily");const i=V(va.getChartType("order","sales_growth_chart")||"line"),c=Te.colors.report,p=V(Te.isDark()),m=K(()=>a.chartData.every(U=>U.orders===0)),_=K(()=>p.value?c.dark_cyan_blue_16:c.light_gray),g=K(()=>p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue),y=K(()=>[{title:u("Orders"),key:"orders",color:_.value,yAxisIndex:1},{title:u("Revenue"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:U,key:S,color:M,yAxisIndex:I})=>F(U,i.value,a.chartData.map(T=>T[S]),M,I)));Ha.map(U=>U.slice(0,3));const v=K(()=>Ql(a.chartData));let C=null;const b=()=>{C&&(C.dispose(),C=null),Se(()=>{l.value&&(C=Jt(l.value),x())})},w=K(()=>dl(a.chartData.length)),x=()=>{if(!C)return;p.value=Te.isDark();const U={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:S=>{let M=S[0].name;return S.forEach(I=>{const T=I.seriesIndex===1?`${Je.scaled(I.value)}`:I.value,Q=p.value?"#ffffff":"#565865";M+=`<div> | |
| 101 | - ${I.marker} | |
| 102 | - <span style="color: ${Q};">${I.seriesName}</span> | |
| 103 | - <span style="float: right; margin-left: 20px; color: ${Q};"> | |
| 104 | - ${T} | |
| 100 | + */var zu;function sC(){return zu||(zu=1,function(e){var t=function(){var a=Array.prototype,l=function(_,g,y){return a.slice.apply(_,a.slice.call(arguments,1))},s="function",i=1e9,c=function(_,g,y,v){if(g|=0,g==0)return[];if(typeof _!==s){var w=c.listSchemes(_,g);if(!w.length)return null;_=w[(y||0)%w.length]}var k=l(arguments,2);return k[0]=g,_.apply(_,k)};c.Scheme=function(_,g){var y={},v=0,w=i,k=function(){if(arguments.length<=1)return b.color_func.bind(b);var S=l(arguments);return function($){return S[0]=$,b.color_func.apply(b,S)}},b=function(S,$){if(S|=0,!S)return[];var D=S;if(S=Math.abs(S),S<=v){for(var F=Math.max(S,w);!(F in y);++F);var B=y[F];if(F>S){var U="shrinking_takes_head"in B?B.shrinking_takes_head:b.shrinking_takes_head;if(U)B=B.slice(0,S),F=S;else return c.generate(function(Q){return B[Math.round(Q)]},D,0,B.length-1)}return B=B.slice(),D<0&&B.reverse(),B}else return b.color_func?c.generate(k.apply(b,arguments),D,0,1,b.color_func_cyclic):null};return b.scheme_name=_,b.groups=g?typeof g=="string"?[g]:g:[],b.max=0,b.cbf_max=i,b.addPalette=function(S,$){var D=S.length;D&&(y[D]=S,w=Math.min(w,D),v=Math.max(v,D),b.max=Math.max(b.max,D),!$&&D!=1&&(b.cbf_max=Math.min(b.cbf_max,D-1)))},b.addPalettes=function(S,$,D){$=$||S.length;for(var F=0;F<$;++F)F in S&&b.addPalette(S[F],!0);b.cbf_max=Math.min(b.cbf_max,D||1)},b.shrinkByTakingHead=function(S,$){$!==void 0?$ in y&&(y[$].shrinking_takes_head=!!S):b.shrinking_takes_head=!!S},b.setColorFunction=function(S,$,D){b.color_func=S,b.color_func_cyclic=!!D,b.max=i,!$&&b.cbf_max===i&&(b.cbf_max=1)},b.color=function(S,$){return b.color_func?b.color_func.apply(this,arguments):null},b},c.Scheme.fromPalettes=function(_,g,y,v,w){var k=c.Scheme(_,g);return k.addPalettes.apply(k,l(arguments,2)),k},c.Scheme.withColorFunction=function(_,g,y,v,w){var k=c.Scheme(_,g);return k.setColorFunction.apply(k,l(arguments,2)),k};var p={};c.register=function(_){p["n-"+_.scheme_name]=[_],_.groups.forEach(function(g){(p["g-"+g]=p["g-"+g]||[]).push(_)}),(p["g-all"]=p["g-all"]||[]).push(_)},c.listSchemes=function(_,g){g?g<0&&(g=-g):g=2;var y=[];return(typeof _=="string"?[_]:_).forEach(function(v){var w=v.substring(v.length-4)==="-cbf";w&&(v=v.substring(0,v.length-4));for(var k=p["g-"+v]||p["n-"+v]||[],b=0,S;S=k[b];++b)(w?S.cbf:S.max)>=g&&y.push(S)}),y.sort(function(v,w){return v.scheme_name>=w.scheme_name?v.scheme_name>w.scheme_name?1:0:-1}),y},c.generate=function(_,g,y,v,w){if(Math.abs(g)<1)return[];if(y=y===void 0?0:y,v=v===void 0?1:v,Math.abs(g)<2)return[_(y)];for(var k=Math.abs(g),b=y,S=[],$=(v-y)/(w?k:k-1);--k>=0;b+=$)S.push(_(b));return g<0&&S.reverse(),S};var f=function(_){return _>0?_<1?_:1:0};return c.rgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=Number(Math.round(f(v)*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.linearRgbColor=function(_,g,y){return[_,g,y].map(function(v){return v=f(v),v<=.0031308?v=12.92*v:v=1.055*Math.pow(v,.4166666666666667)-.055,v=Number(Math.round(v*255)).toString(16),v.length==1?"0"+v:v}).join("")},c.hsvColor=function(_,g,y){_*=6;var v=g===void 0?1:f(g),w=y===void 0?1:f(y),k=w*(1-v*Math.abs(_%2-1)),b=w*(1-v);switch(Math.floor(_)%6){case 0:return c.rgbColor(w,k,b);case 1:return c.rgbColor(k,w,b);case 2:return c.rgbColor(b,w,k);case 3:return c.rgbColor(b,k,w);case 4:return c.rgbColor(k,b,w);default:return c.rgbColor(w,b,k)}},c.register(c.Scheme.withColorFunction("rainbow","qualitative",c.hsvColor,!1,!0)),c}();t.ColorFunction,t.Palette,t.PalettesList,t.SchemeType,function(){var a=t.Scheme.fromPalettes("mpn65","qualitative",[["ff0029","377eb8","66a61e","984ea3","00d2d5","ff7f00","af8d00","7f80cd","b3e900","c42e60","a65628","f781bf","8dd3c7","bebada","fb8072","80b1d3","fdb462","fccde5","bc80bd","ffed6f","c4eaff","cf8c00","1b9e77","d95f02","e7298a","e6ab02","a6761d","0097ff","00d067","000000","252525","525252","737373","969696","bdbdbd","f43600","4ba93b","5779bb","927acc","97ee3f","bf3947","9f5b00","f48758","8caed6","f2b94f","eff26e","e43872","d9b100","9d7a00","698cff","d9d9d9","00d27e","d06800","009f82","c49200","cbe8ff","fecddf","c27eb6","8cd2ce","c4b8d9","f883b0","a49100","f48800","27d0df","a04a9b"]]);a.shrinkByTakingHead(!0),t.register(a)}(),function(){var a=t.rgbColor,l=function(i,c){for(var p=arguments.length-1,f=arguments[p];p>1;)f=f*i+arguments[--p];return f},s=function(i){var c=l(Math.abs(i),1,.278393,.230389,972e-6,.078108);return c*=c,c*=c,c=1-1/c,i<0?-c:c};t.register(t.Scheme.fromPalettes("tol","qualitative",[["4477aa"],["4477aa","cc6677"],["4477aa","ddcc77","cc6677"],["4477aa","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677"],["332288","88ccee","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","cc6677","882255","aa4499"],["332288","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","882255","aa4499"],["332288","6699cc","88ccee","44aa99","117733","999933","ddcc77","661100","cc6677","aa4466","882255","aa4499"]],12,12)),t.tolSequentialColor=function(i){return a(1-.392*(1+s((i-.869)/.255)),1.021-.456*(1+s((i-.527)/.376)),1-.493*(1+s((i-.272)/.309)))},t.register(t.Scheme.withColorFunction("tol-sq","sequential",t.tolSequentialColor,!0)),t.tolDivergingColor=function(i){var c=l(i,.572,1.524,-1.811)/l(i,1,-.291,.1574);return a(l(i,.235,-2.13,26.92,-65.5,63.5,-22.36),c*c,1/l(i,1.579,-4.03,12.92,-31.4,48.6,-23.36))},t.register(t.Scheme.withColorFunction("tol-dv","diverging",t.tolDivergingColor,!0)),t.tolRainbowColor=function(i){return a(l(i,.472,-.567,4.05)/l(i,1,8.72,-19.17,14.1),l(i,.108932,-1.22635,27.284,-98.577,163.3,-131.395,40.634),1/l(i,1.97,3.54,-68.5,243,-297,125))},t.register(t.Scheme.withColorFunction("tol-rainbow","qualitative",t.tolRainbowColor,!0))}(),function(){t.register(t.Scheme.fromPalettes("sol-base","sequential",[["002b36","073642","586e75","657b83","839496","93a1a1","eee8d5","fdf6e3"]],1,8)),t.register(t.Scheme.fromPalettes("sol-accent","qualitative",[["b58900","cb4b16","dc322f","d33682","6c71c4","268bd2","2aa198","859900"]]))}(),function(){var a={YlGn:{type:"sequential",cbf:42,3:["f7fcb9","addd8e","31a354"],4:["ffffcc","c2e699","78c679","238443"],5:["ffffcc","c2e699","78c679","31a354","006837"],6:["ffffcc","d9f0a3","addd8e","78c679","31a354","006837"],7:["ffffcc","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],8:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","005a32"],9:["ffffe5","f7fcb9","d9f0a3","addd8e","78c679","41ab5d","238443","006837","004529"]},YlGnBu:{type:"sequential",cbf:42,3:["edf8b1","7fcdbb","2c7fb8"],4:["ffffcc","a1dab4","41b6c4","225ea8"],5:["ffffcc","a1dab4","41b6c4","2c7fb8","253494"],6:["ffffcc","c7e9b4","7fcdbb","41b6c4","2c7fb8","253494"],7:["ffffcc","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],8:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","0c2c84"],9:["ffffd9","edf8b1","c7e9b4","7fcdbb","41b6c4","1d91c0","225ea8","253494","081d58"]},GnBu:{type:"sequential",cbf:42,3:["e0f3db","a8ddb5","43a2ca"],4:["f0f9e8","bae4bc","7bccc4","2b8cbe"],5:["f0f9e8","bae4bc","7bccc4","43a2ca","0868ac"],6:["f0f9e8","ccebc5","a8ddb5","7bccc4","43a2ca","0868ac"],7:["f0f9e8","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],8:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","08589e"],9:["f7fcf0","e0f3db","ccebc5","a8ddb5","7bccc4","4eb3d3","2b8cbe","0868ac","084081"]},BuGn:{type:"sequential",cbf:42,3:["e5f5f9","99d8c9","2ca25f"],4:["edf8fb","b2e2e2","66c2a4","238b45"],5:["edf8fb","b2e2e2","66c2a4","2ca25f","006d2c"],6:["edf8fb","ccece6","99d8c9","66c2a4","2ca25f","006d2c"],7:["edf8fb","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],8:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","005824"],9:["f7fcfd","e5f5f9","ccece6","99d8c9","66c2a4","41ae76","238b45","006d2c","00441b"]},PuBuGn:{type:"sequential",cbf:42,3:["ece2f0","a6bddb","1c9099"],4:["f6eff7","bdc9e1","67a9cf","02818a"],5:["f6eff7","bdc9e1","67a9cf","1c9099","016c59"],6:["f6eff7","d0d1e6","a6bddb","67a9cf","1c9099","016c59"],7:["f6eff7","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],8:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016450"],9:["fff7fb","ece2f0","d0d1e6","a6bddb","67a9cf","3690c0","02818a","016c59","014636"]},PuBu:{type:"sequential",cbf:42,3:["ece7f2","a6bddb","2b8cbe"],4:["f1eef6","bdc9e1","74a9cf","0570b0"],5:["f1eef6","bdc9e1","74a9cf","2b8cbe","045a8d"],6:["f1eef6","d0d1e6","a6bddb","74a9cf","2b8cbe","045a8d"],7:["f1eef6","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],8:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","034e7b"],9:["fff7fb","ece7f2","d0d1e6","a6bddb","74a9cf","3690c0","0570b0","045a8d","023858"]},BuPu:{type:"sequential",cbf:42,3:["e0ecf4","9ebcda","8856a7"],4:["edf8fb","b3cde3","8c96c6","88419d"],5:["edf8fb","b3cde3","8c96c6","8856a7","810f7c"],6:["edf8fb","bfd3e6","9ebcda","8c96c6","8856a7","810f7c"],7:["edf8fb","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],8:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","6e016b"],9:["f7fcfd","e0ecf4","bfd3e6","9ebcda","8c96c6","8c6bb1","88419d","810f7c","4d004b"]},RdPu:{type:"sequential",cbf:42,3:["fde0dd","fa9fb5","c51b8a"],4:["feebe2","fbb4b9","f768a1","ae017e"],5:["feebe2","fbb4b9","f768a1","c51b8a","7a0177"],6:["feebe2","fcc5c0","fa9fb5","f768a1","c51b8a","7a0177"],7:["feebe2","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],8:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177"],9:["fff7f3","fde0dd","fcc5c0","fa9fb5","f768a1","dd3497","ae017e","7a0177","49006a"]},PuRd:{type:"sequential",cbf:42,3:["e7e1ef","c994c7","dd1c77"],4:["f1eef6","d7b5d8","df65b0","ce1256"],5:["f1eef6","d7b5d8","df65b0","dd1c77","980043"],6:["f1eef6","d4b9da","c994c7","df65b0","dd1c77","980043"],7:["f1eef6","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],8:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","91003f"],9:["f7f4f9","e7e1ef","d4b9da","c994c7","df65b0","e7298a","ce1256","980043","67001f"]},OrRd:{type:"sequential",cbf:42,3:["fee8c8","fdbb84","e34a33"],4:["fef0d9","fdcc8a","fc8d59","d7301f"],5:["fef0d9","fdcc8a","fc8d59","e34a33","b30000"],6:["fef0d9","fdd49e","fdbb84","fc8d59","e34a33","b30000"],7:["fef0d9","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],8:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","990000"],9:["fff7ec","fee8c8","fdd49e","fdbb84","fc8d59","ef6548","d7301f","b30000","7f0000"]},YlOrRd:{type:"sequential",cbf:42,3:["ffeda0","feb24c","f03b20"],4:["ffffb2","fecc5c","fd8d3c","e31a1c"],5:["ffffb2","fecc5c","fd8d3c","f03b20","bd0026"],6:["ffffb2","fed976","feb24c","fd8d3c","f03b20","bd0026"],7:["ffffb2","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],8:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","b10026"],9:["ffffcc","ffeda0","fed976","feb24c","fd8d3c","fc4e2a","e31a1c","bd0026","800026"]},YlOrBr:{type:"sequential",cbf:42,3:["fff7bc","fec44f","d95f0e"],4:["ffffd4","fed98e","fe9929","cc4c02"],5:["ffffd4","fed98e","fe9929","d95f0e","993404"],6:["ffffd4","fee391","fec44f","fe9929","d95f0e","993404"],7:["ffffd4","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],8:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","8c2d04"],9:["ffffe5","fff7bc","fee391","fec44f","fe9929","ec7014","cc4c02","993404","662506"]},Purples:{type:"sequential",cbf:42,3:["efedf5","bcbddc","756bb1"],4:["f2f0f7","cbc9e2","9e9ac8","6a51a3"],5:["f2f0f7","cbc9e2","9e9ac8","756bb1","54278f"],6:["f2f0f7","dadaeb","bcbddc","9e9ac8","756bb1","54278f"],7:["f2f0f7","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],8:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","4a1486"],9:["fcfbfd","efedf5","dadaeb","bcbddc","9e9ac8","807dba","6a51a3","54278f","3f007d"]},Blues:{type:"sequential",cbf:42,3:["deebf7","9ecae1","3182bd"],4:["eff3ff","bdd7e7","6baed6","2171b5"],5:["eff3ff","bdd7e7","6baed6","3182bd","08519c"],6:["eff3ff","c6dbef","9ecae1","6baed6","3182bd","08519c"],7:["eff3ff","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],8:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","084594"],9:["f7fbff","deebf7","c6dbef","9ecae1","6baed6","4292c6","2171b5","08519c","08306b"]},Greens:{type:"sequential",cbf:42,3:["e5f5e0","a1d99b","31a354"],4:["edf8e9","bae4b3","74c476","238b45"],5:["edf8e9","bae4b3","74c476","31a354","006d2c"],6:["edf8e9","c7e9c0","a1d99b","74c476","31a354","006d2c"],7:["edf8e9","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],8:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","005a32"],9:["f7fcf5","e5f5e0","c7e9c0","a1d99b","74c476","41ab5d","238b45","006d2c","00441b"]},Oranges:{type:"sequential",cbf:42,3:["fee6ce","fdae6b","e6550d"],4:["feedde","fdbe85","fd8d3c","d94701"],5:["feedde","fdbe85","fd8d3c","e6550d","a63603"],6:["feedde","fdd0a2","fdae6b","fd8d3c","e6550d","a63603"],7:["feedde","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],8:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","8c2d04"],9:["fff5eb","fee6ce","fdd0a2","fdae6b","fd8d3c","f16913","d94801","a63603","7f2704"]},Reds:{type:"sequential",cbf:42,3:["fee0d2","fc9272","de2d26"],4:["fee5d9","fcae91","fb6a4a","cb181d"],5:["fee5d9","fcae91","fb6a4a","de2d26","a50f15"],6:["fee5d9","fcbba1","fc9272","fb6a4a","de2d26","a50f15"],7:["fee5d9","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],8:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","99000d"],9:["fff5f0","fee0d2","fcbba1","fc9272","fb6a4a","ef3b2c","cb181d","a50f15","67000d"]},Greys:{type:"sequential",cbf:42,3:["f0f0f0","bdbdbd","636363"],4:["f7f7f7","cccccc","969696","525252"],5:["f7f7f7","cccccc","969696","636363","252525"],6:["f7f7f7","d9d9d9","bdbdbd","969696","636363","252525"],7:["f7f7f7","d9d9d9","bdbdbd","969696","737373","525252","252525"],8:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525"],9:["ffffff","f0f0f0","d9d9d9","bdbdbd","969696","737373","525252","252525","000000"]},PuOr:{type:"diverging",cbf:42,3:["f1a340","f7f7f7","998ec3"],4:["e66101","fdb863","b2abd2","5e3c99"],5:["e66101","fdb863","f7f7f7","b2abd2","5e3c99"],6:["b35806","f1a340","fee0b6","d8daeb","998ec3","542788"],7:["b35806","f1a340","fee0b6","f7f7f7","d8daeb","998ec3","542788"],8:["b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788"],9:["b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788"],10:["7f3b08","b35806","e08214","fdb863","fee0b6","d8daeb","b2abd2","8073ac","542788","2d004b"],11:["7f3b08","b35806","e08214","fdb863","fee0b6","f7f7f7","d8daeb","b2abd2","8073ac","542788","2d004b"]},BrBG:{type:"diverging",cbf:42,3:["d8b365","f5f5f5","5ab4ac"],4:["a6611a","dfc27d","80cdc1","018571"],5:["a6611a","dfc27d","f5f5f5","80cdc1","018571"],6:["8c510a","d8b365","f6e8c3","c7eae5","5ab4ac","01665e"],7:["8c510a","d8b365","f6e8c3","f5f5f5","c7eae5","5ab4ac","01665e"],8:["8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e"],9:["8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e"],10:["543005","8c510a","bf812d","dfc27d","f6e8c3","c7eae5","80cdc1","35978f","01665e","003c30"],11:["543005","8c510a","bf812d","dfc27d","f6e8c3","f5f5f5","c7eae5","80cdc1","35978f","01665e","003c30"]},PRGn:{type:"diverging",cbf:42,3:["af8dc3","f7f7f7","7fbf7b"],4:["7b3294","c2a5cf","a6dba0","008837"],5:["7b3294","c2a5cf","f7f7f7","a6dba0","008837"],6:["762a83","af8dc3","e7d4e8","d9f0d3","7fbf7b","1b7837"],7:["762a83","af8dc3","e7d4e8","f7f7f7","d9f0d3","7fbf7b","1b7837"],8:["762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837"],9:["762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837"],10:["40004b","762a83","9970ab","c2a5cf","e7d4e8","d9f0d3","a6dba0","5aae61","1b7837","00441b"],11:["40004b","762a83","9970ab","c2a5cf","e7d4e8","f7f7f7","d9f0d3","a6dba0","5aae61","1b7837","00441b"]},PiYG:{type:"diverging",cbf:42,3:["e9a3c9","f7f7f7","a1d76a"],4:["d01c8b","f1b6da","b8e186","4dac26"],5:["d01c8b","f1b6da","f7f7f7","b8e186","4dac26"],6:["c51b7d","e9a3c9","fde0ef","e6f5d0","a1d76a","4d9221"],7:["c51b7d","e9a3c9","fde0ef","f7f7f7","e6f5d0","a1d76a","4d9221"],8:["c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221"],9:["c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221"],10:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","e6f5d0","b8e186","7fbc41","4d9221","276419"],11:["8e0152","c51b7d","de77ae","f1b6da","fde0ef","f7f7f7","e6f5d0","b8e186","7fbc41","4d9221","276419"]},RdBu:{type:"diverging",cbf:42,3:["ef8a62","f7f7f7","67a9cf"],4:["ca0020","f4a582","92c5de","0571b0"],5:["ca0020","f4a582","f7f7f7","92c5de","0571b0"],6:["b2182b","ef8a62","fddbc7","d1e5f0","67a9cf","2166ac"],7:["b2182b","ef8a62","fddbc7","f7f7f7","d1e5f0","67a9cf","2166ac"],8:["b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac"],9:["b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","d1e5f0","92c5de","4393c3","2166ac","053061"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","f7f7f7","d1e5f0","92c5de","4393c3","2166ac","053061"]},RdGy:{type:"diverging",cbf:42,3:["ef8a62","ffffff","999999"],4:["ca0020","f4a582","bababa","404040"],5:["ca0020","f4a582","ffffff","bababa","404040"],6:["b2182b","ef8a62","fddbc7","e0e0e0","999999","4d4d4d"],7:["b2182b","ef8a62","fddbc7","ffffff","e0e0e0","999999","4d4d4d"],8:["b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d"],9:["b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d"],10:["67001f","b2182b","d6604d","f4a582","fddbc7","e0e0e0","bababa","878787","4d4d4d","1a1a1a"],11:["67001f","b2182b","d6604d","f4a582","fddbc7","ffffff","e0e0e0","bababa","878787","4d4d4d","1a1a1a"]},RdYlBu:{type:"diverging",cbf:42,3:["fc8d59","ffffbf","91bfdb"],4:["d7191c","fdae61","abd9e9","2c7bb6"],5:["d7191c","fdae61","ffffbf","abd9e9","2c7bb6"],6:["d73027","fc8d59","fee090","e0f3f8","91bfdb","4575b4"],7:["d73027","fc8d59","fee090","ffffbf","e0f3f8","91bfdb","4575b4"],8:["d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4"],9:["d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4"],10:["a50026","d73027","f46d43","fdae61","fee090","e0f3f8","abd9e9","74add1","4575b4","313695"],11:["a50026","d73027","f46d43","fdae61","fee090","ffffbf","e0f3f8","abd9e9","74add1","4575b4","313695"]},Spectral:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","99d594"],4:["d7191c","fdae61","abdda4","2b83ba"],5:["d7191c","fdae61","ffffbf","abdda4","2b83ba"],6:["d53e4f","fc8d59","fee08b","e6f598","99d594","3288bd"],7:["d53e4f","fc8d59","fee08b","ffffbf","e6f598","99d594","3288bd"],8:["d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd"],9:["d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd"],10:["9e0142","d53e4f","f46d43","fdae61","fee08b","e6f598","abdda4","66c2a5","3288bd","5e4fa2"],11:["9e0142","d53e4f","f46d43","fdae61","fee08b","ffffbf","e6f598","abdda4","66c2a5","3288bd","5e4fa2"]},RdYlGn:{type:"diverging",cbf:0,3:["fc8d59","ffffbf","91cf60"],4:["d7191c","fdae61","a6d96a","1a9641"],5:["d7191c","fdae61","ffffbf","a6d96a","1a9641"],6:["d73027","fc8d59","fee08b","d9ef8b","91cf60","1a9850"],7:["d73027","fc8d59","fee08b","ffffbf","d9ef8b","91cf60","1a9850"],8:["d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850"],9:["d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850"],10:["a50026","d73027","f46d43","fdae61","fee08b","d9ef8b","a6d96a","66bd63","1a9850","006837"],11:["a50026","d73027","f46d43","fdae61","fee08b","ffffbf","d9ef8b","a6d96a","66bd63","1a9850","006837"]},Accent:{type:"qualitative",cbf:0,3:["7fc97f","beaed4","fdc086"],4:["7fc97f","beaed4","fdc086","ffff99"],5:["7fc97f","beaed4","fdc086","ffff99","386cb0"],6:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f"],7:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17"],8:["7fc97f","beaed4","fdc086","ffff99","386cb0","f0027f","bf5b17","666666"]},Dark2:{type:"qualitative",cbf:3,3:["1b9e77","d95f02","7570b3"],4:["1b9e77","d95f02","7570b3","e7298a"],5:["1b9e77","d95f02","7570b3","e7298a","66a61e"],6:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02"],7:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d"],8:["1b9e77","d95f02","7570b3","e7298a","66a61e","e6ab02","a6761d","666666"]},Paired:{type:"qualitative",cbf:4,3:["a6cee3","1f78b4","b2df8a"],4:["a6cee3","1f78b4","b2df8a","33a02c"],5:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99"],6:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c"],7:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f"],8:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00"],9:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6"],10:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a"],11:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99"],12:["a6cee3","1f78b4","b2df8a","33a02c","fb9a99","e31a1c","fdbf6f","ff7f00","cab2d6","6a3d9a","ffff99","b15928"]},Pastel1:{type:"qualitative",cbf:0,3:["fbb4ae","b3cde3","ccebc5"],4:["fbb4ae","b3cde3","ccebc5","decbe4"],5:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6"],6:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc"],7:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd"],8:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec"],9:["fbb4ae","b3cde3","ccebc5","decbe4","fed9a6","ffffcc","e5d8bd","fddaec","f2f2f2"]},Pastel2:{type:"qualitative",cbf:0,3:["b3e2cd","fdcdac","cbd5e8"],4:["b3e2cd","fdcdac","cbd5e8","f4cae4"],5:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9"],6:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae"],7:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc"],8:["b3e2cd","fdcdac","cbd5e8","f4cae4","e6f5c9","fff2ae","f1e2cc","cccccc"]},Set1:{type:"qualitative",cbf:0,3:["e41a1c","377eb8","4daf4a"],4:["e41a1c","377eb8","4daf4a","984ea3"],5:["e41a1c","377eb8","4daf4a","984ea3","ff7f00"],6:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33"],7:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628"],8:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf"],9:["e41a1c","377eb8","4daf4a","984ea3","ff7f00","ffff33","a65628","f781bf","999999"]},Set2:{type:"qualitative",cbf:3,3:["66c2a5","fc8d62","8da0cb"],4:["66c2a5","fc8d62","8da0cb","e78ac3"],5:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854"],6:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f"],7:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494"],8:["66c2a5","fc8d62","8da0cb","e78ac3","a6d854","ffd92f","e5c494","b3b3b3"]},Set3:{type:"qualitative",cbf:0,3:["8dd3c7","ffffb3","bebada"],4:["8dd3c7","ffffb3","bebada","fb8072"],5:["8dd3c7","ffffb3","bebada","fb8072","80b1d3"],6:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462"],7:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69"],8:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5"],9:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9"],10:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd"],11:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5"],12:["8dd3c7","ffffb3","bebada","fb8072","80b1d3","fdb462","b3de69","fccde5","d9d9d9","bc80bd","ccebc5","ffed6f"]}};for(var l in a){var s=a[l];s=t.Scheme.fromPalettes("cb-"+l,[s.type,"cb-"+s.type],s,12,s.cbf),t.register(s)}}(),e.exports&&(e.exports=t)}(Xi)),Xi.exports}sC();class nC extends tl{constructor(){super(...arguments);Pe(this,"data",{dashboard:[{name:"sales_growth_chart",type:"line"}],order:[{name:"gross_sale_by_day_chart",type:""},{name:"order_completion_time_chart",type:""},{name:"item_count_distribution_chart",type:""},{name:"gross_sale_by_hour_chart",type:""},{name:"order_value_distribution_chart",type:""},{name:"avg_order_gross_chart",type:""},{name:"avg_order_items_chart",type:""},{name:"order_chart",type:""}],revenue:[{name:"revenue_chart",type:"line"}],refund:[{name:"refund_chart",type:"line"}],subscription:[{name:"subscription_chart",type:"line"},{name:"retention_chart",type:"line"},{name:"daily_signups_chart",type:"line"}],product:[{name:"product_chart",type:"bar"}]});Pe(this,"storageKey","chart-type");Pe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Vt.get(this.storageKey);this.data.dashboard=a.dashboard??this.data.dashboard,this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund,this.data.subscription=a.subscription??this.data.subscription}addListener(a,l){this.listeners[a]=l}async onChange(a,l,s){const c=this.data[a].findIndex(p=>p.name===l);c!==-1?this.data[a][c].type=s:this.data[a].push({name:l,type:s}),this.syncStorage();for(let p in this.listeners)this.listeners[p](this.applicableFilters)}getChartType(a,l){const i=this.data[a].find(c=>c.name===l);return i?i.type:null}syncStorage(){Vt.set(this.storageKey,this.applicableFilters.chartType)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{chartType:{dashboard:this.data.dashboard,order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,subscription:this.data.subscription}}}}const ba=nC.init();function Ms(e){const t=lt(e[0]).locale(Zl()).format(Ll("date")),a=lt(e[1]).locale(Zl()).format(Ll("date"));return t===a?`on ${t}.`:`between ${t} and ${a}.`}function Ls(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Oa[parseInt(l)-1]} ${s}`}else if(t.length===2){const[a,l]=t;return`${Oa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}function Ol(e){return e.map(t=>Ls(t.group))}const La=Te.colors.report,oC={[La.light_gray]:La.cyan_blue,[La.light_gray_cyan_blue]:La.cyan_blue_dark,[La.blue]:La.royal_blue,[La.royal_blue]:La.dark_blue,[La.medium_slate_blue]:La.dark_purple,[La.dark_cyan_blue_16]:La.dark_cyan_blue_40,[La.dark_cyan_blue_24]:La.dark_cyan_blue_40,[La.blue]:La.blue_dark_mode,[La.purple]:La.purple_dark_mode};function ja(e){return oC[e]}function pl(e){const t=e<=31?6:7,a=Math.floor(e/t);return{splitNumber:t,interval:a}}const iC={class:"fct-gross-sale-vs-net-revenue-wrap"},rC={class:"fct-btn-group sm"},dC={__name:"SalesGrowthChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(null);T("daily");const i=T(ba.getChartType("order","sales_growth_chart")||"line"),c=Te.colors.report,p=T(Te.isDark()),f=K(()=>a.chartData.every(F=>F.orders===0)),_=K(()=>p.value?c.dark_cyan_blue_16:c.light_gray),g=K(()=>p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue),y=K(()=>[{title:kl("Orders","Chart series legend"),key:"orders",color:_.value,yAxisIndex:1},{title:kl("Revenue","Chart series legend"),key:"net_revenue",color:g.value,yAxisIndex:0}].map(({title:F,key:B,color:U,yAxisIndex:Q})=>$(F,i.value,a.chartData.map(V=>V[B]),U,Q)));Oa.map(F=>F.slice(0,3));const v=K(()=>Ol(a.chartData));let w=null;const k=()=>{w&&(w.dispose(),w=null),xe(()=>{l.value&&(w=na(l.value),S())})},b=K(()=>pl(a.chartData.length)),S=()=>{if(!w)return;p.value=Te.isDark();const F={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,c.dark_cyan_blue_16,c.light_gray_blue,i.value),confine:!0,position:wl,formatter:B=>{let U=B[0].name;return B.forEach(Q=>{const V=Q.seriesIndex===1?za(Q.value*100):Q.value,I=p.value?"#ffffff":"#565865";U+=`<div> | |
| 101 | + ${Q.marker} | |
| 102 | + <span style="color: ${I};">${Q.seriesName}</span> | |
| 103 | + <span style="float: right; margin-left: 20px; color: ${I};"> | |
| 104 | + ${V} | |
| 105 | 105 | </span> |
| 106 | - </div>`}),M}},xAxis:{type:"category",data:v.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:w.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Revenue"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:S=>`${Je.scaledChart(S)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:y.value};C.setOption(U,{notMerge:!0,replaceMerge:["series"]})},F=(U,S,M,I,T)=>({name:U,type:S,barMaxWidth:30,data:M,smooth:!1,color:I,lineStyle:{width:3},areaStyle:{opacity:.3,color:I},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},yAxisIndex:T,emphasis:{scale:2,itemStyle:{color:za(I)},lineStyle:{color:I},areaStyle:{opacity:.3,color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),L=U=>{i.value!==U&&(i.value=U,va.onChange("order","sales_growth_chart",U),x())};return Ce([()=>a.chartData,i],()=>{Se(x)},{deep:!0}),Ce(m,U=>{U||b()}),Ce(()=>a.loading,U=>{U||b()}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",x),Se(b)}),(U,S)=>{const M=B("el-skeleton");return r(),h("div",kw,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[n(Ve,{title:U.$t("Sales Growth"),border_bottom:""},ta({_:2},[!m.value&&!e.loading?{name:"action",fn:d(()=>[o("div",xw,[n(Rl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:L},null,8,["activeType"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"p-0"},{default:d(()=>[e.loading?(r(),$(M,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(O,{key:1},[m.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-gross-sale-vs-net-revenue-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1})]),_:1},512)])}}},Fw={class:"fct-gross-sale-vs-net-revenue-wrap"},$w={class:"fct-btn-group sm"},Ew={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},Uw={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},Iu=.5,Ki=6,co=1.2,Iw={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Te.colors,l=V(null),s=V(null),i=V(!1),c=V("world"),p=V(92),m=V(100);V(!1);let _=null,g=null,y=50;const v=V(1.2),C=V(),b=a.blue,w=K(()=>{const j=m.value-p.value,q=t.data?t.data.length:0;return j<60||q<15}),x=j=>{j=j.replace(/^#/,"");const q=parseInt(j.substring(0,2),16),X=parseInt(j.substring(2,4),16),ie=parseInt(j.substring(4,6),16);return[q,X,ie]},F=()=>Te.isDark()?a.gray[50]:a.gray[600],L=x(b[500]),U=async()=>{const j=cs.getUrl("world.geo.json"),X=await(await fetch(j)).json();jf("world",X)},S=j=>{if(!j||isNaN(j))return`rgba(${L.join(",")}, 0)`;const q=Math.log(j+1)/Math.log(y+1);return`rgba(${L.join(",")}, ${q})`},M=j=>{c.value=j,J(),_&&(_.clear(),_.setOption(P()),j==="bar"&&I()),g&&i.value&&(g.clear(),g.setOption(P()),j==="bar"&&T())},I=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(j){j.batch&&j.batch[0]?(p.value=j.batch[0].start||0,m.value=j.batch[0].end||100):(p.value=j.start||0,m.value=j.end||100),setTimeout(()=>{J()},100)}))},T=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(j){j.batch&&j.batch[0]?(p.value=j.batch[0].start||0,m.value=j.batch[0].end||100):(p.value=j.start||0,m.value=j.end||100),setTimeout(()=>{g&&g.setOption(P())},100)}))},Q=K(()=>(t.data||[]).map(j=>({...j,value:j.value||0,itemStyle:{color:S(j.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),E=()=>({backgroundColor:Te.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:j=>u("%1$s%2$s Orders: %3$s",j.name,"<br>",j.value||0),borderRadius:8,backgroundColor:Te.isDark()?"#38485a":"#ffffff",borderColor:Te.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Te.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:i.value?"5%":"center",bottom:i.value?"center":"4%",text:[u("High"),u("Low")],orient:i.value?"vertical":"horizontal",calculable:!0,inRange:{color:[b[100],b[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",roam:C.value,zoom:v.value,label:{show:!1,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:b[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:Q.value}]}),D=K(()=>{const j=t.data.length,q=m.value-p.value,X=Math.ceil(j*q/100);let ie=0;return X>100?ie=9:X>50?ie=4:X>30?ie=2:X>20&&(ie=1),ie}),H=()=>{const j=w.value;return{backgroundColor:Te.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(q){const X=q[0];return`${X.name}<br/>${u("Orders")}: ${X.value||0}`},backgroundColor:Te.isDark()?"#38485a":"#ffffff",textStyle:{color:Te.isDark()?a.gray[25]:a.system.mid},borderColor:Te.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:m.value},{type:"slider",yAxisIndex:0,start:p.value,end:m.value,width:25,top:10,right:10,textStyle:{color:F()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:j?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:j},splitLine:{show:!1},axisLine:{show:j,lineStyle:{color:F()}},axisLabel:{show:j,interval:D.value,color:F(),fontSize:11},data:t.data.map(q=>q.name)},xAxis:{type:"value",axisLabel:{show:!0,color:F(),formatter:function(q){return q.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Te.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new lr(0,0,1,0,[{offset:0,color:b[400]},{offset:1,color:b[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new lr(0,0,1,0,[{offset:0,color:b[500]},{offset:1,color:b[700]}])}},data:t.data.map(q=>q.value),label:{show:j,formatter:"{c}",position:"right",color:F(),fontSize:10}}]}},P=()=>c.value==="bar"?H():E(),G=async()=>{await U(),l.value&&(_=Jt(l.value),_.setOption(P()),c.value==="bar"&&I(),_.on("georoam",()=>{const q=_.getOption().series[0].zoom;if(q!==v.value)if(q<co||q>Ki){const X=Math.max(co,Math.min(Ki,q));_.setOption({series:[{zoom:X}]},!1),v.value=X}else v.value=q}))},J=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(j=>j.value||0)):y=1,_&&_.setOption(P(),{notMerge:!0})},oe=()=>{v.value=Math.min(v.value+Iu,Ki),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},Z=()=>{v.value=Math.max(v.value-Iu,co),C.value=!0,_.setOption({series:[{zoom:v.value,roam:C.value}]})},W=()=>{c.value==="bar"?(p.value=92,m.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=co,C.value="move",_&&(_.clear(),_.setOption(P())))},pe=async()=>{i.value=!0,await Se(),g?g.clear():g=Jt(s.value),g.setOption(P()),c.value==="bar"&&T()},N=j=>{F(),_&&_.setOption(P())};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",N),C.value="move",Se(G)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",N),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),Ce(()=>t.data,()=>J(),{deep:!0}),Ce(w,()=>{c.value==="bar"&&Se(()=>{J()})}),(j,q)=>(r(),h("div",Fw,[n(xe,{id:"chartContainer",class:"mb-0"},{default:d(()=>[n(Ve,{title:j.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[o("div",$w,[n(Rl,{activeType:c.value,types:{world:"Globe",bar:"BarChart"},onChange:M},null,8,["activeType"]),n(ka,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),n(ke,{class:"p-0 pt-0 relative"},{default:d(()=>[c.value==="world"?(r(),h("div",Ew,[n(Xe,{tag:"button",size:"small",onClick:oe},{default:d(()=>[n(ee,{name:"Plus"})]),_:1}),n(Xe,{tag:"button",size:"small",onClick:Z},{default:d(()=>[n(ee,{name:"Minus"})]),_:1}),n(Xe,{tag:"button",size:"small",onClick:W},{default:d(()=>[n(ee,{name:"Reload"})]),_:1}),n(Xe,{tag:"button",size:"small lg:hidden",onClick:pe},{default:d(()=>[n(ee,{name:"Eye"})]),_:1})])):k("",!0),c.value==="bar"?(r(),h("div",Uw,[n(Xe,{tag:"button",size:"small",onClick:W},{default:d(()=>[n(ee,{name:"Reload"})]),_:1})])):k("",!0),o("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:l},null,512)]),_:1})]),_:1}),n(A(Wf),{modelValue:i.value,"onUpdate:modelValue":q[0]||(q[0]=X=>i.value=X),title:j.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:d(()=>[o("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:s},null,512)]),_:1},8,["modelValue","title"])]))}},Qw=lt(Iw,[["__scopeId","data-v-36a900c8"]]),Dw={class:"fct-report-card"},Vw={key:0,class:"fct-report-card-header"},Tw={key:0,class:"flex items-center gap-2"},Mw={class:"title"},Lw={class:"actions"},Rw={class:"fct-report-card-body flex h-full"},Ow={class:"w-full"},Ln={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const l=B("router-link");return r(),h("div",Dw,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",Vw,[e.cardOptions.heading?(r(),h("div",Tw,[e.cardOptions.headingIcon?(r(),$(Xe,{key:0,size:"x-small",bg:"danger",soft:""},{default:d(()=>[n(ee,{name:"FailedCircle"})]),_:1})):k("",!0),o("h4",Mw,f(e.cardOptions.heading),1)])):k("",!0),o("div",Lw,[e.cardOptions.linkButtonText?(r(),$(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[R(f(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):k("",!0),Ca(t.$slots,"action")])])):k("",!0),o("div",Rw,[o("div",Ow,[Ca(t.$slots,"default")])])])}}},Hw={key:0,class:"fct-report-sold-product-list has-scroll"},Pw={class:"list-left-content"},Nw={class:"list-title"},Kw={class:"list-title-inner"},Gw={class:"list-id"},jw={class:"list-right-content"},zw=["innerHTML"],qw={class:"list-price"},Yw={__name:"RecentOrders",setup(e){const t=Ka.data;return(a,l)=>{const s=B("router-link");return r(),$(Ln,{class:"top-sold-products","card-options":{heading:A(u)("Recent Orders"),linkButtonText:A(u)("View All"),linkButtonUrl:"orders"}},{default:d(()=>{var i,c;return[((c=(i=A(t))==null?void 0:i.recentOrders)==null?void 0:c.length)>0?(r(),h("ul",Hw,[(r(!0),h(O,null,ae(A(t).recentOrders,p=>(r(),h("li",{key:p.id},[n(s,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:d(()=>[o("div",Pw,[o("div",Nw,[o("div",Kw,f(p.customer_name)+" #"+f(A(Xt)(p.id)),1),o("div",Gw,[n(Pa,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",jw,[o("div",{class:"list-value",innerHTML:A(Je).scaled(p.total_amount)},null,8,zw),o("div",qw,f(A(Xt)(p.order_items_count))+" "+f(A(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},Ww={key:0},Xw={key:1,class:"fc_dashboard_onboarding_wrap"},Jw={class:"fc_dashboard_onboarding_title"},Zw={class:"fc_dashboard_onboarding_lists"},eC=["href"],tC={class:"circle-shape"},aC={class:"fc_dashboard_onboarding_item__title"},lC={__name:"Onboarding",setup(e){const t=V(0),a=V(!1);zt().ctx;const l=V([]),s=V(!0);V(localStorage.getItem("started_content_collapse")==="true"||!1),K(()=>{const c=Object.keys(l.value).length;return c?Math.round(t.value/c*100):0});const i=Pr("dashboardTogglePageNotification");return Qe(async()=>{a.value=!0,ce.get("dashboard").then(c=>{var m;l.value=c.data.steps,t.value=c.data.completed,s.value=Object.keys(l.value).length!==t.value,a.value=!1;let p=((m=l.value.page_setup)==null?void 0:m.completed)||!1;i&&i(!p)}).catch(c=>{a.value=!1})}),(c,p)=>{const m=B("el-skeleton"),_=B("Check"),g=B("el-icon");return s.value?(r(),h("div",Ww,[a.value?(r(),$(m,{key:0,rows:3,animated:""})):(r(),h("div",Xw,[o("h3",Jw,f(c.$t("Onboarding Checklist")),1),o("div",Zw,[(r(!0),h(O,null,ae(l.value,(y,v)=>(r(),h("a",{key:v,href:y.url,class:de([y.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",tC,[y.completed===!0?(r(),$(g,{key:0},{default:d(()=>[n(_)]),_:1})):k("",!0)]),o("div",aC,f(y.title),1)],10,eC))),128))])]))])):k("",!0)}}},sC={class:"fct-dashboard-recent-activities-wrap"},nC={class:"fct-dashboard-recent-activities__header"},oC={class:"fct-dashboard-recent-activities__header_title"},iC={class:"fct-dashboard-recent-activities__header_desc"},rC={key:0,class:"fct-dashboard-recent-activities__body"},dC={key:0,class:"fct-dashboard-recent-activities__item has-icon"},uC={class:"content"},cC={class:"title"},AC=["onClick"],pC={class:"date"},fC=["innerHTML"],mC={class:"created_by"},hC={key:1,class:"fct-dashboard-recent-activities__empty"},_C={class:"fct-dashboard-recent-activities__empty_text"},vC={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=tl(),l=V([{label:u("All"),value:"all"},{label:u("Today"),value:"today"},{label:u("Yesterday"),value:"yesterday"},{label:u("This Week"),value:"this_week"}]),s=V("all"),i=()=>{switch(s.value){case"all":return u("all");case"today":return u("today");case"yesterday":return u("yesterday");case"this_week":return u("this week");default:return s.value}},c=()=>{i(),Ka.getRecentActivities({groupKey:s.value})},p={Order:"orders/view",Payment:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view"},m=g=>{var b;const y={order:{name:"view_order",param:"order_id",permission:"orders/view"},payment:{name:"view_order",param:"order_id",permission:"orders/view"},product:{name:"view_product",param:"product_id",permission:"products/view"},customer:{name:"view_customer",param:"customer_id",permission:"customers/view"},coupon:{name:"view_coupon",param:"coupon_id",permission:"coupons/view"}};let v=(b=g==null?void 0:g.module_name)==null?void 0:b.toLowerCase();const C=y[v];C&&g.module_id&&_(g)&&a.push({name:C.name,params:{[C.param]:g.module_id}})},_=g=>{if(!g.module_name)return!0;const y=rt.get(p,oa.capitalize(g.module_name));return y?Sn.has(y):!1};return Qe(()=>{c()}),(g,y)=>{const v=B("el-radio-button"),C=B("el-radio-group");return r(),h("div",sC,[o("div",nC,[o("h4",oC,f(A(u)("Recent Activities")),1),o("p",iC,[s.value==="all"?(r(),h(O,{key:0},[R(f(A(u)("%s new activities",A(Xt)(A(Ka).data.recentActivities.length))),1)],64)):(r(),h(O,{key:1},[R(f(A(u)("%1$s new activities %2$s",A(Xt)(A(Ka).data.recentActivities.length),i())),1)],64))]),n(C,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":y[0]||(y[0]=b=>s.value=b),onChange:c,size:"large"},{default:d(()=>[(r(!0),h(O,null,ae(l.value,(b,w)=>(r(),$(v,{key:w,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),A(Ka).data.recentActivities.length?(r(),h("div",rC,[(r(!0),h(O,null,ae(A(Ka).data.recentActivities,(b,w)=>(r(),h(O,{key:w},[_(b)?(r(),h("div",dC,[y[1]||(y[1]=o("span",{class:"icon"},[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12.8499 9.92029L13.5711 10.3529C13.6156 10.3795 13.6524 10.4172 13.678 10.4623C13.7036 10.5075 13.717 10.5584 13.717 10.6103C13.717 10.6621 13.7036 10.7131 13.678 10.7582C13.6524 10.8033 13.6156 10.841 13.5711 10.8677L8.30911 14.0249C8.21579 14.081 8.10897 14.1106 8.00011 14.1106C7.89124 14.1106 7.78443 14.081 7.69111 14.0249L2.42911 10.8677C2.38462 10.841 2.34779 10.8033 2.32222 10.7582C2.29664 10.7131 2.2832 10.6621 2.2832 10.6103C2.2832 10.5584 2.29664 10.5075 2.32222 10.4623C2.34779 10.4172 2.38462 10.3795 2.42911 10.3529L3.15031 9.92029L8.00011 12.8303L12.8499 9.92029ZM12.8499 7.10029L13.5711 7.53289C13.6156 7.55952 13.6524 7.59723 13.678 7.64235C13.7036 7.68746 13.717 7.73843 13.717 7.79029C13.717 7.84214 13.7036 7.89311 13.678 7.93822C13.6524 7.98334 13.6156 8.02105 13.5711 8.04769L8.00011 11.3903L2.42911 8.04769C2.38462 8.02105 2.34779 7.98334 2.32222 7.93822C2.29664 7.89311 2.2832 7.84214 2.2832 7.79029C2.2832 7.73843 2.29664 7.68746 2.32222 7.64235C2.34779 7.59723 2.38462 7.55952 2.42911 7.53289L3.15031 7.10029L8.00011 10.0103L12.8499 7.10029ZM8.30851 1.58569L13.5711 4.74289C13.6156 4.76952 13.6524 4.80724 13.678 4.85235C13.7036 4.89746 13.717 4.94843 13.717 5.00029C13.717 5.05214 13.7036 5.10311 13.678 5.14822C13.6524 5.19334 13.6156 5.23105 13.5711 5.25769L8.00011 8.60029L2.42911 5.25769C2.38462 5.23105 2.34779 5.19334 2.32222 5.14822C2.29664 5.10311 2.2832 5.05214 2.2832 5.00029C2.2832 4.94843 2.29664 4.89746 2.32222 4.85235C2.34779 4.80724 2.38462 4.76952 2.42911 4.74289L7.69111 1.58569C7.78443 1.52962 7.89124 1.5 8.00011 1.5C8.10897 1.5 8.21579 1.52962 8.30911 1.58569H8.30851ZM8.00011 2.79949L4.33231 5.00029L8.00011 7.20109L11.6679 5.00029L8.00011 2.79949Z",fill:"#335CFF"})])],-1)),o("div",uC,[o("h3",cC,[b.module_name!==""?(r(),h("span",{key:0,onClick:x=>m(b),class:"cursor-pointer"},f(b.title||"--"),9,AC)):(r(),h(O,{key:1},[R(f(b.title),1)],64)),o("span",pC,[n(Pa,{"date-time":b.created_at},null,8,["date-time"])])]),o("p",{innerHTML:b.content,class:"description"},null,8,fC),o("span",mC,f(A(u)("By %s",b.created_by)),1)])])):k("",!0)],64))),128))])):(r(),h("div",hC,[o("div",_C,f(A(u)("No activity found.")),1)]))])}}},gC={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},yC={__name:"SideBar",setup(e){return(t,a)=>(r(),h("div",gC,[n(Pt,{permission:"is_super_admin"},{default:d(()=>[n(lC)]),_:1}),n(vC,{onReload:a[0]||(a[0]=()=>{})})]))}},bC={class:"fct-product-create"},wC={class:"fct-product-step"},CC={class:"fct-product-item-selector"},BC=["onClick"],kC={class:"fct-product-item-selector-content"},xC={class:"fct-bundle-product-condition"},SC={class:"condition-text"},FC={class:"dialog-footer"},fi={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=tl(),i=ze.get("variation_types",{}),c=V({post_title:"",post_content:"",post_excerpt:"",post_date:new Date,post_status:"draft",detail:{fulfillment_type:"digital",variation_type:"simple",manage_stock:"0",manage_downloadable:"0",other_info:{use_pricing_table:"yes",group_pricing_by:"repeat_interval",active_editor:"wp-editor",sold_individually:"no"}}}),p=[{type:"physical",title:u("Physical Product"),icon:"Gift"},{type:"digital",title:u("Digital Product"),icon:"Code"}],m=V(!1),_=V(null),g=C=>{c.value.detail.fulfillment_type=C},y=()=>{m.value=!0,ce.post("products",{...c.value}).then(C=>{if(z.success(C.message),a.customModal==="order_modal"){const b={id:C.data.product_variants.id,object_id:C.data.product_variants.post_id,variation_id:C.data.product_variants.id,item_name:C.data.product_variants.variation_title,item_price:C.data.product_variants.item_price,quantity:1,stock:100,object_type:C.data.product_details.fulfillment_type,item_total:C.data.product_variants.item_price,line_total:C.data.product_variants.item_price,tax_amount:0,discount_total:0};l("process_custom",b),l("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:C.data.ID}})}).catch(C=>{var b;C.status_code=="422"?z.validationErrors(C):z.error((b=C.data)==null?void 0:b.message)}).finally(()=>{m.value=!1})},v=C=>{C.stopPropagation(),C.preventDefault(),y()};return Qe(()=>{Se(()=>{setTimeout(()=>{var C;(C=_.value)==null||C.focus()},10)})}),(C,b)=>{const w=B("el-input"),x=B("el-form-item"),F=B("el-option"),L=B("el-select"),U=B("el-checkbox"),S=B("el-form"),M=B("el-button");return r(),h("div",bC,[o("div",wC,[n(S,{"label-position":"top",model:c.value,"require-asterisk-position":"right"},{default:d(()=>[n(x,{label:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),required:""},{default:d(()=>[n(w,{type:"text",modelValue:c.value.post_title,"onUpdate:modelValue":b[0]||(b[0]=I=>c.value.post_title=I),placeholder:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:_,onKeydown:$a(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),$(x,{key:0,label:A(u)("Variation Type")},{default:d(()=>[n(L,{modelValue:c.value.detail.variation_type,"onUpdate:modelValue":b[1]||(b[1]=I=>c.value.detail.variation_type=I),placeholder:A(u)("Select Variation Type"),class:"w-full"},{default:d(()=>[(r(!0),h(O,null,ae(A(i),(I,T)=>(r(),$(F,{key:T,label:I,value:T},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):k("",!0),n(x,null,{default:d(()=>[o("ul",CC,[(r(),h(O,null,ae(p,I=>o("li",{key:I.type,class:de({active:I.type===c.value.detail.fulfillment_type}),onClick:T=>g(I.type)},[o("div",kC,[n(ee,{name:I.icon},null,8,["name"]),R(" "+f(I.title),1)]),b[3]||(b[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,BC)),64))])]),_:1}),n(x,null,{default:d(()=>[o("div",xC,[n(U,{modelValue:c.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":b[2]||(b[2]=I=>c.value.detail.other_info.is_bundle_product=I),"true-value":"yes","false-value":"no"},{default:d(()=>[R(f(A(u)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",SC,f(A(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",FC,[n(M,{disabled:!c.value.post_title||m.value,loading:m.value,onClick:y,type:"primary"},{default:d(()=>[R(f(m.value?A(u)("Creating"):A(u)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class dd{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new dd().getHours();if(t>=5&&t<12)return u("Good morning");if(t>=12&&t<17)return u("Good afternoon");if(t>=17&&t<21)return u("Good evening");{const a=[u("Step into the moonlight!"),u("Evening vibes!"),u("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const $C={class:"fct-current-user-info-wrap"},EC={class:"fct-current-user-info-content"},UC={class:"image"},IC=["src","alt"],QC={class:"content"},DC={key:0,class:"fct-current-user-info-action"},VC={__name:"CurrentUserInfo",setup(e){const t=V(!1),a=V(ze.get("me")),l=()=>ze.get("shop.store_name"),s=ze.get("total_products_count");return(i,c)=>{const p=B("el-button"),m=B("el-dialog");return r(),h("div",$C,[o("div",EC,[o("div",UC,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,IC)]),o("div",QC,[o("h4",null,f(A(dd).greeting())+" "+f(a.value.full_name)+" 👋🏻",1),o("p",null,f(A(u)("Welcome to %1$s",l())),1)])]),n(Pt,{permission:"products/create"},{default:d(()=>[A(s)==0?(r(),h("div",DC,[n(p,{onClick:c[0]||(c[0]=_=>t.value=!0),type:"primary"},{default:d(()=>[R(f(A(u)("Add Product")),1)]),_:1})])):k("",!0)]),_:1}),n(m,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":c[1]||(c[1]=_=>t.value=_),onClose:c[2]||(c[2]=_=>t.value=!1),title:A(u)("Add New Product")},{default:d(()=>[n(fi)]),_:1},8,["modelValue","title"])])}}};class TC{constructor(){Oe(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Oe(this,"defaultMatcherMethod",null)}getMatchingMethod(t){return t==="=="||t==="==="?"matchEqual":this.operatorMap.hasOwnProperty(t)?this.operatorMap[t]:this.defaultMatcherMethod}defaultMatcher(t,a,l){}matchEqual(t,a,l){return l==="==="?t===a:t==a}matchNotEqual(t,a,l){return l==="!=="?t!==a:t!=a}matchContains(t,a,l){return a instanceof String||Array.isArray(a)?a.includes(t):typeof a=="object"?a.hasOwnProperty(t):!1}matchIn(t,a,l){return this.matchContains(t,a,l)}matchNotIn(t,a,l){return!this.matchContains(t,a,l)}}class MC{constructor(){Oe(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Oe(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,l,s,i){return t+a}}class LC{constructor(t,a){Oe(this,"value");Oe(this,"operator");this.value=t,this.operator=a}setOperator(t){return this.operator=t,this}setValue(t){return this.value=t,this}static make(t,a){return new this(t,a)}build(){return{operator:this.operator,value:this.value instanceof Fr?this.value.setModifiers([]).build():this.value}}}class Fr{constructor(t,a){Oe(this,"accessor");Oe(this,"modifiers");this.accessor=t,this.modifiers=[],this.setModifiers(a)}setAccessor(t){return this.accessor=t,this}addModifier(t){return this.modifiers.push(t),this}setModifiers(t){return this.modifiers=Array.isArray(t)?t:this.modifiers,this}static make(t,a){return new this(t,a)}build(){let t=[];return Array.isArray(this.modifiers)&&this.modifiers.length>0&&(t=this.modifiers.map(a=>a instanceof LC?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class xs{constructor(t,a,l,s,i){Oe(this,"conditionType");Oe(this,"conditions");Oe(this,"key");Oe(this,"operator");Oe(this,"value");this.key=t,this.value=a,this.operator=l,this.conditions=[],this.conditionType=this.buildConditionType(s),this.setConditions(i)}static make(t,a,l,s){return new this(t,a,l,s)}setConditionType(t){return this.conditionType=this.buildConditionType(t),this}buildConditionType(t){return t==="or"||t==="|"?"or":"and"}setOperator(t){return this.operator=t,this}setKey(t){return this.key=t,this}setValue(t){return this.value=t,this}addCondition(t){return this.conditions.push(t),this}setConditions(t){return this.conditions=Array.isArray(t)||t instanceof xs||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let l=[];return l=this.conditions.map(s=>s instanceof xs?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof Fr?this.key.build():this.key,a=this.value instanceof Fr?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class RC{constructor(t,a){Oe(this,"data");Oe(this,"conditions");Oe(this,"stateKey");Oe(this,"matcher");Oe(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new TC,this.modifier=new MC}match(t,a,l,s=!0){let i="",c=this.matcher.getMatchingMethod(a);return c!=null?i=c:i=oa.camel("match"+a),i in this.matcher&&typeof this.matcher[i]=="function"?this.matcher[i](t,l,a,s):s}evaluate(t,a="and"){if(t instanceof xs){const s=t.build.bind(t)();s.hasOwnProperty("conditions")?(t=s.conditions,a=s.condition_type):t=[s]}a=a==="or"?"or":"and";let l=a==="and";if(typeof t=="function")return t(this.stateKey,this.data);if(!Array.isArray(t))return!0;for(let s of t){let i=null;if(Array.isArray(rt.get(s,"conditions")))i=this.evaluate(s.conditions,rt.get(s,"condition_type","and"));else{if(s.key===null||s.key===void 0){l=!0;continue}i=this.applyCondition(s)}l=a==="and"?l&&i:l||i}return l}applyCondition(t){let a="",l=null;typeof t.key=="object"?a=rt.resolvePath(this.stateKey,rt.get(t,"key.accessor")):a=rt.resolvePath(this.stateKey,t.key);let s=rt.get(this.data,a);if(typeof t.value=="object"){const i=rt.resolvePath(this.stateKey,rt.get(t,"value.accessor"));l=rt.get(this.data,i)}else l=t.value;return s=this.applyModification(s,t.key.modifiers,this.stateKey),l=this.applyModification(l,t.value.modifiers,this.stateKey),this.match(s,t.operator,l)}applyModification(t,a,l){return Array.isArray(a)&&a.forEach(s=>{let i=s.operator,c="",p=this.modifier.getModificationMethod(i);if(p!=null?c=p:c=oa.camel("apply"+i),c in this.modifier&&typeof this.modifier[c]=="function"){let m=s.value;typeof m=="object"&&m!==null&&(m=rt.getByPath(this.data,l,rt.get(m,"accessor"))),t=this.modifier[c](t,m,i,l,this.data)}}),t}}class WA{constructor(){Oe(this,"_conditionType","and");Oe(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof xs||typeof t=="function"?t:this._conditions,this}visibleIf(t){return this._conditions=t,this}buildConditions(t){return Array.isArray(t)&&t.length>0?t.map(a=>a instanceof xs?a.build.bind(a)():a):t}}class XA{constructor(){Oe(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class Lo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new Lo;return a._component="Affix/"+t,a}static make(t=""){return new this(t)}build(){return this._component.length>0?{component:this._component}:this._affix}}class $r{constructor(t,a="input"){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._key=t,this._type=a,this._class="",this._id="",this._name="",this._label="",this._value="",this._placeholder="",this._min="",this._max="",this._prefix="",this._hasPrefix=!1,this._hasSuffix=!1,this._suffix="",rs.install(this,Gc),rs.install(this,XA),rs.install(this,WA),this._wrapperClass=""}static make(t,a="input"){return new this(t,a)}wrapperClass(t){return this._wrapperClass=t,this}type(t){return this._type=t,this}class(t){return this._class=t,this}id(t){return this._id=t,this}name(t){return this._name=t,this}label(t){return this._label=t,this}value(t){return this._value=t,this}placeholder(t){return this._placeholder=t,this}min(t){return this._min=t,this}max(t){return this._max=t,this}prefix(t){return this._hasPrefix=!0,this._prefix=t,this}suffix(t){this._hasSuffix=!0,this._suffix=t}onChange(t){return this._onChangeCallback=t,this}onKeyPress(t){return this._onKeyPressCallback=t,this}onKeyUp(t){return this._onKeyUpCallback=t,this}onKeyDown(t){return this._onKeyDownCallback=t,this}build(){return this._conditions,Array.isArray(this._conditions)&&this._conditions.length>0&&this._conditions.map(t=>t instanceof xs?t.build.bind(t)():t),this._attributes=typeof this._attributes=="object"?this._attributes:{},this._attributes.min=this._min,this._attributes.max=this._max,this._attributes.placeholder=this._placeholder,this._attributes.type=this._type,{key:this._key,type:this._type,class:this._class,id:this._id,name:this._name??u(oa.headline(this._key)),label:this._label??u(oa.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix instanceof Lo?this._suffix.build():this._suffix,prefix:this._prefix instanceof Lo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Er{constructor(t){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._type="section",this._key=t,this._schema=[],this._class="",this.disable_nesting=!0,rs.install(this,Gc),rs.install(this,XA),rs.install(this,WA)}static make(t){return new this(t)}enableNesting(){return this.disable_nesting=!1,this}disableNesting(){return this.disable_nesting=!0,this}class(t){return this._class=t,this}get type(){return this._type}set type(t){if(typeof t=="string")this._type=t;else throw new TypeError("Type must be a string.")}get schema(){return this._schema}setSchema(t){return this._schema=t,this}build(){const t=tn.build(this.schema);return{key:this._key,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),attributes:this._attributes}}}class Qu{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");rs.install(this,$r,{key:t}),rs.install(this,Er,{key:t}),this._component=a,this._key=t}static make(t,a=""){return new this(t,a)}component(t){return this._component=t,this}value(t){return this._value=t,this}build(){const t=tn.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??u(oa.headline(this._key)),label:this._label??u(oa.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix,prefix:this._prefix,placeholder:this._placeholder,attributes:this._attributes,onChange:this._onChangeCallback,onKeyUp:this._onKeyUpCallback,onKeyDown:this._onKeyDownCallback,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),type:"custom",component:this._component,key:this._key}}}class tn{static build(t){return Array.isArray(t)?tn.buildFromArray(t):typeof t=="object"?tn.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,s)=>{const i=t[l];i instanceof $r||i instanceof Er||i instanceof Qu?a[l]=i.build.bind(i)():a[l]=t[l]}),a}static buildFromArray(t){let a={};return Array.isArray(t)&&t.forEach(l=>{if(l instanceof $r||l instanceof Er||l instanceof Qu){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class OC extends sl{constructor(){super(...arguments);Oe(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Oe(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Oe(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=tn.build(a??{}),this.initForm(),this}setDefaults(a){return this.data.defaults=a||{},this.data._originalDefaults=JSON.parse(JSON.stringify(this.data.defaults)),this.initForm(),this}get schema(){return this.data.schema}get values(){return this.data.values}get isReady(){return this.data.initialized}initForm(){if(typeof this.data.schema!="object"||typeof this.data.defaults!="object")throw new Error("You need to set Schema and Defaults First");this.setValues(),this.data.initialized=!0}setValues(){this.data.values=this.ensureNestedDataProperties(this.data.schema,this.data.defaults)}getState(){return this.data.values}setValidationErrors(a){this.data.validationErrors=a||{}}hasValidationError(a){return(this.data.validationErrors??{}).hasOwnProperty(a)}getValidationError(a){return this.data.validationErrors[a]}ensureNestedDataProperties(a,l={}){return Object.keys(a).reduce((s,i)=>{const c=a[i];if(c.type==="html")return s;if(this.nestedFormLayouts.includes(c.type??""))if(c.disable_nesting===!0){const p=this.ensureNestedDataProperties(c.schema??{},l??{});s={...s,...p}}else s[i]=this.ensureNestedDataProperties(c.schema??{},l[i]??{});else s[i]=l[i]??c.value??"";return s},{})}isVisible(a,l){return a.hasOwnProperty("conditions")?new RC(l,this.values).evaluate(rt.get(a,"conditions"),rt.get(a,"condition_type","and")):!0}triggerChange(a){for(let l of this.data.onChangeCallback)l(a)}onDataChanged(a){this.data.onChangeCallback.push(a)}setValue(a,l){rt.set(this.data.values,a,l),this.data.hasChange=!0,this.triggerChange(this.data.values)}reset(a=!0){if(!this.data.schema||!this.data._originalDefaults)throw new Error("Form is not initialized");const l=a?this.data._originalDefaults:this.data.defaults;return this.data.values=this.ensureNestedDataProperties(this.data.schema,JSON.parse(JSON.stringify(l))),this.data.validationErrors={},this.data.hasChange=!1,this.data.initialized=!0,this}}function ud(){return OC.init()}const HC=["innerHTML"],Ur={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,HC))}},PC=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"})),Du=Object.assign({name:"ValidationError"},{__name:"ValidationErrorNew",props:{errorKey:String,form:{type:Object,required:!0}},setup(e){return(t,a)=>e.form.hasValidationError(e.errorKey)?(r(),h("div",{key:0,class:de(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(O,null,ae(e.form.getValidationError(e.errorKey),(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},f(l),1))),128))],2)):k("",!0)}}),JA={__name:"Resolver",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},label:{type:String},attribute:{type:Object},callback:{type:Function}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>qt(()=>import("./chunks/Test.js?ver=1.5.1"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>qt(()=>Promise.resolve().then(()=>t2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>qt(()=>Promise.resolve().then(()=>m2),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>qt(()=>Promise.resolve().then(()=>h2),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>qt(()=>Promise.resolve().then(()=>PC),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>qt(()=>Promise.resolve().then(()=>n2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>qt(()=>Promise.resolve().then(()=>H2),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>qt(()=>Promise.resolve().then(()=>l2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>qt(()=>Promise.resolve().then(()=>y2),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>qt(()=>Promise.resolve().then(()=>g2),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>qt(()=>Promise.resolve().then(()=>e2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>qt(()=>Promise.resolve().then(()=>_2),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>qt(()=>Promise.resolve().then(()=>KC),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>qt(()=>Promise.resolve().then(()=>WC),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>qt(()=>Promise.resolve().then(()=>XC),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>qt(()=>Promise.resolve().then(()=>JC),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>qt(()=>import("./chunks/BuyProducts.js?ver=1.5.1"),[],import.meta.url),"./Coupon/Categories.vue":()=>qt(()=>import("./chunks/Categories.js?ver=1.5.1"),[],import.meta.url),"./Coupon/Code.vue":()=>qt(()=>import("./chunks/Code.js?ver=1.5.1"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>qt(()=>import("./chunks/GetProducts.js?ver=1.5.1"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>qt(()=>import("./chunks/Categories2.js?ver=1.5.1"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>qt(()=>import("./chunks/Product.js?ver=1.5.1"),[],import.meta.url),"./Coupon/Products.vue":()=>qt(()=>import("./chunks/Products.js?ver=1.5.1"),[],import.meta.url),"./McpSettings.vue":()=>qt(()=>import("./chunks/McpSettings.js?ver=1.5.1"),[],import.meta.url),"./ModuleSettings.vue":()=>qt(()=>import("./chunks/ModuleSettings.js?ver=1.5.1"),[],import.meta.url),"./PaymentView.vue":()=>qt(()=>import("./chunks/PaymentView.js?ver=1.5.1"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>qt(()=>import("./chunks/AddressComponent.js?ver=1.5.1"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>qt(()=>import("./chunks/CreatePageButton.js?ver=1.5.1"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>qt(()=>import("./chunks/PageSelector.js?ver=1.5.1"),[],import.meta.url),"./TurnstileSettings.vue":()=>qt(()=>import("./chunks/TurnstileSettings.js?ver=1.5.1"),[],import.meta.url)}),l=uf(null);Qe(()=>{s(i.name)});const s=async c=>{const p=`./${c}.vue`;a[p]&&(l.value=(await a[p]()).default)},i=e;return(c,p)=>(r(),h(O,null,[(r(),$(Cl(l.value),ga({name:e.name,field:e.field,fieldKey:e.fieldKey,value:e.value,variant:e.variant,nesting:e.nesting,statePath:e.statePath,form:e.form,attribute:e.attribute,label:e.label,callback:e.callback},{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=m=>t.value=m)}),null,16,["modelValue"])),Ca(c.$slots,"fieldNote"),Ca(c.$slots,"validationError")],64))}},NC=["id"],cd={__name:"FormGrid",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{var l,s,i,c,p,m,_,g,y,v;return r(),h("div",{class:"gap-2 grid grid-cols-dynamic sm:grid-cols-sm-dynamic md:grid-cols-md-dynamic lg:grid-cols-lg--dynamic",id:e.field.id||"",style:na({"--grid-columns":((l=e.field.columns)==null?void 0:l.default)??2,"--sm-grid-columns":((s=e.field.columns)==null?void 0:s.sm)??((i=e.field.columns)==null?void 0:i.default)??2,"--md-grid-columns":((c=e.field.columns)==null?void 0:c.sm)??((p=e.field.columns)==null?void 0:p.md)??((m=e.field.columns)==null?void 0:m.default)??2,"--lg-grid-columns":((_=e.field.columns)==null?void 0:_.lg)??((g=e.field.columns)==null?void 0:g.md)??((y=e.field.columns)==null?void 0:y.sm)??((v=e.field.columns)==null?void 0:v.default)??2})},[n(_i,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,NC)}}},KC=Object.freeze(Object.defineProperty({__proto__:null,default:cd},Symbol.toStringTag,{value:"Module"})),GC={key:0,class:"fct-content-card-header"},jC={key:0,class:"title"},zC={key:1,class:"fct-content-card-action"},qC={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:de({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",GC,[e.title||t.$slots.title?(r(),h("div",jC,[Ca(t.$slots,"title",{},()=>[R(f(e.title),1)])])):k("",!0),t.$slots.action?(r(),h("div",zC,[Ca(t.$slots,"action")])):k("",!0)])):k("",!0),o("div",{class:de({"fct-content-card-body":e.show_heading!==!1})},[Ca(t.$slots,"default")],2)],2))}},YC=["id"],ZA={__name:"FormSection",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",{class:"form-section",id:e.field.id||""},[n(xe,null,{default:d(()=>[e.field.show_title!==!1?(r(),$(Ve,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):k("",!0),n(ke,null,{default:d(()=>[n(cd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,YC))}},WC=Object.freeze(Object.defineProperty({__proto__:null,default:ZA},Symbol.toStringTag,{value:"Module"})),ep={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=V(""),l=V([]),s=tl(),i=_=>{const g=_.props.name;c(g)},c=_=>{const g=new URL(window.location.href);g.hash=`#/settings/${_}`,window.history.replaceState(null,"",g.toString())},p=()=>{const g=window.location.hash.split("/").pop().split("#")[0];l.value=Object.keys(t.field.schema);const y=l.value.find(v=>v===g);y?a.value=y:a.value=t.field.default_tab};let m;return Qe(()=>{m=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),Ct(()=>{m&&m()}),(_,g)=>{const y=B("el-tabs");return r(),$(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:de(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:d(()=>[n(_i,{form:e.form,schema:e.field.schema,value:e.value,"state-path":e.statePath},null,8,["form","schema","value","state-path"])]),_:1},8,["modelValue","class"])}}},XC=Object.freeze(Object.defineProperty({__proto__:null,default:ep},Symbol.toStringTag,{value:"Module"})),tp={__name:"FormTabPane",props:{fieldKey:{type:String},field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=B("el-tab-pane");return r(),$(l,{label:e.field.title,name:e.fieldKey},{default:d(()=>[n(_i,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},JC=Object.freeze(Object.defineProperty({__proto__:null,default:tp},Symbol.toStringTag,{value:"Module"}));class Ad{}Oe(Ad,"attributesBuilders",async(t,a,l)=>{if(t.attributes||(t.attributes={}),t.class&&(t.attributes.class=t.class),t.placeholder&&(t.attributes.placeholder=t.placeholder),typeof a!="function")return t.attributes??{};let s={};typeof t.events!="object"&&(s={}),s.hasOwnProperty("onChange")&&typeof s.onChange=="function"?s.onChange=(...i)=>{l.data.hasChange=!0,s.onChange(i)}:s.onChange=()=>{l.data.hasChange=!0};for(let i in t.events)s[i]=(...c)=>{a(t.events[i],c)};for(let i in t.attributes??{}){let c=t.attributes[i];typeof c=="function"&&await a(c,{})}return{...t.attributes??{},...s}});const ZC={__name:"LayoutRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;zt().ctx;const a=(i,c)=>{if(typeof i=="function")return i({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(c)&&c.length===1?c[0]:c})},l=V(!1),s=V({});return Qe(async()=>{s.value=await Ad.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,c)=>(r(),h(O,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),$(cd,ga({key:0,class:e.field.wrapperClass,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["class","form","field","value","fieldKey","statePath"])):k("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),$(ep,ga({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},s.value),null,16,["form","field","value","statePath"])):k("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),$(tp,ga({key:2,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["form","field","value","fieldKey","statePath"])):k("",!0),e.field.type==="section"?(r(),$(ZA,ga({key:3,form:e.form,statePath:e.field.disable_nesting===!0?e.fullStatePath:e.fieldKey+".",field:e.field,"field-key":e.fieldKey,value:e.field.disable_nesting===!0?e.value:e.value[e.fieldKey],nesting:e.field.disable_nesting===!0},s.value),null,16,["form","statePath","field","field-key","value","nesting"])):k("",!0)],64))}},ap={__name:"Switch",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue");return(a,l)=>{const s=B("el-switch");return r(),$(s,ga({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},e2=Object.freeze(Object.defineProperty({__proto__:null,default:ap},Symbol.toStringTag,{value:"Module"})),lp={__name:"Checkbox",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue");return(a,l)=>{const s=B("el-checkbox");return r(),$(s,ga({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{"true-value":"yes","false-value":"no",disabled:e.field.disabled}),{default:d(()=>[R(f(e.label),1)]),_:1},16,["modelValue","disabled"])}}},t2=Object.freeze(Object.defineProperty({__proto__:null,default:lp},Symbol.toStringTag,{value:"Module"})),a2=["innerHTML"],sp={__name:"RadioGroup",props:_l({field:{type:Object},statePath:{type:String},value:{required:!0},form:{type:Object},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=e,l=V([]),s=async(i="")=>{if(typeof a.field.options=="function")return l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:i});if(Array.isArray(a.field.options))return l.value=[...a.field.options]};return Qe(async()=>{await s()}),(i,c)=>{const p=B("el-radio"),m=B("el-radio-group");return r(),$(m,ga({modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=_=>t.value=_)},e.attribute),{default:d(()=>[(r(!0),h(O,null,ae(e.field.options,(_,g)=>(r(),$(p,{key:g,value:_.value,class:de(_.option_class)},{default:d(()=>[o("div",null,f(_.label),1),o("div",{innerHTML:_.note},null,8,a2)]),_:2},1032,["value","class"]))),128))]),_:1},16,["modelValue"])}}},l2=Object.freeze(Object.defineProperty({__proto__:null,default:sp},Symbol.toStringTag,{value:"Module"})),s2=["innerHTML"],Ns={__name:"Input",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=zt().ctx,a=Sl(e,"modelValue"),l=e,s=V(),i=async()=>{typeof l.field.prefix=="function"?s.value=await l.callback(l.field.prefix):s.value=l.field.prefix};return Qe(()=>{i()}),cf(()=>{i()}),K(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?ze.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(c,p)=>{var _;const m=B("el-input");return r(),$(m,ga({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),ta({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:d(()=>[n(JA,{form:e.form,name:e.field.prefix.component,field:e.field,value:e.value},null,8,["form","name","field","value"])]),key:"0"}:e.field.prefix?{name:"prefix",fn:d(()=>[o("div",{innerHTML:s.value},null,8,s2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},n2=Object.freeze(Object.defineProperty({__proto__:null,default:Ns},Symbol.toStringTag,{value:"Module"})),o2={key:0,class:"fct-color-presets-section"},i2=["aria-label"],r2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],d2={class:"fct-color-custom-row"},u2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},c2={key:1,class:"fct-color-picker-box"},A2={class:"fct-color-picker-trigger-wrap"},p2={key:0,class:"text-xs text-system-light"},f2={key:1,class:"fct-color-picker-action-wrap"},pd={__name:"ColorPicker",props:_l({field:{type:Object},statePath:{type:String},value:{default:null},form:{type:Object},callback:{type:Function},label:{type:String},attribute:{default:()=>({})},withPresets:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=()=>{t.value=""},l=m=>m?hs.findIndex(_=>_.toLowerCase()===m.toLowerCase()):-1,s=V(Math.max(0,l(t.value)));Ce(t,m=>{const _=l(m);_>=0&&(s.value=_)});const i=V([]),c=(m,_)=>{t.value=m,s.value=_},p=(m,_)=>{let g=_;if(m.key==="ArrowRight"||m.key==="ArrowDown")g=(_+1)%hs.length;else if(m.key==="ArrowLeft"||m.key==="ArrowUp")g=(_-1+hs.length)%hs.length;else if(m.key==="Home")g=0;else if(m.key==="End")g=hs.length-1;else return;m.preventDefault(),c(hs[g],g),Se(()=>{i.value[g]&&i.value[g].focus()})};return(m,_)=>{const g=B("el-color-picker"),y=B("el-input");return e.withPresets?(r(),h("div",o2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":A(u)("Color presets")},[(r(!0),h(O,null,ae(A(hs),(v,C)=>(r(),h("button",{key:v,ref_for:!0,ref:b=>i.value[C]=b,type:"button",class:de(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===v.toLowerCase()}]),style:na({background:v,"--swatch-color":v}),"aria-label":A(u)("Select color %1$s",v),"aria-pressed":!!(t.value&&t.value.toLowerCase()===v.toLowerCase()),tabindex:C===s.value?0:-1,onClick:b=>c(v,C),onKeydown:b=>p(b,C)},null,46,r2))),128))],8,i2),o("div",d2,[o("div",u2,[n(g,ga({modelValue:t.value,"onUpdate:modelValue":_[0]||(_[0]=v=>t.value=v),"color-format":"hex"},e.attribute,{disabled:e.field&&e.field.disabled}),null,16,["modelValue","disabled"])]),n(y,{modelValue:t.value,"onUpdate:modelValue":_[1]||(_[1]=v=>t.value=v),placeholder:A(u)("#000000"),"aria-label":A(u)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),h("div",c2,[o("div",A2,[n(g,ga({modelValue:t.value,"onUpdate:modelValue":_[2]||(_[2]=v=>t.value=v)},e.attribute,{disabled:e.field&&e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?k("",!0):(r(),$(ee,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),t.value?k("",!0):(r(),h("span",p2,f(A(u)("Add...")),1)),t.value?(r(),h("div",f2,[o("span",null,f(t.value),1),n(ee,{name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})])):k("",!0)]))}}},m2=Object.freeze(Object.defineProperty({__proto__:null,default:pd},Symbol.toStringTag,{value:"Module"})),np={__name:"Date",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue");return(a,l)=>{const s=B("el-date-picker");return r(),$(s,ga({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},h2=Object.freeze(Object.defineProperty({__proto__:null,default:np},Symbol.toStringTag,{value:"Module"})),op={__name:"Time",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue");return(a,l)=>{const s=B("el-time-select");return r(),$(s,ga({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},_2=Object.freeze(Object.defineProperty({__proto__:null,default:op},Symbol.toStringTag,{value:"Module"})),v2={key:0},ip={__name:"Select",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=e,l=V([]),s=V(!1),i=async(p="")=>{s.value=!0,typeof a.field.options=="function"&&(l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:p})),Array.isArray(a.field.options)&&(l.value=[...a.field.options]),s.value=!1};Qe(async()=>{await i()});const c=p=>typeof p.disabled=="function"?a.callback(p.disabled,{}):p.disabled;return(p,m)=>{const _=B("el-option"),g=B("el-select");return r(),$(g,ga({modelValue:t.value,"onUpdate:modelValue":m[0]||(m[0]=y=>t.value=y)},e.attribute,{"remote-method":i,loading:s.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:d(()=>[(r(!0),h(O,null,ae(l.value,(y,v)=>(r(),$(_,{key:v,value:y.value,label:y.label,disabled:c(y)},{default:d(()=>[y.slot?(r(),h("span",v2,f(y.slot),1)):k("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},g2=Object.freeze(Object.defineProperty({__proto__:null,default:ip},Symbol.toStringTag,{value:"Module"})),rp={__name:"RemoteSearchableSelect",props:_l({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue"),a=e,l=V(!1),s=V(a.field.options||[]),i=c=>{if(a.field.search_only_on_type===!0){if(c.query.length===0)return}else if(c.query.length<1&&s.value.length>0)return;l.value=!0,ce.get("forms/search_options",{search_by:c.query,search_for:c.key}).then(p=>{s.value=p.options,l.value=!1})};return(c,p)=>{const m=B("el-option"),_=B("el-select");return r(),$(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??A(u)("Please enter a keyword"),"remote-method":g=>{i({query:g,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:d(()=>[(r(!0),h(O,null,ae(s.value,g=>(r(),$(m,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},y2=Object.freeze(Object.defineProperty({__proto__:null,default:rp},Symbol.toStringTag,{value:"Module"}));function sn(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}sn(".vel-fade-enter-active,.vel-fade-leave-active{-webkit-transition:all .3s ease;transition:all .3s ease}.vel-fade-enter-from,.vel-fade-leave-to{opacity:0}.vel-img-swiper{display:block;position:relative}.vel-modal{background:rgba(0,0,0,.5);bottom:0;left:0;margin:0;position:fixed;right:0;top:0;z-index:9998}.vel-img-wrapper{left:50%;margin:0;position:absolute;top:50%;-webkit-transform:translate(-50% -50%);transform:translate(-50% -50%);-webkit-transition:.3s linear;transition:.3s linear;will-change:transform opacity}.vel-img,.vel-img-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-img{background-color:rgba(0,0,0,.7);-webkit-box-shadow:0 5px 20px 2px rgba(0,0,0,.7);box-shadow:0 5px 20px 2px rgba(0,0,0,.7);display:block;max-height:80vh;max-width:80vw;position:relative;-webkit-transition:-webkit-transform .3s ease-in-out;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;transition:transform .3s ease-in-out,-webkit-transform .3s ease-in-out}@media (max-width:750px){.vel-img{max-height:95vh;max-width:85vw}}.vel-btns-wrapper{position:static}.vel-btns-wrapper .btn__close,.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;font-size:32px;opacity:.6;outline:none;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:.15s linear;transition:.15s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-btns-wrapper .btn__close:hover,.vel-btns-wrapper .btn__next:hover,.vel-btns-wrapper .btn__prev:hover{opacity:1}.vel-btns-wrapper .btn__close.disable,.vel-btns-wrapper .btn__close.disable:hover,.vel-btns-wrapper .btn__next.disable,.vel-btns-wrapper .btn__next.disable:hover,.vel-btns-wrapper .btn__prev.disable,.vel-btns-wrapper .btn__prev.disable:hover{cursor:default;opacity:.2}.vel-btns-wrapper .btn__next{right:12px}.vel-btns-wrapper .btn__prev{left:12px}.vel-btns-wrapper .btn__close{right:10px;top:24px}@media (max-width:750px){.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{font-size:20px}.vel-btns-wrapper .btn__close{font-size:24px}.vel-btns-wrapper .btn__next{right:4px}.vel-btns-wrapper .btn__prev{left:4px}}.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:12px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:12px}@media (max-width:750px){.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:4px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:4px}}.vel-modal.is-rtl .vel-img-title{direction:rtl}");sn('.vel-loading{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-loading .ring{display:inline-block;height:64px;width:64px}.vel-loading .ring:after{-webkit-animation:ring 1.2s linear infinite;animation:ring 1.2s linear infinite;border-color:hsla(0,0%,100%,.7) transparent;border-radius:50%;border-style:solid;border-width:5px;content:" ";display:block;height:46px;margin:1px;width:46px}@-webkit-keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}');sn(".vel-on-error{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-on-error .icon{color:#aaa;font-size:80px}");sn(".vel-img-title{bottom:60px;color:#ccc;cursor:default;font-size:12px;left:50%;line-height:1;max-width:80%;opacity:.8;overflow:hidden;position:absolute;text-align:center;text-overflow:ellipsis;-webkit-transform:translate(-50%);transform:translate(-50%);-webkit-transition:opacity .15s;transition:opacity .15s;white-space:nowrap}.vel-img-title:hover{opacity:1}");sn(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");sn(".vel-toolbar{border-radius:4px;bottom:8px;display:-webkit-box;display:-ms-flexbox;display:flex;left:50%;opacity:.9;overflow:hidden;padding:0;position:absolute;-webkit-transform:translate(-50%);transform:translate(-50%)}.vel-toolbar,.vel-toolbar .toolbar-btn{background-color:#2d2d2d;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-toolbar .toolbar-btn{-ms-flex-negative:0;-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;flex-shrink:0;font-size:20px;outline:none;padding:6px 10px}.vel-toolbar .toolbar-btn:active,.vel-toolbar .toolbar-btn:hover{background-color:#3d3d3d}");const bl="vel",Ul=jl({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>n("svg",{class:`${bl}-icon icon`,"aria-hidden":"true"},[n("use",{"xlink:href":`#icon-${e.type}`},null)])}),mi=typeof window<"u",Ks=()=>{};let dp=!1;if(mi)try{const e={};Object.defineProperty(e,"passive",{get(){dp=!0}}),window.addEventListener("test-passive",Ks,e)}catch{}const Vu=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];mi&&e.addEventListener(t,a,!!dp&&{capture:!1,passive:l})},Tu=(e,t,a)=>{mi&&e.removeEventListener(t,a)},b2=e=>{e.preventDefault()},w2=Object.prototype.toString,fd=e=>t=>w2.call(t).slice(8,-1)===e,C2=e=>!!e&&fd("Object")(e),Mu=e=>!!e&&fd("String")(e);function B2(e){return e!=null}const k2=jl({name:"Toolbar",props:{zoomIn:{type:Function,default:Ks},zoomOut:{type:Function,default:Ks},rotateLeft:{type:Function,default:Ks},rotateRight:{type:Function,default:Ks},resize:{type:Function,default:Ks},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>n("div",{class:`${bl}-toolbar`},[!e.zoomDisabled&&n(O,null,[n("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[n(Ul,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(Ul,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(Ul,{type:"resize"},null)]),!e.rotateDisabled&&n(O,null,[n("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[n(Ul,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(Ul,{type:"rotate-right"},null)])])])}),x2=()=>n("div",{class:`${bl}-loading`},[n("div",{class:"ring"},null)]),S2=()=>n("div",{class:`${bl}-on-error`},[n("div",{class:"ring"},null),n(Ul,{type:"img-broken"},null)]),F2=(e,t)=>{let{slots:a}=t;return n("div",{class:`${bl}-img-title`},[a.default?a.default():""])},$2=jl({name:"DefaultIcons",setup:()=>()=>n("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[n("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[n("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973z m282.559912-479.07185A509.887841 509.887841 0 0 0 511.99984 0.00032C229.215928 0.00032 0 229.216248 0 512.00016s229.215928 511.99984 511.99984 511.99984 511.99984-229.215928 511.99984-511.99984c0-3.743999-0.032-7.455998-0.128-11.167997-1.631999-11.295996-8.159997-27.103992-31.87199-27.103991-27.487991 0-31.67999 21.247993-32.03199 32.06399l0.032 4.127999a30.62399 30.62399 0 0 0 0.16 2.079999H959.9997c0 247.423923-200.575937 447.99986-447.99986 447.99986S63.99998 759.424083 63.99998 512.00016 264.575917 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 1 277.439913 96.22397l-94.91197 91.679971c-25.439992 24.607992-17.439995 44.991986 17.887994 45.599986l188.031942 3.295999a64.31998 64.31998 0 0 0 65.055979-62.84798l3.295999-188.127942C969.407697 15.040315 949.311703 5.792318 923.871711 30.368311l-87.999972 85.023973z",fill:""},null)]),n("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[n("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973zM188.159941 115.392284A509.887841 509.887841 0 0 1 511.99984 0.00032c282.783912 0 511.99984 229.215928 511.99984 511.99984s-229.215928 511.99984-511.99984 511.99984S0 794.784072 0 512.00016c0-3.743999 0.032-7.455998 0.128-11.167997 1.631999-11.295996 8.159997-27.103992 31.87199-27.103991 27.487991 0 31.67999 21.247993 32.03199 32.06399L63.99998 509.920161a30.62399 30.62399 0 0 1-0.16 2.079999H63.99998c0 247.423923 200.575937 447.99986 447.99986 447.99986s447.99986-200.575937 447.99986-447.99986S759.423763 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 0-277.439913 96.22397l94.91197 91.679971c25.439992 24.607992 17.439995 44.991986-17.887994 45.599986L123.551961 300.800226a64.31998 64.31998 0 0 1-65.055979-62.84798l-3.295999-188.127942C54.591983 15.040315 74.687977 5.792318 100.127969 30.368311l87.999972 85.023973z",fill:""},null)]),n("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[n("path",{d:"M456.036919 791.8108 270.553461 791.8108 460.818829 601.572038l-39.593763-39.567157L231.314785 751.915162l0.873903-183.953615c0-15.465227-12.515035-27.981285-27.981285-27.981285s-27.981285 12.515035-27.981285 27.981285l0 251.829516c0 8.3072 3.415796 14.975063 8.826016 19.564591 5.082762 5.192256 12.132318 8.416693 19.947308 8.416693l251.036453 0c15.46625 0 27.981285-12.514012 27.981285-27.981285C484.018204 804.325835 471.504192 791.8108 456.036919 791.8108zM838.945819 184.644347c-5.082762-5.191232-12.132318-8.416693-19.947308-8.416693L567.961034 176.227654c-15.46625 0-27.981285 12.515035-27.981285 27.981285 0 15.46625 12.514012 27.981285 27.981285 27.981285l185.483458 0L563.206754 422.427962l39.567157 39.567157 189.910281-189.910281-0.873903 183.953615c0 15.46625 12.514012 27.981285 27.981285 27.981285s27.981285-12.514012 27.981285-27.981285L847.772858 204.208938C847.771835 195.902762 844.356039 189.234899 838.945819 184.644347zM847.771835 64.303538 176.227142 64.303538c-61.809741 0-111.924115 50.115398-111.924115 111.924115l0 671.544693c0 61.809741 50.114374 111.924115 111.924115 111.924115l671.544693 0c61.809741 0 111.924115-50.114374 111.924115-111.924115l0-671.544693C959.69595 114.418936 909.581576 64.303538 847.771835 64.303538zM903.733381 847.772346c0 30.878265-25.056676 55.962569-55.962569 55.962569L176.227142 903.734916c-30.90487 0-55.962569-25.084305-55.962569-55.962569l0-671.544693c0-30.9325 25.056676-55.962569 55.962569-55.962569l671.544693 0c30.90487 0 55.962569 25.03007 55.962569 55.962569L903.734404 847.772346z"},null)]),n("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[n("path",{d:"M810.666667 128H213.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333v597.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h597.333334c46.933333 0 85.333333-38.4 85.333333-85.333333V213.333333c0-46.933333-38.4-85.333333-85.333333-85.333333z m0 682.666667H213.333333v-195.413334l42.24 42.24 170.666667-170.666666 170.666667 170.666666 170.666666-170.24L810.666667 530.346667V810.666667z m0-401.493334l-43.093334-43.093333-170.666666 171.093333-170.666667-170.666666-170.666667 170.666666-42.24-42.666666V213.333333h597.333334v195.84z"},null)]),n("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[n("path",{d:"M784.652701 955.6957 346.601985 517.644983c-2.822492-2.822492-2.822492-7.902977 0-11.289967l439.179713-439.179713c6.77398-6.77398 10.725469-16.370452 10.725469-25.966924L796.507166 36.692393c0-20.32194-16.370452-36.692393-36.692393-36.692393l-4.515987 0c-9.596472 0-19.192944 3.951488-25.966924 10.725469L250.072767 489.420066c-12.418964 12.418964-12.418964 32.740904 0 45.159868l477.565601 477.565601c7.338479 7.338479 17.499449 11.854465 28.224917 11.854465l0 0c22.015436 0 40.079383-18.063947 40.079383-40.079383l0 0C796.507166 973.759647 791.99118 963.598677 784.652701 955.6957z"},null)]),n("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[n("path",{d:"M246.121279 955.6957l438.050717-438.050717c2.822492-2.822492 2.822492-7.902977 0-11.289967L244.992282 67.175303c-6.77398-6.77398-10.725469-16.370452-10.725469-25.966924L234.266814 36.692393C234.266814 16.370452 250.637266 0 270.959206 0l4.515987 0c9.596472 0 19.192944 3.951488 25.966924 10.725469l478.694598 478.694598c12.418964 12.418964 12.418964 32.740904 0 45.159868l-477.565601 477.565601c-7.338479 7.338479-17.499449 11.854465-28.224917 11.854465l0 0c-22.015436 0-40.079383-18.063947-40.079383-40.079383l0 0C234.266814 973.759647 238.7828 963.598677 246.121279 955.6957z"},null)]),n("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[n("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),n("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),n("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[n("path",{d:"M570.24 512l259.2 259.2-58.88 58.24L512 570.24l-261.12 261.12-58.24-58.24L453.76 512 194.56 252.8l58.24-58.24L512 453.76l261.12-261.12 58.24 58.24z"},null)]),n("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[n("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),kn=mi?window:global;let Lu=Date.now();function E2(e){const t=Date.now(),a=Math.max(0,16-(t-Lu)),l=setTimeout(e,a);return Lu=t+a,l}function Gi(e){return(kn.requestAnimationFrame||E2).call(kn,e)}function Ru(e){(kn.cancelAnimationFrame||kn.clearTimeout).call(kn,e)}function Ou(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function ji(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Af(e)}var zi=jl({name:"VueEasyLightbox",props:{imgs:{type:[Array,String],default:()=>""},visible:{type:Boolean,default:!1},index:{type:Number,default:0},scrollDisabled:{type:Boolean,default:!0},escDisabled:{type:Boolean,default:!1},moveDisabled:{type:Boolean,default:!1},titleDisabled:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!0},teleport:{type:[String,Object],default:null},swipeTolerance:{type:Number,default:50},loop:{type:Boolean,default:!1},rtl:{type:Boolean,default:!1},zoomScale:{type:Number,default:.12},maxZoom:{type:Number,default:3},minZoom:{type:Number,default:.1},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1},pinchDisabled:{type:Boolean,default:!1},dblclickDisabled:{type:Boolean,default:!1}},emits:{hide:()=>!0,"on-error":e=>!0,"on-prev":(e,t)=>!0,"on-next":(e,t)=>!0,"on-prev-click":(e,t)=>!0,"on-next-click":(e,t)=>!0,"on-index-change":(e,t)=>!0,"on-rotate":e=>!0},setup(e,t){let{emit:a,slots:l}=t;const{imgRef:s,imgState:i,setImgSize:c}=(()=>{const Fe=V(),Ee=gn({width:0,height:0,maxScale:1});return{imgRef:Fe,imgState:Ee,setImgSize:()=>{if(Fe.value){const{width:Pe,height:Me,naturalWidth:ht}=Fe.value;Ee.maxScale=ht/Pe,Ee.width=Pe,Ee.height=Me}}}})(),p=V(e.index),m=V(""),_=gn({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=gn({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=K(()=>{return Fe=e.imgs,fd("Array")(Fe)?e.imgs.map(Ee=>typeof Ee=="string"?{src:Ee}:function(Pe){return C2(Pe)&&Mu(Pe.src)}(Ee)?Ee:void 0).filter(B2):Mu(e.imgs)?[{src:e.imgs}]:[];var Fe}),v=K(()=>y.value[p.value]),C=K(()=>{var Fe;return(Fe=y.value[p.value])==null?void 0:Fe.src}),b=K(()=>{var Fe;return(Fe=y.value[p.value])==null?void 0:Fe.title}),w=K(()=>{var Fe;return(Fe=y.value[p.value])==null?void 0:Fe.alt}),x=K(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${_.top}px)`,left:`calc(50% + ${_.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${_.scale}) rotate(${_.rotateDeg}deg)`})),F=()=>{a("hide")},L=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},U=(Fe,Ee)=>{const Pe=p.value;L(),p.value=Fe,y.value[p.value]===y.value[Fe]&&Se(()=>{g.loading=!1}),e.visible&&Pe!==Fe&&(Ee&&Ee(Pe,Fe),a("on-index-change",Pe,Fe))},S=()=>{const Fe=p.value,Ee=e.loop?(Fe+1)%y.value.length:Fe+1;!e.loop&&Ee>y.value.length-1||U(Ee,(Pe,Me)=>{a("on-next",Pe,Me),a("on-next-click",Pe,Me)})},M=()=>{const Fe=p.value;let Ee=Fe-1;if(Fe===0){if(!e.loop)return;Ee=y.value.length-1}U(Ee,(Pe,Me)=>{a("on-prev",Pe,Me),a("on-prev-click",Pe,Me)})},I=Fe=>{Math.abs(1-Fe)<.05?Fe=1:Math.abs(i.maxScale-Fe)<.05&&(Fe=i.maxScale),_.lastScale=_.scale,_.scale=Fe},T=()=>{const Fe=_.scale+e.zoomScale;Fe<i.maxScale*e.maxZoom&&I(Fe)},Q=()=>{const Fe=_.scale-e.zoomScale;Fe>e.minZoom&&I(Fe)},E=()=>{const Fe=_.rotateDeg%360;a("on-rotate",Math.abs(Fe<0?Fe+360:Fe))},D=()=>{_.rotateDeg-=90,E()},H=()=>{_.rotateDeg+=90,E()},P=()=>{_.scale=1,_.top=0,_.left=0},G=function(){let Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&Fe===0},{onMouseDown:J,onMouseMove:oe,onMouseUp:Z}=((Fe,Ee,Pe)=>{let Me,ht=!1;return{onMouseDown:At=>{Fe.initX=Fe.lastX=At.clientX,Fe.initY=Fe.lastY=At.clientY,Ee.dragging=!0,ht=!1,At.stopPropagation()},onMouseUp:At=>{Pe(At.button)&&Ru(Me),Ee.dragging=!1,ht=!1},onMouseMove:At=>{if(Ee.dragging)if(Pe(At.button)){if(ht)return;ht=!0,Me=Gi(()=>{const{top:Mt,left:Ft,lastY:$t,lastX:ct}=Fe;Fe.top=Mt-$t+At.clientY,Fe.left=Ft-ct+At.clientX,Fe.lastX=At.clientX,Fe.lastY=At.clientY,ht=!1})}else Fe.lastX=At.clientX,Fe.lastY=At.clientY;At.stopPropagation()}}})(_,g,G),{onTouchStart:W,onTouchMove:pe,onTouchEnd:N}=((Fe,Ee,Pe,Me,ht)=>{let At,Mt=!1;return{onTouchStart:Ft=>{const{touches:$t}=Ft;$t.length>1&&ht()?(Pe.gesturing=!0,Ee.touches=$t):(Ee.initX=Ee.lastX=$t[0].clientX,Ee.initY=Ee.lastY=$t[0].clientY,Pe.dragging=!0),Ft.stopPropagation()},onTouchMove:Ft=>{if(Mt)return;const{touches:$t}=Ft,{lastX:ct,lastY:Ut,left:St,top:Dt,scale:Et}=Ee;if(!Pe.gesturing&&Pe.dragging){if(!$t[0])return;const{clientX:It,clientY:Ht}=$t[0];Me()?At=Gi(()=>{Ee.lastX=It,Ee.lastY=Ht,Ee.top=Dt-Ut+Ht,Ee.left=St-ct+It,Mt=!1}):(Ee.lastX=It,Ee.lastY=Ht)}else Pe.gesturing&&Ee.touches.length>1&&$t.length>1&&ht()&&(At=Gi(()=>{const It=(Ou(Ee.touches[0],Ee.touches[1])-Ou($t[0],$t[1]))/Fe.width;Ee.touches=$t;const Ht=Et-1.3*It;Ht>.5&&Ht<1.5*Fe.maxScale&&(Ee.scale=Ht),Mt=!1}))},onTouchEnd:()=>{Ru(At),Pe.dragging=!1,Pe.gesturing=!1,Mt=!1}}})(i,_,g,G,()=>!e.pinchDisabled),j=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},q=Fe=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),Fe.deltaY<0?T():Q())},X=Fe=>{const Ee=Fe;e.visible&&(!e.escDisabled&&Ee.key==="Escape"&&e.visible&&F(),Ee.key==="ArrowLeft"&&(e.rtl?S():M()),Ee.key==="ArrowRight"&&(e.rtl?M():S()))},ie=()=>{e.maskClosable&&F()},ge=()=>{c()},fe=()=>{g.loading=!1},he=Fe=>{g.loading=!1,g.loadError=!0,a("on-error",Fe)},le=()=>{e.visible&&c()};Ce(()=>e.index,Fe=>{Fe<0||Fe>=y.value.length||U(Fe)}),Ce(()=>g.dragging,(Fe,Ee)=>{const Pe=!Fe&&Ee;if(!G()&&Pe){const Me=_.lastX-_.initX,ht=_.lastY-_.initY,At=e.swipeTolerance;Math.abs(Me)>Math.abs(ht)&&(Me<-1*At?S():Me>At&&M())}}),Ce(()=>e.visible,Fe=>{if(Fe){L();const Ee=y.value.length;if(Ee===0)return p.value=0,g.loading=!1,void Se(()=>g.loadError=!0);p.value=e.index>=Ee?Ee-1:e.index<0?0:e.index,e.scrollDisabled&&me()}else e.scrollDisabled&&Ue()});const me=()=>{document&&(m.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},Ue=()=>{document&&(document.body.style.overflowY=m.value)};Qe(()=>{Vu(document,"keydown",X),Vu(window,"resize",le)}),vl(()=>{Tu(document,"keydown",X),Tu(window,"resize",le),e.scrollDisabled&&Ue()});const et=()=>g.loading?l.loading?l.loading({key:"loading"}):n(x2,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n(S2,{key:"img-on-error"},null):n("div",{class:`${bl}-img-wrapper`,style:x.value,key:"img-wrapper"},[n("img",{alt:w.value,ref:s,draggable:"false",class:`${bl}-img`,src:C.value,onMousedown:J,onMouseup:Z,onMousemove:oe,onTouchstart:W,onTouchmove:pe,onTouchend:N,onLoad:ge,onDblclick:j,onDragstart:Fe=>{Fe.preventDefault()}},null)]),be=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:M});if(y.value.length<=1)return;const Fe=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(Fe?"disable":""),onClick:M},[e.rtl?n(Ul,{type:"next"},null):n(Ul,{type:"prev"},null)])},qe=()=>{if(l["next-btn"])return l["next-btn"]({next:S});if(y.value.length<=1)return;const Fe=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(Fe?"disable":""),onClick:S},[e.rtl?n(Ul,{type:"prev"},null):n(Ul,{type:"next"},null)])},gt=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):b.value?n(F2,null,{default:()=>[b.value]}):void 0},Ze=()=>{let Fe;if(e.visible)return n("div",{onTouchmove:b2,class:[`${bl}-modal`,e.rtl?"is-rtl":""],onClick:Ne(ie,["self"]),onWheel:q},[n($2,null,null),n(Gl,{name:`${bl}-fade`,mode:"out-in"},ji(Fe=et())?Fe:{default:()=>[Fe]}),n("img",{style:"display:none;",src:C.value,onError:he,onLoad:fe},null),n("div",{class:`${bl}-btns-wrapper`},[be(),qe(),gt(),l["close-btn"]?l["close-btn"]({close:F}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:F},[n(Ul,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:T,zoomOut:Q,rotate:D,rotateLeft:D,rotateRight:H,resize:P},zoomIn:T,zoomOut:Q,rotate:D,rotateLeft:D,rotateRight:H,resize:P}):n(k2,{zoomIn:T,zoomOut:Q,resize:P,rotateLeft:D,rotateRight:H,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let Fe;if(e.teleport){let Ee;return n(Xo,{to:e.teleport},{default:()=>[n(Gl,{name:`${bl}-fade`},ji(Ee=Ze())?Ee:{default:()=>[Ee]})]})}return n(Gl,{name:`${bl}-fade`},ji(Fe=Ze())?Fe:{default:()=>[Fe]})}}});const U2=Object.assign(zi,{install:e=>{e.component(zi.name,zi)}}),I2={name:"Attachments",components:{MediaButton:Mc,VueEasyLightbox:U2,IconButton:Xe,Delete:gs},props:{multiple:Boolean,attachments:{type:[Array,Object],default:()=>[]},empty_text:String,isSingle:Boolean,title:String,type:String,icon:String,showList:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},previewImage:{type:Boolean,default:!0},mediaInputSize:{type:String},mediaInputBg:{type:String}},emits:["removeImage","mediaUploaded"],data(){return{visible:!1,imageIndex:0,lightboxData:[],images:V([])}},computed:{showMediaButtonAsIcon:function(){return!this.multiple&&this.attachments.length===1}},watch:{attachments:{handler:function(e,t){return this.lightboxData=[],Array.isArray(e)&&e.length>0&&e.map((a,l)=>{this.lightboxData.push(a.url)}),e},deep:!0}},mounted:function(){Array.isArray(this.attachments)&&this.attachments.length>0&&this.attachments.forEach(e=>{this.lightboxData.push(e.url),this.images.push({id:e.id,url:e.url,title:e.title})})},methods:{translate:u,removeImageEvent(e){this.$emit("removeImage",e)},onMediaSelected(e){this.images=e.map(t=>({id:t.id,title:t.title,url:t.url})),this.$emit("mediaUploaded",this.images)}}},Q2={class:"fct-attachments-wrap",style:{position:"relative"}},D2={class:"fct-attachment-img-wrap"},V2=["src","alt","onClick"],T2={class:"fct-attachments-button"};function M2(e,t,a,l,s,i){const c=B("VueEasyLightbox"),p=B("MediaButton"),m=B("IconButton"),_=B("Delete");return r(),h(O,null,[n(c,{visible:s.visible,imgs:s.lightboxData,index:s.imageIndex,onHide:t[0]||(t[0]=()=>{s.visible=!1})},null,8,["visible","imgs","index"]),o("div",Q2,[a.attachments?(r(),h("ul",{key:0,class:de(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(O,{key:0},ae(a.attachments,(g,y)=>(r(),h("li",{key:y,class:de([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",D2,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,V2)):k("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),$(m,{key:1,size:"x-small"},{default:d(()=>[n(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):k("",!0)]),o("div",T2,[a.showDeleteButton?(r(),$(m,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ne(v=>i.removeImageEvent(y),["prevent"]),title:i.translate("Delete media")},{default:d(()=>[a.multiple?(r(),$(_,{key:0})):(r(),h(O,{key:1},[R(f(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):k("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),$(m,{key:1,size:"x-small"},{default:d(()=>[n(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):k("",!0)])],2))),128)):k("",!0),i.showMediaButtonAsIcon?k("",!0):(r(),h("li",{key:1,class:de([a.mediaInputSize,a.mediaInputBg])},[n(p,{"icon-mode":!1,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])],2))],2)):k("",!0),Ca(e.$slots,"default")])],64)}const up=lt(I2,[["render",M2]]),L2={key:0},R2={key:0,class:"setting-label"},hi={__name:"MediaInput",props:{modelValue:{default:""},showSupported:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},fullWidth:{type:Boolean,default:!1},icon:{type:String},title:{type:String},mediaInputSize:{type:String},mediaInputBg:{type:String},field:{type:Object}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=V();let i=V([]);const c=()=>{a.multiple?s.value=[]:s.value="",i.value=[],l("update:modelValue",s.value)},p=_=>{if(_.length)if(a.multiple){s.value=[],i.value=[];for(const g of _)s.value.push(g),i.value.push(g)}else s.value=_,i.value=_;l("update:modelValue",s.value)};Ce(()=>a.modelValue,_=>{Array.isArray(_)&&_.length>0?s.value=_:_&&typeof _=="string"&&_!==""?s.value=[_]:_&&typeof _=="object"?s.value=[_]:s.value=[],m()});const m=()=>{i.value=[],Object.values(s.value).forEach((_,g)=>{_!==void 0&&_!==""&&i.value.push(_)})};return Qe(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?s.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?s.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?s.value=[a.modelValue]:s.value=[],m()}),(_,g)=>(r(),h(O,null,[n(up,{attachments:A(i),onMediaUploaded:p,onRemoveImage:c,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(r(),h("div",L2,[e.field&&e.field.label?(r(),h("label",R2,f(e.field.label),1)):k("",!0),o("span",null,f(A(u)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):k("",!0)],64))}},O2={class:"setting-media-wrap"},cp={__name:"Media",props:_l({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Sl(e,"modelValue");return(a,l)=>(r(),h("div",O2,[n(hi,ga({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},H2=Object.freeze(Object.defineProperty({__proto__:null,default:cp},Symbol.toStringTag,{value:"Module"})),P2={__name:"InputRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;V(!1),zt().ctx;const a=_=>typeof _.label=="function"?_.label(t.value,t.statePath,t.form):_.label,l=(_,g)=>{if(typeof _=="function")return _({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(g)&&g.length===1?g[0]:g})},s=V(!1);let i={};Qe(async()=>{i=await Ad.attributesBuilders(t.field,l,t.form),s.value=!0});const c={switch:ap,checkbox:lp,radio:sp,input:Ns,text:Ns,email:Ns,number:Ns,textarea:Ns,color:pd,date:np,time:op,select:ip,media:cp,remote_select:rp},p=K(()=>c[t.field.type]||null),m=K(()=>({modelValue:t.value[t.fieldKey],form:t.form,statePath:t.statePath,field:t.field,fieldKey:t.fieldKey,value:t.value[t.fieldKey],nesting:!1,label:a(t.field),attribute:i,callback:l}));return(_,g)=>e.field.type==="wp-editor"?(r(),$(Wl,{key:0,shortCodes:e.field.shortcodes.data,modelValue:t.value[t.fieldKey],onUpdate:g[0]||(g[0]=y=>{t.value[t.fieldKey]=y})},null,8,["shortCodes","modelValue"])):p.value&&s.value?(r(),$(Cl(p.value),ga({key:1,onChange:g[1]||(g[1]=y=>{e.form.triggerChange(y)}),onInput:g[2]||(g[2]=y=>{e.form.triggerChange(e.value[e.fieldKey])}),modelValue:e.value[e.fieldKey],"onUpdate:modelValue":g[3]||(g[3]=y=>e.value[e.fieldKey]=y)},m.value),null,16,["modelValue"])):k("",!0)}},N2=["innerHTML"],K2={key:0},G2={key:0},_i={__name:"FormRenderer",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},statePath:{type:String}},setup(e){const t=e,a=t.statePath??"",l=["grid","section","tab","tab-pane"];V(!1),zt().ctx;const s=(c,p)=>{if(typeof c.label=="function"){let m=i(c)?a:p+".",_=i(c)?t.value:t.value[p];return c.label(_,m,t.form)}return c.label},i=c=>c.disable_nesting!==!1;return(c,p)=>(r(!0),h(O,null,ae(e.schema,(m,_)=>(r(),h(O,{key:_},[e.form.isVisible(m,e.statePath+_)?(r(),h(O,{key:0},[m.type==="html"?(r(),h("div",{key:0,class:de(`setting-html-wrapper ${m.wrapperClass??""}`),innerHTML:m.value},null,10,N2)):(r(),h(O,{key:1},[m.component?(r(),h("div",{key:0,class:de(m.wrapperClass??"")},[m.component&&m.label?(r(),$(ca,{key:0,title:s(m,_),content:m.tooltip,class:"setting-label",placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",K2,"("+f(m.labelOptional)+")",1)):k("",!0)]),_:2},1032,["title","content","placement"])):k("",!0),n(JA,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:m.component,form:e.form,statePath:i(m)?A(a):_+".",field:m,"field-key":_,value:i(m)?e.value:e.value[_],nesting:i(m)},{fieldNote:d(()=>[m.note&&m.hide_note!==!0?(r(),$(Ur,{key:0,note:m.note},null,8,["note"])):k("",!0)]),validationError:d(()=>[n(Du,{form:e.form,"error-key":A(a)+_},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):k("",!0),l.includes(m.type)?(r(),$(ZC,{key:1,form:e.form,field:m,value:e.value,"full-state-path":A(a),statePath:i(m)?A(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):k("",!0),typeof m.type<"u"&&!l.includes(m.type)&&!["custom","component","html","hidden"].includes(m.type)?(r(),h("div",{key:2,class:de(`setting-fields-inner ${m.wrapperClass??""}`)},[m.type!=="checkbox"&&!m.component&&m.label!==!1?(r(),$(ca,{key:0,class:"setting-label",title:s(m,_),content:m.tooltip,placement:m.tooltip_placement},{default:d(()=>[m.labelOptional?(r(),h("span",G2,"("+f(m.labelOptional)+")",1)):k("",!0)]),_:2},1032,["title","content","placement"])):k("",!0),n(P2,{form:e.form,field:m,value:e.value,"full-state-path":A(a),"state-path":e.statePath,"field-key":_},null,8,["form","field","value","full-state-path","state-path","field-key"]),m.note&&!m.component?(r(),$(Ur,{key:1,note:m.note},null,8,["note"])):k("",!0),m.component?k("",!0):(r(),$(Du,{key:2,form:e.form,"error-key":A(a)+_},null,8,["form","error-key"]))],2)):k("",!0)],64))],64)):k("",!0)],64))),128))}},j2={key:0,class:"vue-form-wrap"},z2={key:0,class:"form-section-save-action"},q2={key:0,class:"cmd block leading-none"},vi={__name:"VueForm",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},showSubmitButton:{type:Boolean,default:!1},submitButtonText:{type:String,default:"Save"},loading:{type:Boolean,default:!1}},emits:["onSubmit","onChange","onSubmitButtonClick"],setup(e,{expose:t,emit:a}){const l=al(),s=e,i=a;Ce(()=>s.form.isReady,()=>{Se(()=>Zs.scrollToHashSection(l.hash))},{once:!0}),Qe(()=>{Se(()=>{c.registerCopyAction(),s.form.isReady&&Zs.scrollToHashSection(l.hash)})}),V({});const c=zt().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(_,g)=>{const y=B("el-button");return e.form.isReady?(r(),h("div",j2,[n(_i,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",z2,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:d(()=>[e.loading?k("",!0):(r(),h("span",q2,"⌘s")),R(" "+f(e.submitButtonText),1)]),_:1},8,["loading"])])):k("",!0)])):k("",!0)}}},Y2={key:0},W2={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=ud();const s=a,i=e,c=()=>{const g=i.form_name,y={};return y[g]={...l.values},y},p=()=>{l.reset()},m=()=>{var g;return((g=i.widget)==null?void 0:g.reset_on_save)==!0},_=Pr("triggerChange");return Qe(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),s("change")})}),t({getState:c,resetForm:p,resetOnSave:m}),(g,y)=>A(l).isReady?(r(),h("div",Y2,[n(vi,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:A(l),onOnSubmitButtonClick:y[0]||(y[0]=()=>{A(l).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):k("",!0)}},X2={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=V(null);let l=null;const s=()=>{a.value&&(l=Jt(a.value),l.setOption(t.option))};Ce(()=>t.option,m=>{l&&m&&l.setOption(m,!0)},{deep:!0});const i=(m,_)=>{if(m==null||m==="")return _;const g=Number(m);return isNaN(g)?m:`${g}px`},c=K(()=>i(t.height,"400px")),p=K(()=>i(t.width,"100%"));return Qe(()=>{s(),window.addEventListener("resize",()=>l==null?void 0:l.resize())}),vl(()=>{window.removeEventListener("resize",()=>l==null?void 0:l.resize()),l==null||l.dispose()}),(m,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:na({width:p.value,height:c.value})},null,4))}},J2={class:"fct-step-indicator"},Z2={class:"indicator-title"},eB={class:"indicator-steps"},tB={class:"indicator-progress"},aB={class:"indicator-steps-bar"},lB=["onClick"],sB={__name:"StepIndicator",props:{steps:{type:Array,required:!0},currentStep:{type:Number,default:1}},emits:["step-click"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),h("div",J2,[o("div",Z2,f(e.steps[e.currentStep-1].label),1),o("div",eB,[o("div",tB,f(e.currentStep)+"/"+f(e.steps.length)+" "+f(l.$t("Completed")),1),o("div",aB,[(r(!0),h(O,null,ae(e.steps,(i,c)=>(r(),h("div",{key:c,class:"indicator-step",onClick:p=>a("step-click",c+1)},[o("div",{class:de(["indicator-step-bar",c<e.currentStep?"is-completed":""])},null,2)],8,lB))),128))])])]))}},nB=["type","disabled","aria-disabled"],oB={key:0,class:"fct-btn-spinner"},iB="6px",rB={__name:"LoadingButton",props:{loading:Boolean,disabled:Boolean,type:{type:String,default:""},size:{type:String,default:""},plain:Boolean,nativeType:{type:String,default:"button"},duration:{type:Number,default:300}},emits:["click"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>a.disabled||a.loading),i=()=>`width ${a.duration}ms ease, opacity ${a.duration}ms ease, margin-right ${a.duration}ms ease`,c=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},p=(y,v)=>{const C=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=C,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},m=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},_=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=iB},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const C=b=>{b.propertyName==="width"&&(y.removeEventListener("transitionend",C),v())};y.addEventListener("transitionend",C)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:de(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":s.value}]),disabled:s.value,"aria-disabled":s.value,onClick:v[0]||(v[0]=C=>l("click",C))},[n(Gl,{onBeforeEnter:c,onEnter:p,onAfterEnter:m,onBeforeLeave:_,onLeave:g},{default:d(()=>[e.loading?(r(),h("span",oB,v[1]||(v[1]=[o("i",{class:"el-icon is-loading"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[o("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})])],-1)]))):k("",!0)]),_:1}),o("span",null,[Ca(y.$slots,"default",{},void 0,!0)])],10,nB))}},dB=lt(rB,[["__scopeId","data-v-fa8794a2"]]),Ap={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var _,g,y,v,C,b;const t=Cc(Bc),a=Object.freeze({get:(...w)=>ce.get(...w),post:(...w)=>ce.post(...w),put:(...w)=>ce.put(...w),delete:(...w)=>ce.delete(...w),patch:(...w)=>ce.patch(...w),upload:(...w)=>ce.upload(...w),getNonce:()=>ce.getNonce()}),l=Object.freeze({success:(...w)=>z.success(...w),error:(...w)=>z.error(...w),info:(...w)=>z.info(...w),validationErrors:(...w)=>z.validationErrors(...w)}),s=Object.freeze({clipboard:(_=window==null?void 0:window.navigator)==null?void 0:_.clipboard,userAgent:(g=window==null?void 0:window.navigator)==null?void 0:g.userAgent,language:(y=window==null?void 0:window.navigator)==null?void 0:y.language,languages:(v=window==null?void 0:window.navigator)==null?void 0:v.languages,onLine:(C=window==null?void 0:window.navigator)==null?void 0:C.onLine,platform:(b=window==null?void 0:window.navigator)==null?void 0:b.platform}),i=[{pattern:/\balert\s*\(/,label:"alert()"},{pattern:/\bconfirm\s*\(/,label:"confirm()"},{pattern:/\bprompt\s*\(/,label:"prompt()"},{pattern:/\bsetTimeout\s*\(/,label:"setTimeout()"},{pattern:/\bsetInterval\s*\(/,label:"setInterval()"},{pattern:/\brequestAnimationFrame\s*\(/,label:"requestAnimationFrame()"},{pattern:/\bcancelAnimationFrame\s*\(/,label:"cancelAnimationFrame()"},{pattern:/\bqueueMicrotask\s*\(/,label:"queueMicrotask()"},{pattern:/\bfetch\s*\(/,label:"fetch()"},{pattern:/\bXMLHttpRequest\b/,label:"XMLHttpRequest"},{pattern:/\bWebSocket\b/,label:"WebSocket"},{pattern:/\bWorker\b/,label:"Worker"},{pattern:/\bSharedWorker\b/,label:"SharedWorker"},{pattern:/\bEventSource\b/,label:"EventSource"},{pattern:/\bMessageChannel\b/,label:"MessageChannel"},{pattern:/\bBroadcastChannel\b/,label:"BroadcastChannel"},{pattern:/\bwindow\b/,label:"window"},{pattern:/\bdocument\b/,label:"document"},{pattern:/\bnavigator\.(?:serviceWorker|sendBeacon|geolocation|mediaDevices|bluetooth|usb|serial|hid|credentials|locks|wakeLock)\b/,label:"navigator privileged API"},{pattern:/\bglobalThis\b/,label:"globalThis"},{pattern:/\bself\b/,label:"self"},{pattern:/\bparent\b/,label:"parent"},{pattern:/\btop\b/,label:"top"},{pattern:/\bframes\b/,label:"frames"},{pattern:/\blocalStorage\b/,label:"localStorage"},{pattern:/\bsessionStorage\b/,label:"sessionStorage"},{pattern:/\bindexedDB\b/,label:"indexedDB"},{pattern:/\bpostMessage\s*\(/,label:"postMessage()"},{pattern:/\bopen\s*\(/,label:"open()"},{pattern:/\bFileReader\b/,label:"FileReader"},{pattern:/\bBlob\b/,label:"Blob"},{pattern:/\bURL\.createObjectURL\b/,label:"URL.createObjectURL"},{pattern:/\bMutationObserver\b/,label:"MutationObserver"},{pattern:/\bResizeObserver\b/,label:"ResizeObserver"},{pattern:/\bIntersectionObserver\b/,label:"IntersectionObserver"},{pattern:/\bhistory\.(?:pushState|replaceState|go|back|forward)\s*\(/,label:"history navigation"},{pattern:/\blocation\.(?:assign|replace|reload)\s*\(/,label:"location navigation"},{pattern:/\blocation\.href\s*=/,label:"location.href assignment"},{pattern:/\bFunction\b/,label:"Function"},{pattern:/\beval\s*\(/,label:"eval()"},{pattern:/\bnew\s+Function\b/,label:"new Function"},{pattern:/\brequire\s*\(/,label:"require()"},{pattern:/\bimport\s*\(/,label:"import()"},{pattern:/\bReflect\b/,label:"Reflect"},{pattern:/\bProxy\b/,label:"Proxy"},{pattern:/\bprocess\b/,label:"process"},{pattern:/\bmodule\b/,label:"module"},{pattern:/\bexports\b/,label:"exports"},{pattern:/\b__proto__\b/,label:"__proto__"},{pattern:/\b__defineGetter__\b/,label:"__defineGetter__"},{pattern:/\b__defineSetter__\b/,label:"__defineSetter__"}],c=w=>{for(const x of i)if(x.pattern.test(w))return!1;return!0},p=w=>{var x,F;try{if(typeof w!="string")return null;const L=w.match(/<template(?:\s[^>]*)?>|<template>/i);if(!L)return null;const U=L.index+L[0].length;let S=1,M=U,I=-1;for(;M<w.length&&S>0;){const D=w.indexOf("<template",M),H=w.indexOf("</template>",M);if(H===-1)return null;D!==-1&&D<H?(S++,M=D+9):(S--,S===0&&(I=H),M=H+11)}if(I===-1)return null;const T=w.substring(U,I).trim(),Q=w.match(/<script>([\s\S]*?)<\/script>/i);let E={};if(Q){const D=Q[1].trim();if(!/export\s+default/.test(D)||!c(D))return null;const H=D.replace(/export\s+default/,"return");E=new Function("Vue","Rest","Notify","translate","Animation","StepIndicator","LoadingButton","ElMessage","ElMessageBox","alert","confirm","prompt","setTimeout","setInterval","requestAnimationFrame","cancelAnimationFrame","queueMicrotask","fetch","XMLHttpRequest","WebSocket","Worker","SharedWorker","EventSource","MessageChannel","BroadcastChannel","window","document","navigator","globalThis","self","parent","top","frames","localStorage","sessionStorage","indexedDB","postMessage","open","FileReader","Blob","URL","MutationObserver","ResizeObserver","IntersectionObserver","history","location","Function","Reflect","Proxy","process","module","exports","require",`"use strict"; | |
| 107 | -${H}`)(t,a,l,u,_a,sB,dB,(x=window==null?void 0:window.ELEMENT)==null?void 0:x.ElMessage,(F=window==null?void 0:window.ELEMENT)==null?void 0:F.ElMessageBox,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,s,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)||{}}return jl({...E,template:T})}catch{return null}},m=w=>{if(typeof w=="string"){const x=p(w);return x?jl(x):null}return jl(w)};return(w,x)=>(r(),$(Cl(m(e.widget.component)),ga({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},uB=["innerHTML"],nn={__name:"DynamicTemplates",props:{widgetsQuery:{type:Object,default:{},required:!1},filter:{type:String,default:"",required:!1},data:{required:!1}},emits:["change"],setup(e,{expose:t,emit:a}){zt().ctx;const l=a,s=e,i=V([]),c=Cc(Bc),p={},m=L=>{window.fluent_cart_admin.app={vue:c,components:L,xhr:ce,notify:z},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],c,L).forEach(({name:S,component:M})=>{p[S]=jl(M)})};Ss(()=>{let U=zt().appContext.components;m(U);let S=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],c,U);Array.isArray(S)&&(i.value=i.value.concat(S));const M={filter:s.filter,data:s.widgetsQuery};ce.get("widgets",M).then(I=>{Array.isArray(I.widgets)&&(i.value=i.value.concat(I.widgets))}),s.widgetsQuery});const _=L=>jl(L),g=L=>p[L]||null,y=V([]),v=async(L,U)=>{const S=y.value.map(M=>typeof M[L]=="function"?M[L](U):Promise.resolve());return await Promise.all(S),!0};t({beforeUpdatingData:async L=>await v("beforeUpdatingData",L),afterUpdatingData:async L=>await v("afterUpdatingData",L),getFormStates:()=>{let L=[];if(Array.isArray(F.value))for(let U of F.value)L={...L,...U.getState()};return L},resetForms:()=>{if(Array.isArray(F.value))for(let L of F.value)L.resetOnSave()&&L.resetForm()}});const F=V();return(L,U)=>(r(!0),h(O,null,ae(i.value,S=>(r(),h(O,null,[S.type!=="vue-component"&&S.type!=="vue-template"||S.use_card==!0?(r(),$(xe,{key:0},{default:d(()=>[n(Ve,{title:S.title,subtitle:S.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(ke,null,{default:d(()=>[S.type==="html"?(r(),h("div",{key:0,innerHTML:S.content},null,8,uB)):S.type==="chart"?(r(),$(X2,{key:1,option:S.data,height:`${S.height||400}`,width:`${S.width||"100%"}`},null,8,["option","height","width"])):S.type==="form"?(r(),$(W2,{key:2,schema:S.schema,values:S.values,submit_button_text:S.submit_button_text,form_name:S.form_name,ref_for:!0,ref_key:"formRefs",ref:F,widget:S,onChange:U[0]||(U[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof S.component=="object"?(r(),$(Cl(_(S.component)),ga({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),$(Cl(g(S.component)),ga({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):(r(),h(O,{key:5},[R(f(S.content),1)],64))]),_:2},1024)]),_:2},1024)):S.type==="vue-component"?(r(),h(O,{key:1},[typeof S.component=="object"?(r(),$(Cl(_(S.component)),ga({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):g(S.component)?(r(),$(Cl(g(S.component)),ga({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...S,data:e.data}),null,16)):k("",!0)],64)):S.type==="vue-template"?(r(),$(Ap,{key:2,widget:S,data:e.data},null,8,["widget","data"])):k("",!0)],64))),256))}},ia=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,cB={class:"fct-dashboard-stat-widgets"},AB={class:"right w-full"},pB=["href"],fB={class:"fct-dashboard-stat-widget__icon"},mB={class:"fct-dashboard-stat-widget__content"},hB={class:"fct-dashboard-stat-widget__title"},_B={class:"fct-dashboard-stat-widget__value inner-value"},vB=["innerHTML"],gB={key:1,class:"fct-dashboard-stat-widget__inner"},yB={class:"fct-dashboard-stat-widget__content"},bB={class:"fct-dashboard-stat-widget__title"},wB=["href"],CB={key:1},BB={class:"fct-dashboard-stat-widget__value"},kB={__name:"StatsWidget",setup(e){const t=V(!0),a=V([]),l=()=>{t.value=!0,ce.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{z.error(s)}).finally(()=>{t.value=!1})};return Qe(()=>{l()}),(s,i)=>{const c=B("el-skeleton-item"),p=B("el-skeleton");return r(),h("div",cB,[t.value?(r(),h(O,{key:0},ae(4,m=>n(p,{key:m,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:d(()=>[n(c,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",AB,[n(c,{variant:"p",class:"w-full"}),n(c,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(O,{key:1},[(r(!0),h(O,null,ae(a.value,(m,_)=>(r(),h("div",{key:_,class:"fct-dashboard-stat-widget"},[m.url?(r(),h("a",{key:0,href:m.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",fB,[n(ee,{class:"w-5",name:m.icon},null,8,["name"])]),o("div",mB,[o("h3",hB,[o("span",null,f(m.title),1)]),o("span",_B,[m.has_currency?(r(),h("span",{key:0,innerHTML:A(Je).scaled(m.current_count)},null,8,vB)):(r(),h(O,{key:1},[R(f(A(Xt)(A(ia)(m.current_count))||0),1)],64))])])],8,pB)):(r(),h("div",gB,[i[0]||(i[0]=xn('<div class="fct-dashboard-stat-widget__icon"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.20248 2.62165L5.7818 3.27834C3.59393 4.28965 2.5 4.7953 2.5 5.62533C2.5 6.45535 3.59393 6.961 5.7818 7.97231L7.20249 8.629C8.57936 9.26544 9.26781 9.58366 10 9.58366C10.7322 9.58366 11.4206 9.26544 12.7975 8.629L14.2182 7.97231C16.4061 6.961 17.5 6.45535 17.5 5.62533C17.5 4.7953 16.4061 4.28965 14.2182 3.27834L12.7975 2.62165C11.4206 1.98521 10.7322 1.66699 10 1.66699C9.26781 1.66699 8.57937 1.98521 7.20248 2.62165Z" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M17.3233 9.24805C17.4411 9.41368 17.5 9.5863 17.5 9.77614C17.5 10.5944 16.4061 11.0928 14.2182 12.0897L12.7975 12.7371C11.4206 13.3644 10.7322 13.6781 10 13.6781C9.26781 13.6781 8.57936 13.3644 7.20249 12.7371L5.7818 12.0897C3.59394 11.0928 2.5 10.5944 2.5 9.77614C2.5 9.5863 2.55889 9.41368 2.67667 9.24805" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.9806 13.5557C17.3269 13.8315 17.5 14.1064 17.5 14.4319C17.5 15.2501 16.4061 15.7486 14.2182 16.7455L12.7975 17.3928C11.4206 18.0202 10.7322 18.3339 10 18.3339C9.26781 18.3339 8.57936 18.0202 7.20249 17.3928L5.7818 16.7455C3.59394 15.7486 2.5 15.2501 2.5 14.4319C2.5 14.1064 2.67315 13.8315 3.01945 13.5557" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></div>',1)),o("div",yB,[o("h3",bB,[m.url?(r(),h("a",{key:0,class:"link",href:m.url},f(m.title),9,wB)):(r(),h("span",CB,f(m.title),1))]),o("span",BB,f(m.current_count),1)])]))]))),128)),n(nn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},Hu=200,xB=800,SB=.1,FB=.3,Pu=.5,$B=.5,EB=12,UB=800,IB=1600,QB=150,DB=3500,VB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var md={props:{particleCount:{type:Number,default:QB},particleSize:{type:Number,default:EB},duration:{type:Number,default:DB},colors:{type:Array,default:VB},force:{type:Number,default:$B},stageHeight:{type:Number,default:UB},stageWidth:{type:Number,default:IB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=V(!0),a=(U,S)=>{L(U,{degree:S})},l=K(()=>i(e.particleCount,e.colors));pf(()=>{e.particleCount>300&&console.log("[VUE-CONFETTI-EXPLOSION] That's a lot of confetti, you sure about that? A lesser number like 200 will still give off the party vibes while still not bricking the device 😉")});const s=K(()=>F(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));Qe(async()=>{await c(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const i=(U,S)=>{const M=360/U;return Array.from({length:U},(I,T)=>({color:S[T%S.length],degree:T*M}))},c=U=>new Promise(S=>setTimeout(S,U));function p(U){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((U+Number.EPSILON)*10**S)/10**S}function m(U,S){if(U===S)return!0;if(U==null||S==null||U.length!==S.length)return!1;for(let M=0;M<U.length;M++)if(U[M]!==S[M])return!1;return!0}const _=(U,S,M,I,T)=>(U-S)*(T-I)/(M-S)+I,g=(U,S)=>{const M=U+S;return M>360?M-360:M},y=()=>Math.random()>.5,v=[0,0,1],C=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],b=U=>!m(C[U],v)&&y(),w=U=>typeof U>"u",x=U=>{console.error(U)};function F(U,S,M,I,T,Q,E){const D=Number.isSafeInteger;return!w(U)&&D(U)&&U<0?(x("particleCount must be a positive integer"),!1):!w(S)&&D(S)&&S<0?(x("duration must be a positive integer"),!1):!w(M)&&!Array.isArray(M)?(x("colors must be an array of strings"),!1):!w(I)&&D(I)&&I<0?(x("particleSize must be a positive integer"),!1):!w(T)&&D(T)&&(T<0||T>1)?(x("force must be a positive integer and should be within 0 and 1"),!1):!w(Q)&&typeof Q=="number"&&D(Q)&&Q<0?(x("floorHeight must be a positive integer"),!1):!w(E)&&typeof E=="number"&&D(E)&&E<0?(x("floorWidth must be a positive integer"),!1):!0}function L(U,S){let{degree:M}=S;const I=_(Math.abs(g(M,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),T=Math.random()*(xB-Hu)+Hu,Q=Math.round(Math.random()*(C.length-1)),E=e.duration-Math.round(Math.random()*1e3),D=Math.random()<SB,H=b(Q),P=D?p(Math.random()*FB,2):0,G=P*-1,J=P,oe=p(Math.abs(_(Math.abs(g(M,90)-180),0,180,-1,1)),4),Z=p(Math.random()*Pu,4),W=p(Math.random()*e.force*(y()?1:-1),4),pe=Pu,N=p(Math.max(_(Math.abs(M-180),0,180,e.force,-e.force),0),4),j=(q,X)=>U==null?void 0:U.style.setProperty(q,X+"");j("--x-landing-point",`${I}px`),j("--duration-chaos",`${E}ms`),j("--x1",`${P}`),j("--x2",`${G}`),j("--x3",`${J}`),j("--x4",`${oe}`),j("--y1",`${Z}`),j("--y2",`${W}`),j("--y3",`${pe}`),j("--y4",`${N}`),j("--width",`${H?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),j("--height",(H?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),j("--rotation",`${C[Q].join()}`),j("--rotation-duration",`${T}ms`),j("--border-radius",`${H?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function TB(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:na(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(O,null,ae(l.particles,c=>{let{color:p,degree:m}=c;return r(),h("div",{key:m,class:"particle",ref:_=>l.setItemRef(_,m)},[o("div",{style:na(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):k("",!0)}function MB(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var LB=` | |
| 106 | + </div>`}),U}},xAxis:{type:"category",data:v.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,interval:b.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{name:kl("Revenue","Chart axis title"),type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:B=>`${ft.scaledChart(B)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{name:kl("Orders","Chart axis title"),type:"value",position:"right",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:y.value};w.setOption(F,{notMerge:!0,replaceMerge:["series"]})},$=(F,B,U,Q,V)=>({name:F,type:B,barMaxWidth:30,data:U,smooth:!1,color:Q,lineStyle:{width:3},areaStyle:{opacity:.3,color:Q},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},yAxisIndex:V,emphasis:{scale:2,itemStyle:{color:ja(Q)},lineStyle:{color:Q},areaStyle:{opacity:.3,color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),D=F=>{i.value!==F&&(i.value=F,ba.onChange("order","sales_growth_chart",F),S())};return be([()=>a.chartData,i],()=>{xe(S)},{deep:!0}),be(f,F=>{F||k()}),be(()=>a.loading,F=>{F||k()}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",S),xe(k)}),(F,B)=>{const U=C("el-skeleton");return r(),h("div",iC,[n(Se,{id:"chartContainer",ref_key:"cardRef",ref:s},{default:d(()=>[n(Ve,{title:F.$t("Sales Growth"),border_bottom:""},oa({_:2},[!f.value&&!e.loading?{name:"action",fn:d(()=>[o("div",rC,[n(Gl,{activeType:i.value,types:{bar:"BarChart",line:"LineChart"},onChange:D},null,8,["activeType"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"p-0"},{default:d(()=>[e.loading?(r(),E(U,{key:0,animated:"",rows:5,class:"p-4"})):(r(),h(P,{key:1},[f.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-gross-sale-vs-net-revenue-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1})]),_:1},512)])}}},uC={class:"fct-gross-sale-vs-net-revenue-wrap"},cC={class:"fct-btn-group sm"},AC={key:0,class:"fct-world-map-action-btns absolute top-5 right-5 flex flex-col gap-1 z-10"},pC={key:1,class:"fct-world-map-action-btns absolute top-[10px] right-[40px] flex flex-col gap-1 z-10"},ju=.5,Zi=6,vo=1.2,fC={__name:"HeatMap",props:{data:{type:Array,required:!0}},setup(e){const t=e,a=Te.colors,l=T(null),s=T(null),i=T(!1),c=T("world"),p=T(92),f=T(100);T(!1);let _=null,g=null,y=50;const v=T(1.2),w=T(),k=a.blue,b=K(()=>{const ue=f.value-p.value,ie=t.data?t.data.length:0;return ue<60||ie<15}),S=ue=>{ue=ue.replace(/^#/,"");const ie=parseInt(ue.substring(0,2),16),J=parseInt(ue.substring(2,4),16),N=parseInt(ue.substring(4,6),16);return[ie,J,N]},$=()=>Te.isDark()?a.gray[50]:a.gray[600],D=S(k[500]),F=async()=>{const ue=gs.getUrl("world.geo.json"),J=await(await fetch(ue)).json();wm("world",J)},B=ue=>{if(!ue||isNaN(ue))return`rgba(${D.join(",")}, 0)`;const ie=Math.log(ue+1)/Math.log(y+1);return`rgba(${D.join(",")}, ${ie})`},U=ue=>{c.value=ue,W(),_&&(_.clear(),_.setOption(H()),ue==="bar"&&Q()),g&&i.value&&(g.clear(),g.setOption(H()),ue==="bar"&&V())},Q=()=>{_&&(_.off("dataZoom"),_.on("dataZoom",function(ue){ue.batch&&ue.batch[0]?(p.value=ue.batch[0].start||0,f.value=ue.batch[0].end||100):(p.value=ue.start||0,f.value=ue.end||100),setTimeout(()=>{W()},100)}))},V=()=>{g&&(g.off("dataZoom"),g.on("dataZoom",function(ue){ue.batch&&ue.batch[0]?(p.value=ue.batch[0].start||0,f.value=ue.batch[0].end||100):(p.value=ue.start||0,f.value=ue.end||100),setTimeout(()=>{g&&g.setOption(H())},100)}))},I=K(()=>(t.data||[]).map(ue=>({...ue,value:ue.value||0,itemStyle:{color:B(ue.value||0)},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}))),M=()=>({backgroundColor:Te.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"item",formatter:ue=>u("%1$s%2$s Orders: %3$s",ue.name,"<br>",ue.value||0),borderRadius:8,backgroundColor:Te.isDark()?"#38485a":"#ffffff",borderColor:Te.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Te.isDark()?"#ffffff":"#565865"}},visualMap:{min:0,max:y,left:i.value?"5%":"center",bottom:i.value?"center":"4%",text:[u("High"),u("Low")],orient:i.value?"vertical":"horizontal",calculable:!0,inRange:{color:[k[100],k[500]]},textStyle:{color:a.gray[800]}},series:[{name:"Orders",type:"map",map:"world",roam:w.value,zoom:v.value,label:{show:!1,emphasis:{show:!0,color:a.gray[1e3],fontWeight:"bold",textShadowColor:a.gray[50],textShadowBlur:3,textShadowOffsetX:0,textShadowOffsetY:0}},emphasis:{itemStyle:{areaColor:k[300],shadowBlur:10,shadowColor:a.gray[400]}},itemStyle:{borderColor:a.gray[200],borderWidth:.5},data:I.value}]}),O=K(()=>{const ue=t.data.length,ie=f.value-p.value,J=Math.ceil(ue*ie/100);let N=0;return J>100?N=9:J>50?N=4:J>30?N=2:J>20&&(N=1),N}),L=()=>{const ue=b.value;return{backgroundColor:Te.isDark()?a.dark[700]:a.gray[25],tooltip:{trigger:"axis",axisPointer:{type:"shadow"},formatter:function(ie){const J=ie[0];return`${J.name}<br/>${u("Orders")}: ${J.value||0}`},backgroundColor:Te.isDark()?"#38485a":"#ffffff",textStyle:{color:Te.isDark()?a.gray[25]:a.system.mid},borderColor:Te.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},dataZoom:[{type:"inside",yAxisIndex:0,start:p.value,end:f.value},{type:"slider",yAxisIndex:0,start:p.value,end:f.value,width:25,top:10,right:10,textStyle:{color:$()},brushSelect:!1,showDetail:!1,disabled:!0}],grid:{left:ue?"10px":"0%",right:"15%",top:"10%",bottom:"15%",containLabel:!0},yAxis:{type:"category",axisTick:{show:ue},splitLine:{show:!1},axisLine:{show:ue,lineStyle:{color:$()}},axisLabel:{show:ue,interval:O.value,color:$(),fontSize:11},data:t.data.map(ie=>ie.name)},xAxis:{type:"value",axisLabel:{show:!0,color:$(),formatter:function(ie){return ie.toLocaleString()}},splitLine:{show:!0,lineStyle:{color:Te.isDark()?a.gray[600]:a.gray[200]}}},series:[{type:"bar",large:!0,itemStyle:{color:new mr(0,0,1,0,[{offset:0,color:k[400]},{offset:1,color:k[600]}]),borderRadius:[0,4,4,0]},emphasis:{itemStyle:{color:new mr(0,0,1,0,[{offset:0,color:k[500]},{offset:1,color:k[700]}])}},data:t.data.map(ie=>ie.value),label:{show:ue,formatter:"{c}",position:"right",color:$(),fontSize:10}}]}},H=()=>c.value==="bar"?L():M(),j=async()=>{await F(),l.value&&(_=na(l.value),_.setOption(H()),c.value==="bar"&&Q(),_.on("georoam",()=>{const ie=_.getOption().series[0].zoom;if(ie!==v.value)if(ie<vo||ie>Zi){const J=Math.max(vo,Math.min(Zi,ie));_.setOption({series:[{zoom:J}]},!1),v.value=J}else v.value=ie}))},W=()=>{t.data&&t.data.length>0?y=Math.max(...t.data.map(ue=>ue.value||0)):y=1,_&&_.setOption(H(),{notMerge:!0})},G=()=>{v.value=Math.min(v.value+ju,Zi),w.value=!0,_.setOption({series:[{zoom:v.value,roam:w.value}]})},Z=()=>{v.value=Math.max(v.value-ju,vo),w.value=!0,_.setOption({series:[{zoom:v.value,roam:w.value}]})},ne=()=>{c.value==="bar"?(p.value=92,f.value=100,_&&_.dispatchAction({type:"dataZoom",start:92,end:100})):(v.value=vo,w.value="move",_&&(_.clear(),_.setOption(H())))},ce=async()=>{i.value=!0,await xe(),g?g.clear():g=na(s.value),g.setOption(H()),c.value==="bar"&&V()},z=ue=>{$(),_&&_.setOption(H())};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",z),w.value="move",xe(j)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",z),_&&(_.dispose(),_=null),g&&(g.dispose(),g=null)}),be(()=>t.data,()=>W(),{deep:!0}),be(b,()=>{c.value==="bar"&&xe(()=>{W()})}),(ue,ie)=>(r(),h("div",uC,[n(Se,{id:"chartContainer",class:"mb-0"},{default:d(()=>[n(Ve,{title:ue.$t("Order Heat Map"),border_bottom:""},{action:d(()=>[o("div",cC,[n(Gl,{activeType:c.value,types:{world:"Globe",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(Sa,{targetRef:l.value,size:"small"},null,8,["targetRef"])])]),_:1},8,["title"]),n(ke,{class:"p-0 pt-0 relative"},{default:d(()=>[c.value==="world"?(r(),h("div",AC,[n(at,{tag:"button",size:"small",onClick:G},{default:d(()=>[n(Y,{name:"Plus"})]),_:1}),n(at,{tag:"button",size:"small",onClick:Z},{default:d(()=>[n(Y,{name:"Minus"})]),_:1}),n(at,{tag:"button",size:"small",onClick:ne},{default:d(()=>[n(Y,{name:"Reload"})]),_:1}),n(at,{tag:"button",size:"small lg:hidden",onClick:ce},{default:d(()=>[n(Y,{name:"Eye"})]),_:1})])):x("",!0),c.value==="bar"?(r(),h("div",pC,[n(at,{tag:"button",size:"small",onClick:ne},{default:d(()=>[n(Y,{name:"Reload"})]),_:1})])):x("",!0),o("div",{class:"fct-chart-wrap rounded-[0px] bg-transparent",ref_key:"chartRef",ref:l},null,512)]),_:1})]),_:1}),n(A(Sm),{modelValue:i.value,"onUpdate:modelValue":ie[0]||(ie[0]=J=>i.value=J),title:ue.$t("Order Heat Map"),class:"country-heat-map-dialog"},{default:d(()=>[o("div",{class:"fct-chart-wrap",ref_key:"modalChartRef",ref:s},null,512)]),_:1},8,["modelValue","title"])]))}},mC=nt(fC,[["__scopeId","data-v-36a900c8"]]),hC={class:"fct-report-card"},_C={key:0,class:"fct-report-card-header"},vC={key:0,class:"flex items-center gap-2"},gC={class:"title"},yC={class:"actions"},bC={class:"fct-report-card-body flex h-full"},wC={class:"w-full"},Gn={__name:"ReportCard",props:{cardOptions:{type:Object,default:()=>({heading:"",linkButtonText:"",linkButtonUrl:"",headingIcon:{type:Boolean,default:!1}})}},setup(e){return(t,a)=>{const l=C("router-link");return r(),h("div",hC,[e.cardOptions.heading||e.cardOptions.linkButtonText?(r(),h("div",_C,[e.cardOptions.heading?(r(),h("div",vC,[e.cardOptions.headingIcon?(r(),E(at,{key:0,size:"x-small",bg:"danger",soft:""},{default:d(()=>[n(Y,{name:"FailedCircle"})]),_:1})):x("",!0),o("h4",gC,m(e.cardOptions.heading),1)])):x("",!0),o("div",yC,[e.cardOptions.linkButtonText?(r(),E(l,{key:0,to:`/${e.cardOptions.linkButtonUrl}`,class:"link"},{default:d(()=>[R(m(t.$t(e.cardOptions.linkButtonText)),1)]),_:1},8,["to"])):x("",!0),ga(t.$slots,"action")])])):x("",!0),o("div",bC,[o("div",wC,[ga(t.$slots,"default")])])])}}},CC={key:0,class:"fct-report-sold-product-list has-scroll"},kC={class:"list-left-content"},BC={class:"list-title"},xC={class:"list-title-inner"},SC={class:"list-id"},FC={class:"list-right-content"},$C=["innerHTML"],EC={class:"list-price"},UC={__name:"RecentOrders",setup(e){const t=rl.data;return(a,l)=>{const s=C("router-link");return r(),E(Gn,{class:"top-sold-products","card-options":{heading:A(u)("Recent Orders"),linkButtonText:A(u)("View All"),linkButtonUrl:"orders"}},{default:d(()=>{var i,c;return[((c=(i=A(t))==null?void 0:i.recentOrders)==null?void 0:c.length)>0?(r(),h("ul",CC,[(r(!0),h(P,null,te(A(t).recentOrders,p=>(r(),h("li",{key:p.id},[n(s,{class:"no-underline",to:{name:"view_order",params:{order_id:p.id}}},{default:d(()=>[o("div",kC,[o("div",BC,[o("div",xC,m(p.customer_name)+" #"+m(A(sa)(p.id)),1),o("div",SC,[n(Pa,{"date-time":p.created_at},null,8,["date-time"])])])]),o("div",FC,[o("div",{class:"list-value",innerHTML:A(ft).scaled(p.total_amount)},null,8,$C),o("div",EC,m(A(sa)(p.order_items_count))+" "+m(A(u)("Items")),1)])]),_:2},1032,["to"])]))),128))])):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))]}),_:1},8,["card-options"])}}},IC={key:0},QC={key:1,class:"fc_dashboard_onboarding_wrap"},DC={class:"fc_dashboard_onboarding_title"},VC={class:"fc_dashboard_onboarding_lists"},TC=["href"],MC={class:"circle-shape"},LC={class:"fc_dashboard_onboarding_item__title"},RC={__name:"Onboarding",emits:["status"],setup(e,{emit:t}){const a=T(0),l=T(!1);Jt().ctx;const s=T([]),i=T(!0);T(localStorage.getItem("started_content_collapse")==="true"||!1),K(()=>{const _=Object.keys(s.value).length;return _?Math.round(a.value/_*100):0});const c=_=>_.hash_id?_.url+"#"+_.hash_id:_.url,p=oi("dashboardTogglePageNotification"),f=t;return Ie(async()=>{l.value=!0,Ae.get("dashboard").then(_=>{var y,v;s.value=_.data.steps,a.value=_.data.completed,i.value=Object.keys(s.value).length!==a.value,f("status",{completed:!i.value}),l.value=!1;let g=((y=s.value.page_setup)==null?void 0:y.completed)||!1;p&&p(!g,((v=s.value.page_setup)==null?void 0:v.url)||"")}).catch(_=>{l.value=!1})}),(_,g)=>{const y=C("el-skeleton"),v=C("Check"),w=C("el-icon");return i.value?(r(),h("div",IC,[l.value?(r(),E(y,{key:0,rows:3,animated:""})):(r(),h("div",QC,[o("h3",DC,m(_.$t("Getting Started")),1),o("div",VC,[(r(!0),h(P,null,te(s.value,(k,b)=>(r(),h("a",{key:b,href:c(k),class:de([k.completed===!0?"active":"","fc_dashboard_onboarding_item"])},[o("span",MC,[k.completed===!0?(r(),E(w,{key:0},{default:d(()=>[n(v)]),_:1})):x("",!0)]),o("div",LC,m(k.title),1)],10,TC))),128))])]))])):x("",!0)}}},OC={class:"fct-dashboard-recent-activities-wrap"},PC={class:"fct-dashboard-recent-activities__header"},HC={class:"fct-dashboard-recent-activities__header_title"},NC={class:"fct-dashboard-recent-activities__header_desc"},KC={key:0,class:"fct-dashboard-recent-activities__body"},GC={class:"content"},zC={class:"title"},jC=["onClick"],qC={class:"date"},YC=["innerHTML"],WC={class:"created_by"},JC={key:1,class:"fct-dashboard-recent-activities__empty"},XC={class:"fct-dashboard-recent-activities__empty_text"},ZC={__name:"RecentActivity",props:{activities:{type:Array,default:()=>[]},showManageActivity:{type:Boolean,default:!1}},emits:["reload"],setup(e,{emit:t}){const a=sl(),l=T([{label:kl("All","Activity filter button"),value:"all"},{label:kl("Today","Activity filter button"),value:"today"},{label:kl("Yesterday","Activity filter button"),value:"yesterday"},{label:kl("This Week","Activity filter button"),value:"this_week"}]),s=T("all"),i=()=>{switch(s.value){case"all":return kl("all","Activity filter, mid-sentence");case"today":return kl("today","Activity filter, mid-sentence");case"yesterday":return kl("yesterday","Activity filter, mid-sentence");case"this_week":return kl("this week","Activity filter, mid-sentence");default:return s.value}},c=()=>{i(),rl.getRecentActivities({groupKey:s.value})},p={Order:"orders/view",Payment:"orders/view",PayPal:"orders/view",Product:"products/view",Customer:"customers/view",Coupon:"coupons/view",Subscription:"subscriptions/view",Tax:"store/settings"},f={order:{name:"view_order",param:"order_id",permission:"orders/view"},payment:{name:"view_order",param:"order_id",permission:"orders/view"},product:{name:"view_product",param:"product_id",permission:"products/view"},customer:{name:"view_customer",param:"customer_id",permission:"customers/view"},coupon:{name:"view_coupon",param:"coupon_id",permission:"coupons/view"},subscription:{name:"view_subscription",param:"subscription_id",permission:"subscriptions/view"}},_=v=>{var b;let w=(b=v==null?void 0:v.module_name)==null?void 0:b.toLowerCase();const k=f[w];k&&v.module_id&&g(v)&&a.push({name:k.name,params:{[k.param]:v.module_id}})},g=v=>{if(!v.module_name)return!0;const w=dt.get(p,da.capitalize(v.module_name));return w?Vn.has(w):!1},y=K(()=>rl.data.recentActivities.filter(v=>g(v)));return Ie(()=>{c()}),(v,w)=>{const k=C("el-radio-button"),b=C("el-radio-group");return r(),h("div",OC,[o("div",PC,[o("h4",HC,m(A(u)("Recent Activities")),1),o("p",NC,[s.value==="all"?(r(),h(P,{key:0},[R(m(A(u)("%1$s new activities",A(sa)(y.value.length))),1)],64)):(r(),h(P,{key:1},[R(m(A(u)("%1$s new activities %2$s",A(sa)(y.value.length),i())),1)],64))]),n(b,{class:"fct-dashboard-recent-activities__header_filter",modelValue:s.value,"onUpdate:modelValue":w[0]||(w[0]=S=>s.value=S),onChange:c,size:"large"},{default:d(()=>[(r(!0),h(P,null,te(l.value,(S,$)=>(r(),E(k,{key:$,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y.value.length?(r(),h("div",KC,[(r(!0),h(P,null,te(y.value,(S,$)=>{var D;return r(),h("div",{key:$,class:"fct-dashboard-recent-activities__item has-icon"},[w[1]||(w[1]=o("span",{class:"icon"},[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M12.8499 9.92029L13.5711 10.3529C13.6156 10.3795 13.6524 10.4172 13.678 10.4623C13.7036 10.5075 13.717 10.5584 13.717 10.6103C13.717 10.6621 13.7036 10.7131 13.678 10.7582C13.6524 10.8033 13.6156 10.841 13.5711 10.8677L8.30911 14.0249C8.21579 14.081 8.10897 14.1106 8.00011 14.1106C7.89124 14.1106 7.78443 14.081 7.69111 14.0249L2.42911 10.8677C2.38462 10.841 2.34779 10.8033 2.32222 10.7582C2.29664 10.7131 2.2832 10.6621 2.2832 10.6103C2.2832 10.5584 2.29664 10.5075 2.32222 10.4623C2.34779 10.4172 2.38462 10.3795 2.42911 10.3529L3.15031 9.92029L8.00011 12.8303L12.8499 9.92029ZM12.8499 7.10029L13.5711 7.53289C13.6156 7.55952 13.6524 7.59723 13.678 7.64235C13.7036 7.68746 13.717 7.73843 13.717 7.79029C13.717 7.84214 13.7036 7.89311 13.678 7.93822C13.6524 7.98334 13.6156 8.02105 13.5711 8.04769L8.00011 11.3903L2.42911 8.04769C2.38462 8.02105 2.34779 7.98334 2.32222 7.93822C2.29664 7.89311 2.2832 7.84214 2.2832 7.79029C2.2832 7.73843 2.29664 7.68746 2.32222 7.64235C2.34779 7.59723 2.38462 7.55952 2.42911 7.53289L3.15031 7.10029L8.00011 10.0103L12.8499 7.10029ZM8.30851 1.58569L13.5711 4.74289C13.6156 4.76952 13.6524 4.80724 13.678 4.85235C13.7036 4.89746 13.717 4.94843 13.717 5.00029C13.717 5.05214 13.7036 5.10311 13.678 5.14822C13.6524 5.19334 13.6156 5.23105 13.5711 5.25769L8.00011 8.60029L2.42911 5.25769C2.38462 5.23105 2.34779 5.19334 2.32222 5.14822C2.29664 5.10311 2.2832 5.05214 2.2832 5.00029C2.2832 4.94843 2.29664 4.89746 2.32222 4.85235C2.34779 4.80724 2.38462 4.76952 2.42911 4.74289L7.69111 1.58569C7.78443 1.52962 7.89124 1.5 8.00011 1.5C8.10897 1.5 8.21579 1.52962 8.30911 1.58569H8.30851ZM8.00011 2.79949L4.33231 5.00029L8.00011 7.20109L11.6679 5.00029L8.00011 2.79949Z",fill:"#335CFF"})])],-1)),o("div",GC,[o("h3",zC,[f[(D=S.module_name)==null?void 0:D.toLowerCase()]?(r(),h("span",{key:0,onClick:F=>_(S),class:"cursor-pointer"},m(S.title||"--"),9,jC)):(r(),h(P,{key:1},[R(m(S.title||"--"),1)],64)),o("span",qC,[n(Pa,{"date-time":S.created_at},null,8,["date-time"])])]),o("p",{innerHTML:S.content,class:"description"},null,8,YC),o("span",WC,m(A(u)("By %s",S.created_by)),1)])])}),128))])):(r(),h("div",JC,[o("div",XC,m(A(u)("No activity found.")),1)]))])}}},e2="https://wordpress.org/support/plugin/fluent-cart/reviews/#new-post",Cp="fct_review_prompt_hidden",kp=()=>{try{return window.localStorage}catch{return null}},t2=(e=kp())=>{try{return!!e&&e.getItem(Cp)==="yes"}catch{return!1}},a2=(e=kp())=>{try{return e?(e.setItem(Cp,"yes"),!0):!1}catch{return!1}},l2=["aria-label"],s2={class:"fct-review-prompt__text"},qu="fct-review-prompt-title",n2={__name:"ReviewPrompt",setup(e){const t=T(t2()),a=()=>{t.value=!0,a2()};return(l,s)=>{const i=C("el-button");return t.value?x("",!0):(r(),h("div",{key:0,class:"fct-review-prompt",role:"region","aria-labelledby":qu},[o("button",{type:"button",class:"fct-review-prompt__close","aria-label":A(u)("Dismiss feedback request"),onClick:a},[n(Y,{name:"Cross"})],8,l2),o("h3",{id:qu,class:"fct-review-prompt__title"},m(A(u)("How's FluentCart working for you?")),1),o("p",s2,m(A(u)("A short review on WordPress.org helps other store owners decide, and tells us what to improve.")),1),n(i,{tag:"a",href:A(e2),target:"_blank",rel:"noopener noreferrer",onClick:a},{default:d(()=>[R(m(A(u)("Share your feedback"))+" ",1),n(Y,{name:"External",class:"ml-1.5 w-3.5 h-3.5"})]),_:1},8,["href"])]))}}},o2={class:"fc_dashboard_sidebar bg-white dark:bg-dark-700 p-5 rounded"},i2={__name:"SideBar",setup(e){const t=T(!1),a=l=>{t.value=!!l.completed};return(l,s)=>(r(),h("div",o2,[n(Ot,{permission:"is_super_admin"},{default:d(()=>[n(RC,{onStatus:a}),t.value?(r(),E(n2,{key:0})):x("",!0)]),_:1}),n(ZC,{onReload:s[0]||(s[0]=()=>{})})]))}},r2={class:"fct-product-create"},d2={class:"fct-product-step"},u2={class:"fct-product-item-selector"},c2=["onClick"],A2={class:"fct-product-item-selector-content"},p2={class:"fct-bundle-product-condition"},f2={class:"condition-text"},m2={class:"dialog-footer"},Ci={__name:"AddProductModal",props:{customModal:String},emits:["process_custom","update:createProductModal"],setup(e,{emit:t}){const a=e,l=t,s=sl(),i=ze.get("variation_types",{}),c=T({post_title:"",post_content:"",post_excerpt:"",post_date:new Date,post_status:"draft",detail:{fulfillment_type:"digital",variation_type:"simple",manage_stock:"0",manage_downloadable:"0",other_info:{use_pricing_table:"yes",group_pricing_by:"repeat_interval",active_editor:"wp-editor",sold_individually:"no"}}}),p=[{type:"physical",title:u("Physical Product"),icon:"Gift"},{type:"digital",title:u("Digital Product"),icon:"Code"}],f=T(!1),_=T(null),g=w=>{c.value.detail.fulfillment_type=w},y=()=>{f.value=!0,Ae.post("products",{...c.value}).then(w=>{if(q.success(w.message),a.customModal==="order_modal"){const k={id:w.data.product_variants.id,object_id:w.data.product_variants.post_id,variation_id:w.data.product_variants.id,item_name:w.data.product_variants.variation_title,item_price:w.data.product_variants.item_price,quantity:1,stock:100,object_type:w.data.product_details.fulfillment_type,item_total:w.data.product_variants.item_price,line_total:w.data.product_variants.item_price,tax_amount:0,discount_total:0};l("process_custom",k),l("update:createProductModal",!1)}else s.push({name:"product_edit",params:{product_id:w.data.ID}})}).catch(w=>{var k;w.status_code=="422"?q.validationErrors(w):q.error((k=w.data)==null?void 0:k.message)}).finally(()=>{f.value=!1})},v=w=>{w.stopPropagation(),w.preventDefault(),y()};return Ie(()=>{xe(()=>{setTimeout(()=>{var w;(w=_.value)==null||w.focus()},10)})}),(w,k)=>{const b=C("el-input"),S=C("el-form-item"),$=C("el-option"),D=C("el-select"),F=C("el-checkbox"),B=C("el-form"),U=C("el-button");return r(),h("div",r2,[o("div",d2,[n(B,{"label-position":"top",model:c.value,"require-asterisk-position":"right"},{default:d(()=>[n(S,{label:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),required:""},{default:d(()=>[n(b,{type:"text",modelValue:c.value.post_title,"onUpdate:modelValue":k[0]||(k[0]=Q=>c.value.post_title=Q),placeholder:c.value.detail.other_info.is_bundle_product==="yes"?A(u)("Bundle Title"):A(u)("Product Title"),minlength:"3",maxlength:"200","show-word-limit":"",autofocus:"",ref_key:"fcProductTitle",ref:_,onKeydown:xa(v,["enter"])},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),e.customModal!=="order_modal"?(r(),E(S,{key:0,label:A(u)("Variation Type")},{default:d(()=>[n(D,{modelValue:c.value.detail.variation_type,"onUpdate:modelValue":k[1]||(k[1]=Q=>c.value.detail.variation_type=Q),placeholder:A(u)("Select Variation Type"),class:"w-full"},{default:d(()=>[(r(!0),h(P,null,te(A(i),(Q,V)=>(r(),E($,{key:V,label:Q,value:V},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0),n(S,null,{default:d(()=>[o("ul",u2,[(r(),h(P,null,te(p,Q=>o("li",{key:Q.type,class:de({active:Q.type===c.value.detail.fulfillment_type}),onClick:V=>g(Q.type)},[o("div",A2,[n(Y,{name:Q.icon},null,8,["name"]),R(" "+m(Q.title),1)]),k[3]||(k[3]=o("div",{class:"fct-product-item-selector-dot-wrap"},[o("span",{class:"fct-product-item-selector-dot"})],-1))],10,c2)),64))])]),_:1}),n(S,null,{default:d(()=>[o("div",p2,[n(F,{modelValue:c.value.detail.other_info.is_bundle_product,"onUpdate:modelValue":k[2]||(k[2]=Q=>c.value.detail.other_info.is_bundle_product=Q),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Add as a Bundle")),1)]),_:1},8,["modelValue"]),o("span",f2,m(A(u)("Combine multiple items into one package")),1)])]),_:1})]),_:1},8,["model"])]),o("div",m2,[n(U,{disabled:!c.value.post_title||f.value,loading:f.value,onClick:y,type:"primary"},{default:d(()=>[R(m(f.value?A(u)("Creating"):A(u)("Add Product")),1)]),_:1},8,["disabled","loading"])])])}}};class yd{constructor(t=new Date){this.date=t}getHours(){return this.date.getHours()}static greeting(){const t=new yd().getHours();if(t>=5&&t<12)return u("Good morning");if(t>=12&&t<17)return u("Good afternoon");if(t>=17&&t<21)return u("Good evening");{const a=[u("Step into the moonlight!"),u("Evening vibes!"),u("The night's still young!")];return a[Math.floor(Math.random()*a.length)]}}}const h2={class:"fct-current-user-info-wrap"},_2={class:"fct-current-user-info-content"},v2={class:"image"},g2=["src","alt"],y2={class:"content"},b2={key:0,class:"fct-current-user-info-action"},w2={__name:"CurrentUserInfo",setup(e){const t=T(!1),a=T(ze.get("me")),l=()=>ze.get("shop.store_name"),s=ze.get("total_products_count");return(i,c)=>{const p=C("el-button"),f=C("el-dialog");return r(),h("div",h2,[o("div",_2,[o("div",v2,[o("img",{src:a.value.avatar,alt:a.value.full_name},null,8,g2)]),o("div",y2,[o("h4",null,m(A(yd).greeting())+" "+m(a.value.full_name)+" 👋🏻",1),o("p",null,m(A(u)("Welcome to %1$s",l())),1)])]),n(Ot,{permission:"products/create"},{default:d(()=>[A(s)==0?(r(),h("div",b2,[n(p,{onClick:c[0]||(c[0]=_=>t.value=!0),type:"primary"},{default:d(()=>[R(m(A(u)("Add Product")),1)]),_:1})])):x("",!0)]),_:1}),n(f,{"append-to-body":!0,modelValue:t.value,"onUpdate:modelValue":c[1]||(c[1]=_=>t.value=_),onClose:c[2]||(c[2]=_=>t.value=!1),title:A(u)("Add New Product")},{default:d(()=>[n(Ci)]),_:1},8,["modelValue","title"])])}}};class C2{constructor(){Pe(this,"operatorMap",{"!==":"matchNotEqual","!=":"matchNotEqual"});Pe(this,"defaultMatcherMethod",null)}getMatchingMethod(t){return t==="=="||t==="==="?"matchEqual":this.operatorMap.hasOwnProperty(t)?this.operatorMap[t]:this.defaultMatcherMethod}defaultMatcher(t,a,l){}matchEqual(t,a,l){return l==="==="?t===a:t==a}matchNotEqual(t,a,l){return l==="!=="?t!==a:t!=a}matchContains(t,a,l){return a instanceof String||Array.isArray(a)?a.includes(t):typeof a=="object"?a.hasOwnProperty(t):!1}matchIn(t,a,l){return this.matchContains(t,a,l)}matchNotIn(t,a,l){return!this.matchContains(t,a,l)}}class k2{constructor(){Pe(this,"modifierMap",{"+":"applyAddition","-":"applySubstruction"});Pe(this,"defaultModifierMethod",null)}getModificationMethod(t){return t==="=="||t==="==="?"matchEqual":this.modifierMap.hasOwnProperty(t)?this.modifierMap[t]:this.defaultModifierMethod}applyAddition(t,a,l,s,i){return t+a}}class B2{constructor(t,a){Pe(this,"value");Pe(this,"operator");this.value=t,this.operator=a}setOperator(t){return this.operator=t,this}setValue(t){return this.value=t,this}static make(t,a){return new this(t,a)}build(){return{operator:this.operator,value:this.value instanceof Or?this.value.setModifiers([]).build():this.value}}}class Or{constructor(t,a){Pe(this,"accessor");Pe(this,"modifiers");this.accessor=t,this.modifiers=[],this.setModifiers(a)}setAccessor(t){return this.accessor=t,this}addModifier(t){return this.modifiers.push(t),this}setModifiers(t){return this.modifiers=Array.isArray(t)?t:this.modifiers,this}static make(t,a){return new this(t,a)}build(){let t=[];return Array.isArray(this.modifiers)&&this.modifiers.length>0&&(t=this.modifiers.map(a=>a instanceof B2?a.build():a)),t.length>0?{accessor:this.accessor,modifiers:t}:{accessor:this.accessor}}}class Is{constructor(t,a,l,s,i){Pe(this,"conditionType");Pe(this,"conditions");Pe(this,"key");Pe(this,"operator");Pe(this,"value");this.key=t,this.value=a,this.operator=l,this.conditions=[],this.conditionType=this.buildConditionType(s),this.setConditions(i)}static make(t,a,l,s){return new this(t,a,l,s)}setConditionType(t){return this.conditionType=this.buildConditionType(t),this}buildConditionType(t){return t==="or"||t==="|"?"or":"and"}setOperator(t){return this.operator=t,this}setKey(t){return this.key=t,this}setValue(t){return this.value=t,this}addCondition(t){return this.conditions.push(t),this}setConditions(t){return this.conditions=Array.isArray(t)||t instanceof Is||typeof t=="function"?t:this.conditions,this}build(){if(Array.isArray(this.conditions)&&this.conditions.length>0){let l=[];return l=this.conditions.map(s=>s instanceof Is?s.build.bind(s)():s),{condition_type:this.conditionType,conditions:l}}const t=this.key instanceof Or?this.key.build():this.key,a=this.value instanceof Or?this.value.build():this.value;return{key:t,operator:this.operator,value:a}}}class x2{constructor(t,a){Pe(this,"data");Pe(this,"conditions");Pe(this,"stateKey");Pe(this,"matcher");Pe(this,"modifier");this.data=a,this.stateKey=t,this.matcher=new C2,this.modifier=new k2}match(t,a,l,s=!0){let i="",c=this.matcher.getMatchingMethod(a);return c!=null?i=c:i=da.camel("match"+a),i in this.matcher&&typeof this.matcher[i]=="function"?this.matcher[i](t,l,a,s):s}evaluate(t,a="and"){if(t instanceof Is){const s=t.build.bind(t)();s.hasOwnProperty("conditions")?(t=s.conditions,a=s.condition_type):t=[s]}a=a==="or"?"or":"and";let l=a==="and";if(typeof t=="function")return t(this.stateKey,this.data);if(!Array.isArray(t))return!0;for(let s of t){let i=null;if(Array.isArray(dt.get(s,"conditions")))i=this.evaluate(s.conditions,dt.get(s,"condition_type","and"));else{if(s.key===null||s.key===void 0){l=!0;continue}i=this.applyCondition(s)}l=a==="and"?l&&i:l||i}return l}applyCondition(t){let a="",l=null;typeof t.key=="object"?a=dt.resolvePath(this.stateKey,dt.get(t,"key.accessor")):a=dt.resolvePath(this.stateKey,t.key);let s=dt.get(this.data,a);if(typeof t.value=="object"){const i=dt.resolvePath(this.stateKey,dt.get(t,"value.accessor"));l=dt.get(this.data,i)}else l=t.value;return s=this.applyModification(s,t.key.modifiers,this.stateKey),l=this.applyModification(l,t.value.modifiers,this.stateKey),this.match(s,t.operator,l)}applyModification(t,a,l){return Array.isArray(a)&&a.forEach(s=>{let i=s.operator,c="",p=this.modifier.getModificationMethod(i);if(p!=null?c=p:c=da.camel("apply"+i),c in this.modifier&&typeof this.modifier[c]=="function"){let f=s.value;typeof f=="object"&&f!==null&&(f=dt.getByPath(this.data,l,dt.get(f,"accessor"))),t=this.modifier[c](t,f,i,l,this.data)}}),t}}class Bp{constructor(){Pe(this,"_conditionType","and");Pe(this,"_conditions",null)}conditionType(t){return this._conditionType=t,this}conditions(t){return this._conditions=Array.isArray(t)||t instanceof Is||typeof t=="function"?t:this._conditions,this}visibleIf(t){return this._conditions=t,this}buildConditions(t){return Array.isArray(t)&&t.length>0?t.map(a=>a instanceof Is?a.build.bind(a)():a):t}}class xp{constructor(){Pe(this,"_events",{})}event(t,a){return this._events[t]=a,this}}class jo{constructor(t=""){this._component="",this._affix=t}static component(t){const a=new jo;return a._component="Affix/"+t,a}static make(t=""){return new this(t)}build(){return this._component.length>0?{component:this._component}:this._affix}}class Pr{constructor(t,a="input"){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._key=t,this._type=a,this._class="",this._id="",this._name="",this._label="",this._value="",this._placeholder="",this._min="",this._max="",this._prefix="",this._hasPrefix=!1,this._hasSuffix=!1,this._suffix="",ms.install(this,vA),ms.install(this,xp),ms.install(this,Bp),this._wrapperClass=""}static make(t,a="input"){return new this(t,a)}wrapperClass(t){return this._wrapperClass=t,this}type(t){return this._type=t,this}class(t){return this._class=t,this}id(t){return this._id=t,this}name(t){return this._name=t,this}label(t){return this._label=t,this}value(t){return this._value=t,this}placeholder(t){return this._placeholder=t,this}min(t){return this._min=t,this}max(t){return this._max=t,this}prefix(t){return this._hasPrefix=!0,this._prefix=t,this}suffix(t){this._hasSuffix=!0,this._suffix=t}onChange(t){return this._onChangeCallback=t,this}onKeyPress(t){return this._onKeyPressCallback=t,this}onKeyUp(t){return this._onKeyUpCallback=t,this}onKeyDown(t){return this._onKeyDownCallback=t,this}build(){return this._conditions,Array.isArray(this._conditions)&&this._conditions.length>0&&this._conditions.map(t=>t instanceof Is?t.build.bind(t)():t),this._attributes=typeof this._attributes=="object"?this._attributes:{},this._attributes.min=this._min,this._attributes.max=this._max,this._attributes.placeholder=this._placeholder,this._attributes.type=this._type,{key:this._key,type:this._type,class:this._class,id:this._id,name:this._name??u(da.headline(this._key)),label:this._label??u(da.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix instanceof jo?this._suffix.build():this._suffix,prefix:this._prefix instanceof jo?this._prefix.build():this._prefix,min:this._min,max:this._max,placeholder:this._placeholder,attributes:this._attributes,events:this._events,wrapperClass:this._wrapperClass}}}class Hr{constructor(t){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");this._type="section",this._key=t,this._schema=[],this._class="",this.disable_nesting=!0,ms.install(this,vA),ms.install(this,xp),ms.install(this,Bp)}static make(t){return new this(t)}enableNesting(){return this.disable_nesting=!1,this}disableNesting(){return this.disable_nesting=!0,this}class(t){return this._class=t,this}get type(){return this._type}set type(t){if(typeof t=="string")this._type=t;else throw new TypeError("Type must be a string.")}get schema(){return this._schema}setSchema(t){return this._schema=t,this}build(){const t=rn.build(this.schema);return{key:this._key,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),attributes:this._attributes}}}class Yu{constructor(t,a){if(typeof t!="string"||t.length<1)throw new Error("Key is Required");ms.install(this,Pr,{key:t}),ms.install(this,Hr,{key:t}),this._component=a,this._key=t}static make(t,a=""){return new this(t,a)}component(t){return this._component=t,this}value(t){return this._value=t,this}build(){const t=rn.build(this.schema??{});return{type:this._type,class:this._class,id:this._id,name:this._name??u(da.headline(this._key)),label:this._label??u(da.headline(this._key)),value:this._value,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),hasSuffix:this._hasSuffix,hasPrefix:this._hasPrefix,suffix:this._suffix,prefix:this._prefix,placeholder:this._placeholder,attributes:this._attributes,onChange:this._onChangeCallback,onKeyUp:this._onKeyUpCallback,onKeyDown:this._onKeyDownCallback,type:this._type,class:this._class,schema:t,disable_nesting:this.disable_nesting,condition_type:this._conditionType,conditions:this.buildConditions(this._conditions),type:"custom",component:this._component,key:this._key}}}class rn{static build(t){return Array.isArray(t)?rn.buildFromArray(t):typeof t=="object"?rn.buildFromObject(t):t}static buildFromObject(t){let a={};return Object.keys(t).forEach((l,s)=>{const i=t[l];i instanceof Pr||i instanceof Hr||i instanceof Yu?a[l]=i.build.bind(i)():a[l]=t[l]}),a}static buildFromArray(t){let a={};return Array.isArray(t)&&t.forEach(l=>{if(l instanceof Pr||l instanceof Hr||l instanceof Yu){let s=l.build.bind(l)();a[s.key]=s}else a[l.key]=l}),a}}class S2 extends tl{constructor(){super(...arguments);Pe(this,"data",{schema:{},defaults:{},_originalDefaults:{},values:{},initialized:!1,hasChange:!1,validationErrors:{},onChangeCallback:[]});Pe(this,"nestedFormLayouts",["section","tab","tab-pane","grid"]);Pe(this,"ignorableFormLayouts",["grid"])}get hasChange(){return this.data.hasChange}setSchema(a){return this.data.schema=rn.build(a??{}),this.initForm(),this}setDefaults(a){return this.data.defaults=a||{},this.data._originalDefaults=JSON.parse(JSON.stringify(this.data.defaults)),this.initForm(),this}get schema(){return this.data.schema}get values(){return this.data.values}get isReady(){return this.data.initialized}initForm(){if(typeof this.data.schema!="object"||typeof this.data.defaults!="object")throw new Error("You need to set Schema and Defaults First");this.setValues(),this.data.initialized=!0}setValues(){this.data.values=this.ensureNestedDataProperties(this.data.schema,this.data.defaults)}getState(){return this.data.values}setValidationErrors(a){this.data.validationErrors=a||{}}hasValidationError(a){return(this.data.validationErrors??{}).hasOwnProperty(a)}getValidationError(a){return this.data.validationErrors[a]}ensureNestedDataProperties(a,l={}){return Object.keys(a).reduce((s,i)=>{const c=a[i];if(c.type==="html")return s;if(this.nestedFormLayouts.includes(c.type??""))if(c.disable_nesting===!0){const p=this.ensureNestedDataProperties(c.schema??{},l??{});s={...s,...p}}else s[i]=this.ensureNestedDataProperties(c.schema??{},l[i]??{});else s[i]=l[i]??c.value??"";return s},{})}isVisible(a,l){return a.hasOwnProperty("conditions")?new x2(l,this.values).evaluate(dt.get(a,"conditions"),dt.get(a,"condition_type","and")):!0}triggerChange(a){for(let l of this.data.onChangeCallback)l(a)}onDataChanged(a){this.data.onChangeCallback.push(a)}setValue(a,l){dt.set(this.data.values,a,l),this.data.hasChange=!0,this.triggerChange(this.data.values)}reset(a=!0){if(!this.data.schema||!this.data._originalDefaults)throw new Error("Form is not initialized");const l=a?this.data._originalDefaults:this.data.defaults;return this.data.values=this.ensureNestedDataProperties(this.data.schema,JSON.parse(JSON.stringify(l))),this.data.validationErrors={},this.data.hasChange=!1,this.data.initialized=!0,this}}function bd(){return S2.init()}const F2=["innerHTML"],Nr={__name:"FieldNote",props:{note:String},setup(e){return(t,a)=>(r(),h("div",{class:"form-note",innerHTML:e.note},null,8,F2))}},$2=Object.freeze(Object.defineProperty({__proto__:null,default:Nr},Symbol.toStringTag,{value:"Module"})),Wu=Object.assign({name:"ValidationError"},{__name:"ValidationErrorNew",props:{errorKey:String,form:{type:Object,required:!0}},setup(e){return(t,a)=>e.form.hasValidationError(e.errorKey)?(r(),h("div",{key:0,class:de(`fluent-cart-admin-validation-error-wrapper ${e.errorKey}`)},[(r(!0),h(P,null,te(e.form.getValidationError(e.errorKey),(l,s)=>(r(),h("span",{class:"fluent-cart-admin-validation-error",key:l.toLowerCase().replace(/\s/g,"")},m(l),1))),128))],2)):x("",!0)}}),Sp={__name:"Resolver",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},label:{type:String},attribute:{type:Object},callback:{type:Function}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue"),a=Object.assign({"./Affix/Test.vue":()=>Yt(()=>import("./chunks/Test.js?ver=1.6.5"),[],import.meta.url),"./Base/Inputs/Checkbox.vue":()=>Yt(()=>Promise.resolve().then(()=>H2),void 0,import.meta.url),"./Base/Inputs/ColorPicker.vue":()=>Yt(()=>Promise.resolve().then(()=>ak),void 0,import.meta.url),"./Base/Inputs/Date.vue":()=>Yt(()=>Promise.resolve().then(()=>lk),void 0,import.meta.url),"./Base/Inputs/FieldNote.vue":()=>Yt(()=>Promise.resolve().then(()=>$2),void 0,import.meta.url),"./Base/Inputs/Input.vue":()=>Yt(()=>Promise.resolve().then(()=>z2),void 0,import.meta.url),"./Base/Inputs/Media.vue":()=>Yt(()=>Promise.resolve().then(()=>Fk),void 0,import.meta.url),"./Base/Inputs/RadioGroup.vue":()=>Yt(()=>Promise.resolve().then(()=>K2),void 0,import.meta.url),"./Base/Inputs/RemoteSearchableSelect.vue":()=>Yt(()=>Promise.resolve().then(()=>ik),void 0,import.meta.url),"./Base/Inputs/Select.vue":()=>Yt(()=>Promise.resolve().then(()=>ok),void 0,import.meta.url),"./Base/Inputs/Switch.vue":()=>Yt(()=>Promise.resolve().then(()=>P2),void 0,import.meta.url),"./Base/Inputs/Time.vue":()=>Yt(()=>Promise.resolve().then(()=>sk),void 0,import.meta.url),"./Base/Layouts/FormGrid.vue":()=>Yt(()=>Promise.resolve().then(()=>U2),void 0,import.meta.url),"./Base/Layouts/FormSection.vue":()=>Yt(()=>Promise.resolve().then(()=>M2),void 0,import.meta.url),"./Base/Layouts/FormTab.vue":()=>Yt(()=>Promise.resolve().then(()=>L2),void 0,import.meta.url),"./Base/Layouts/FormTabPane.vue":()=>Yt(()=>Promise.resolve().then(()=>R2),void 0,import.meta.url),"./Coupon/BuyProducts.vue":()=>Yt(()=>import("./chunks/BuyProducts.js?ver=1.6.5"),[],import.meta.url),"./Coupon/Categories.vue":()=>Yt(()=>import("./chunks/Categories.js?ver=1.6.5"),[],import.meta.url),"./Coupon/Code.vue":()=>Yt(()=>import("./chunks/Code.js?ver=1.6.5"),[],import.meta.url),"./Coupon/GetProducts.vue":()=>Yt(()=>import("./chunks/GetProducts.js?ver=1.6.5"),[],import.meta.url),"./Coupon/IncludeExclude/Categories.vue":()=>Yt(()=>import("./chunks/Categories2.js?ver=1.6.5"),[],import.meta.url),"./Coupon/IncludeExclude/Product.vue":()=>Yt(()=>import("./chunks/Product.js?ver=1.6.5"),[],import.meta.url),"./Coupon/Products.vue":()=>Yt(()=>import("./chunks/Products.js?ver=1.6.5"),[],import.meta.url),"./McpSettings.vue":()=>Yt(()=>import("./chunks/McpSettings.js?ver=1.6.5"),[],import.meta.url),"./ModuleSettings.vue":()=>Yt(()=>import("./chunks/ModuleSettings.js?ver=1.6.5"),[],import.meta.url),"./PaymentView.vue":()=>Yt(()=>import("./chunks/PaymentView.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/AddressComponent.vue":()=>Yt(()=>import("./chunks/AddressComponent.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/AppearanceComponent.vue":()=>Yt(()=>import("./chunks/AppearanceComponent.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/AppearancePreview.vue":()=>Yt(()=>import("./chunks/AppearancePreview.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/CreatePageButton.vue":()=>Yt(()=>import("./chunks/CreatePageButton.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/PageSelector.vue":()=>Yt(()=>import("./chunks/PageSelector.js?ver=1.6.5"),[],import.meta.url),"./StoreSettings/SubscriptionModeManager.vue":()=>Yt(()=>import("./chunks/SubscriptionModeManager.js?ver=1.6.5"),[],import.meta.url),"./TurnstileSettings.vue":()=>Yt(()=>import("./chunks/TurnstileSettings.js?ver=1.6.5"),[],import.meta.url)}),l=yn(null);Ie(()=>{s(i.name)});const s=async c=>{const p=`./${c}.vue`;a[p]&&(l.value=(await a[p]()).default)},i=e;return(c,p)=>(r(),h(P,null,[(r(),E(gl(l.value),va({name:e.name,field:e.field,fieldKey:e.fieldKey,value:e.value,variant:e.variant,nesting:e.nesting,statePath:e.statePath,form:e.form,attribute:e.attribute,label:e.label,callback:e.callback},{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=f=>t.value=f)}),null,16,["modelValue"])),ga(c.$slots,"fieldNote"),ga(c.$slots,"validationError")],64))}},E2=["id"],wd={__name:"FormGrid",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{var l,s,i,c,p,f,_,g,y,v;return r(),h("div",{class:"gap-2 grid grid-cols-dynamic sm:grid-cols-sm-dynamic md:grid-cols-md-dynamic lg:grid-cols-lg--dynamic",id:e.field.id||"",style:ra({"--grid-columns":((l=e.field.columns)==null?void 0:l.default)??2,"--sm-grid-columns":((s=e.field.columns)==null?void 0:s.sm)??((i=e.field.columns)==null?void 0:i.default)??2,"--md-grid-columns":((c=e.field.columns)==null?void 0:c.sm)??((p=e.field.columns)==null?void 0:p.md)??((f=e.field.columns)==null?void 0:f.default)??2,"--lg-grid-columns":((_=e.field.columns)==null?void 0:_.lg)??((g=e.field.columns)==null?void 0:g.md)??((y=e.field.columns)==null?void 0:y.sm)??((v=e.field.columns)==null?void 0:v.default)??2})},[n(xi,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])],12,E2)}}},U2=Object.freeze(Object.defineProperty({__proto__:null,default:wd},Symbol.toStringTag,{value:"Module"})),I2={key:0,class:"fct-content-card-header"},Q2={key:0,class:"title"},D2={key:1,class:"fct-content-card-action"},V2={__name:"ContentCard",props:["title","show_heading"],setup(e){return(t,a)=>(r(),h("div",{class:de({"fct-content-card":e.show_heading!==!1})},[e.show_heading!==!1?(r(),h("div",I2,[e.title||t.$slots.title?(r(),h("div",Q2,[ga(t.$slots,"title",{},()=>[R(m(e.title),1)])])):x("",!0),t.$slots.action?(r(),h("div",D2,[ga(t.$slots,"action")])):x("",!0)])):x("",!0),o("div",{class:de({"fct-content-card-body":e.show_heading!==!1})},[ga(t.$slots,"default")],2)],2))}},T2=["id"],Fp={__name:"FormSection",props:{field:{type:Object},fieldKey:{type:String},value:{type:Object},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",{class:"form-section",id:e.field.id||""},[n(Se,null,{default:d(()=>[e.field.show_title!==!1?(r(),E(Ve,{key:0,title:e.field.title,border_bottom:""},null,8,["title"])):x("",!0),n(ke,null,{default:d(()=>[n(wd,{form:e.form,field:e.field,statePath:e.statePath,value:e.value},null,8,["form","field","statePath","value"])]),_:1})]),_:1})],8,T2))}},M2=Object.freeze(Object.defineProperty({__proto__:null,default:Fp},Symbol.toStringTag,{value:"Module"})),$p={__name:"FormTab",props:{field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){const t=e,a=T(""),l=T([]),s=sl(),i=_=>{const g=_.props.name;c(g)},c=_=>{const g=new URL(window.location.href);g.hash=`#/settings/${_}`,window.history.replaceState(null,"",g.toString())},p=()=>{const g=window.location.hash.split("/").pop().split("#")[0];l.value=Object.keys(t.field.schema);const y=l.value.find(v=>v===g);y?a.value=y:a.value=t.field.default_tab};let f;return Ie(()=>{f=s.beforeEach((_,g,y)=>{y(),setTimeout(()=>{p()},200)}),p()}),Bt(()=>{f&&f()}),(_,g)=>{const y=C("el-tabs");return r(),E(y,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=v=>a.value=v),class:de(["fct-tabs-button",{"hidden-switch":e.field.hide_tab_switch}]),onTabClick:i,type:"card"},{default:d(()=>[n(xi,{form:e.form,schema:e.field.schema,value:e.value,"state-path":e.statePath},null,8,["form","schema","value","state-path"])]),_:1},8,["modelValue","class"])}}},L2=Object.freeze(Object.defineProperty({__proto__:null,default:$p},Symbol.toStringTag,{value:"Module"})),Ep={__name:"FormTabPane",props:{fieldKey:{type:String},field:{type:Object},value:{type:Object},statePath:{type:String},form:{type:Object,required:!0}},setup(e){return(t,a)=>{const l=C("el-tab-pane");return r(),E(l,{label:e.field.title,name:e.fieldKey},{default:d(()=>[n(xi,{form:e.form,schema:e.field.schema,value:e.value,statePath:e.statePath},null,8,["form","schema","value","statePath"])]),_:1},8,["label","name"])}}},R2=Object.freeze(Object.defineProperty({__proto__:null,default:Ep},Symbol.toStringTag,{value:"Module"}));class Cd{}Pe(Cd,"attributesBuilders",async(t,a,l)=>{if(t.attributes||(t.attributes={}),t.class&&(t.attributes.class=t.class),t.placeholder&&(t.attributes.placeholder=t.placeholder),typeof a!="function")return t.attributes??{};let s={};typeof t.events!="object"&&(s={}),s.hasOwnProperty("onChange")&&typeof s.onChange=="function"?s.onChange=(...i)=>{l.data.hasChange=!0,s.onChange(i)}:s.onChange=()=>{l.data.hasChange=!0};for(let i in t.events)s[i]=(...c)=>{a(t.events[i],c)};for(let i in t.attributes??{}){let c=t.attributes[i];typeof c=="function"&&await a(c,{})}return{...t.attributes??{},...s}});const O2={__name:"LayoutRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;Jt().ctx;const a=(i,c)=>{if(typeof i=="function")return i({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(c)&&c.length===1?c[0]:c})},l=T(!1),s=T({});return Ie(async()=>{s.value=await Cd.attributesBuilders(t.field,a,t.form),l.value=!0}),(i,c)=>(r(),h(P,null,[e.field.type==="grid"&&typeof e.field.schema<"u"?(r(),E(wd,va({key:0,class:e.field.wrapperClass,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["class","form","field","value","fieldKey","statePath"])):x("",!0),e.field.type==="tab"&&typeof e.field.schema<"u"?(r(),E($p,va({key:1,form:e.form,field:e.field,value:e.value,statePath:e.fullStatePath},s.value),null,16,["form","field","value","statePath"])):x("",!0),e.field.type==="tab-pane"&&typeof e.field.schema<"u"&&typeof e.field.title<"u"?(r(),E(Ep,va({key:2,form:e.form,field:e.field,value:e.value,fieldKey:e.fieldKey,statePath:e.fullStatePath},s.value),null,16,["form","field","value","fieldKey","statePath"])):x("",!0),e.field.type==="section"?(r(),E(Fp,va({key:3,class:e.field.wrapperClass,form:e.form,statePath:e.field.disable_nesting===!0?e.fullStatePath:e.fieldKey+".",field:e.field,"field-key":e.fieldKey,value:e.field.disable_nesting===!0?e.value:e.value[e.fieldKey],nesting:e.field.disable_nesting===!0},s.value),null,16,["class","form","statePath","field","field-key","value","nesting"])):x("",!0)],64))}},Up={__name:"Switch",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue");return(a,l)=>{const s=C("el-switch");return r(),E(s,va({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i),disabled:e.field.disabled},e.attribute),null,16,["modelValue","disabled"])}}},P2=Object.freeze(Object.defineProperty({__proto__:null,default:Up},Symbol.toStringTag,{value:"Module"})),Ip={__name:"Checkbox",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue");return(a,l)=>{const s=C("el-checkbox");return r(),E(s,va({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{"true-value":"yes","false-value":"no",disabled:e.field.disabled}),{default:d(()=>[R(m(e.label),1)]),_:1},16,["modelValue","disabled"])}}},H2=Object.freeze(Object.defineProperty({__proto__:null,default:Ip},Symbol.toStringTag,{value:"Module"})),N2=["innerHTML"],Qp={__name:"RadioGroup",props:bl({field:{type:Object},statePath:{type:String},value:{required:!0},form:{type:Object},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue"),a=e,l=T([]),s=async(i="")=>{if(typeof a.field.options=="function")return l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:i});if(Array.isArray(a.field.options))return l.value=[...a.field.options]};return Ie(async()=>{await s()}),(i,c)=>{const p=C("el-radio"),f=C("el-radio-group");return r(),E(f,va({modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=_=>t.value=_)},e.attribute,{class:"inline-flex items-center gap-4"}),{default:d(()=>[(r(!0),h(P,null,te(e.field.options,(_,g)=>(r(),h("div",{key:g,class:de(_.option_class)},[n(p,{value:_.value},{default:d(()=>[R(m(_.label),1)]),_:2},1032,["value"]),_.note?(r(),h("div",{key:0,innerHTML:_.note,class:"radio-option-note"},null,8,N2)):x("",!0)],2))),128))]),_:1},16,["modelValue"])}}},K2=Object.freeze(Object.defineProperty({__proto__:null,default:Qp},Symbol.toStringTag,{value:"Module"})),G2=["innerHTML"],Ws={__name:"Input",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Jt().ctx,a=Il(e,"modelValue"),l=e,s=T(),i=async()=>{typeof l.field.prefix=="function"?s.value=await l.callback(l.field.prefix):s.value=l.field.prefix};return Ie(()=>{i()}),Gf(()=>{i()}),K(()=>l.fieldKey==="amount"?l.form.data.values.type==="fixed"?ze.shop.get("currency_sign"):"%":t.appVars.shop.currency_sign),(c,p)=>{var _;const f=C("el-input");return r(),E(f,va({modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g)},e.attribute,{disabled:e.field.disabled}),oa({_:2},[(_=e.field.prefix)!=null&&_.component?{name:"prefix",fn:d(()=>[n(Sp,{form:e.form,name:e.field.prefix.component,field:e.field,value:e.value},null,8,["form","name","field","value"])]),key:"0"}:e.field.prefix?{name:"prefix",fn:d(()=>[o("div",{innerHTML:s.value},null,8,G2)]),key:"1"}:void 0]),1040,["modelValue","disabled"])}}},z2=Object.freeze(Object.defineProperty({__proto__:null,default:Ws},Symbol.toStringTag,{value:"Module"})),j2={key:0,class:"fct-color-presets-section"},q2=["aria-label"],Y2=["aria-label","aria-pressed","tabindex","onClick","onKeydown"],W2={class:"fct-color-custom-row"},J2={class:"fct-term-color-picker-wrap fct-term-color-picker-wrap--lg"},X2={key:1,class:"fct-color-picker-box"},Z2={class:"fct-color-picker-trigger-wrap"},ek={class:"fct-color-picker-action-wrap"},tk=["disabled","placeholder","aria-label","onKeydown"],kd={__name:"ColorPicker",props:bl({field:{type:Object},statePath:{type:String},value:{default:null},form:{type:Object},callback:{type:Function},label:{type:String},attribute:{default:()=>({})},withPresets:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue"),a=()=>{t.value=""},l=T(t.value||""),s=v=>{let w=(v||"").trim();return w&&w[0]!=="#"&&(w="#"+w),/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(w)?w.toLowerCase():""};be(t,v=>{s(l.value)!==(v||"")&&(l.value=v||"")});const i=()=>{const v=s(l.value);v&&(t.value=v)},c=()=>{const v=s(l.value);v&&(t.value=v),l.value=v||t.value||""},p=v=>v?ks.findIndex(w=>w.toLowerCase()===v.toLowerCase()):-1,f=T(Math.max(0,p(t.value)));be(t,v=>{const w=p(v);w>=0&&(f.value=w)});const _=T([]),g=(v,w)=>{t.value=v,f.value=w},y=(v,w)=>{let k=w;if(v.key==="ArrowRight"||v.key==="ArrowDown")k=(w+1)%ks.length;else if(v.key==="ArrowLeft"||v.key==="ArrowUp")k=(w-1+ks.length)%ks.length;else if(v.key==="Home")k=0;else if(v.key==="End")k=ks.length-1;else return;v.preventDefault(),g(ks[k],k),xe(()=>{_.value[k]&&_.value[k].focus()})};return(v,w)=>{const k=C("el-color-picker"),b=C("el-input");return e.withPresets?(r(),h("div",j2,[o("div",{class:"fct-color-swatch-grid",role:"group","aria-label":A(u)("Color presets")},[(r(!0),h(P,null,te(A(ks),(S,$)=>(r(),h("button",{key:S,ref_for:!0,ref:D=>_.value[$]=D,type:"button",class:de(["fct-color-swatch",{"is-active":t.value&&t.value.toLowerCase()===S.toLowerCase()}]),style:ra({background:S,"--swatch-color":S}),"aria-label":A(u)("Select color %1$s",S),"aria-pressed":!!(t.value&&t.value.toLowerCase()===S.toLowerCase()),tabindex:$===f.value?0:-1,onClick:D=>g(S,$),onKeydown:D=>y(D,$)},null,46,Y2))),128))],8,q2),o("div",W2,[o("div",J2,[n(k,va({modelValue:t.value,"onUpdate:modelValue":w[0]||(w[0]=S=>t.value=S),"color-format":"hex"},e.attribute,{disabled:e.field&&e.field.disabled}),null,16,["modelValue","disabled"])]),n(b,{modelValue:t.value,"onUpdate:modelValue":w[1]||(w[1]=S=>t.value=S),placeholder:A(u)("#000000"),"aria-label":A(u)("Hex color code")},null,8,["modelValue","placeholder","aria-label"])])])):(r(),h("div",X2,[o("div",Z2,[n(k,va({modelValue:t.value,"onUpdate:modelValue":w[2]||(w[2]=S=>t.value=S)},e.attribute,{disabled:e.field&&e.field.disabled,"popper-class":"fct-color-picker-popover"}),null,16,["modelValue","disabled"]),t.value?x("",!0):(r(),E(Y,{key:0,name:"ColorPicker",class:"fct-color-picker-icon w-4 h-4"}))]),o("div",ek,[Wt(o("input",{"onUpdate:modelValue":w[3]||(w[3]=S=>l.value=S),type:"text",class:"fct-color-picker-hex-input",maxlength:"7",spellcheck:"false",disabled:e.field&&e.field.disabled,placeholder:A(u)("Add..."),"aria-label":A(u)("Hex color code"),onInput:i,onBlur:c,onKeydown:xa(Ge(c,["prevent"]),["enter"])},null,40,tk),[[Hc,l.value]]),t.value?(r(),E(Y,{key:0,name:"Cross",class:"fct-color-picker-action w-5 h-5",onClick:a})):x("",!0)])]))}}},ak=Object.freeze(Object.defineProperty({__proto__:null,default:kd},Symbol.toStringTag,{value:"Module"})),Dp={__name:"Date",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue");return(a,l)=>{const s=C("el-date-picker");return r(),E(s,va({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},lk=Object.freeze(Object.defineProperty({__proto__:null,default:Dp},Symbol.toStringTag,{value:"Module"})),Vp={__name:"Time",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue");return(a,l)=>{const s=C("el-time-select");return r(),E(s,va({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},e.attribute,{disabled:e.field.disabled}),null,16,["modelValue","disabled"])}}},sk=Object.freeze(Object.defineProperty({__proto__:null,default:Vp},Symbol.toStringTag,{value:"Module"})),nk={key:0},Tp={__name:"Select",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue"),a=e,l=T([]),s=T(!1),i=async(p="")=>{s.value=!0,typeof a.field.options=="function"&&(l.value=await a.field.options({data:a.value,form:a.form,statePath:a.statePath,search:p})),Array.isArray(a.field.options)&&(l.value=[...a.field.options]),s.value=!1};Ie(async()=>{await i()});const c=p=>typeof p.disabled=="function"?a.callback(p.disabled,{}):p.disabled;return(p,f)=>{const _=C("el-option"),g=C("el-select");return r(),E(g,va({modelValue:t.value,"onUpdate:modelValue":f[0]||(f[0]=y=>t.value=y)},e.attribute,{"remote-method":i,loading:s.value,filterable:e.field.filterable===!0,clearable:e.field.clearable===!0,disabled:e.field.disabled}),{default:d(()=>[(r(!0),h(P,null,te(l.value,(y,v)=>(r(),E(_,{key:v,value:y.value,label:y.label,disabled:c(y)},{default:d(()=>[y.slot?(r(),h("span",nk,m(y.slot),1)):x("",!0)]),_:2},1032,["value","label","disabled"]))),128))]),_:1},16,["modelValue","loading","filterable","clearable","disabled"])}}},ok=Object.freeze(Object.defineProperty({__proto__:null,default:Tp},Symbol.toStringTag,{value:"Module"})),Mp={__name:"RemoteSearchableSelect",props:bl({field:{type:Object},key:{type:String}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue"),a=e,l=T(!1),s=T(a.field.options||[]),i=c=>{if(a.field.search_only_on_type===!0){if(c.query.length===0)return}else if(c.query.length<1&&s.value.length>0)return;l.value=!0,Ae.get("forms/search_options",{search_by:c.query,search_for:c.key}).then(p=>{s.value=p.options,l.value=!1})};return(c,p)=>{const f=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:t.value,"onUpdate:modelValue":p[0]||(p[0]=g=>t.value=g),filterable:"",remote:"",placeholder:e.field.placeholder??A(u)("Please enter a keyword"),"remote-method":g=>{i({query:g,key:e.field.remote_key})},loading:l.value,multiple:e.field.multiple},{default:d(()=>[(r(!0),h(P,null,te(s.value,g=>(r(),E(f,{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","remote-method","loading","multiple"])}}},ik=Object.freeze(Object.defineProperty({__proto__:null,default:Mp},Symbol.toStringTag,{value:"Module"}));function An(e,t){t===void 0&&(t={});var a=t.insertAt;if(e&&typeof document<"u"){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}An(".vel-fade-enter-active,.vel-fade-leave-active{-webkit-transition:all .3s ease;transition:all .3s ease}.vel-fade-enter-from,.vel-fade-leave-to{opacity:0}.vel-img-swiper{display:block;position:relative}.vel-modal{background:rgba(0,0,0,.5);bottom:0;left:0;margin:0;position:fixed;right:0;top:0;z-index:9998}.vel-img-wrapper{left:50%;margin:0;position:absolute;top:50%;-webkit-transform:translate(-50% -50%);transform:translate(-50% -50%);-webkit-transition:.3s linear;transition:.3s linear;will-change:transform opacity}.vel-img,.vel-img-wrapper{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-img{background-color:rgba(0,0,0,.7);-webkit-box-shadow:0 5px 20px 2px rgba(0,0,0,.7);box-shadow:0 5px 20px 2px rgba(0,0,0,.7);display:block;max-height:80vh;max-width:80vw;position:relative;-webkit-transition:-webkit-transform .3s ease-in-out;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;transition:transform .3s ease-in-out,-webkit-transform .3s ease-in-out}@media (max-width:750px){.vel-img{max-height:95vh;max-width:85vw}}.vel-btns-wrapper{position:static}.vel-btns-wrapper .btn__close,.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;font-size:32px;opacity:.6;outline:none;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:.15s linear;transition:.15s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-btns-wrapper .btn__close:hover,.vel-btns-wrapper .btn__next:hover,.vel-btns-wrapper .btn__prev:hover{opacity:1}.vel-btns-wrapper .btn__close.disable,.vel-btns-wrapper .btn__close.disable:hover,.vel-btns-wrapper .btn__next.disable,.vel-btns-wrapper .btn__next.disable:hover,.vel-btns-wrapper .btn__prev.disable,.vel-btns-wrapper .btn__prev.disable:hover{cursor:default;opacity:.2}.vel-btns-wrapper .btn__next{right:12px}.vel-btns-wrapper .btn__prev{left:12px}.vel-btns-wrapper .btn__close{right:10px;top:24px}@media (max-width:750px){.vel-btns-wrapper .btn__next,.vel-btns-wrapper .btn__prev{font-size:20px}.vel-btns-wrapper .btn__close{font-size:24px}.vel-btns-wrapper .btn__next{right:4px}.vel-btns-wrapper .btn__prev{left:4px}}.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:12px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:12px}@media (max-width:750px){.vel-modal.is-rtl .vel-btns-wrapper .btn__next{left:4px;right:auto}.vel-modal.is-rtl .vel-btns-wrapper .btn__prev{left:auto;right:4px}}.vel-modal.is-rtl .vel-img-title{direction:rtl}");An('.vel-loading{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-loading .ring{display:inline-block;height:64px;width:64px}.vel-loading .ring:after{-webkit-animation:ring 1.2s linear infinite;animation:ring 1.2s linear infinite;border-color:hsla(0,0%,100%,.7) transparent;border-radius:50%;border-style:solid;border-width:5px;content:" ";display:block;height:46px;margin:1px;width:46px}@-webkit-keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes ring{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}');An(".vel-on-error{left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-on-error .icon{color:#aaa;font-size:80px}");An(".vel-img-title{bottom:60px;color:#ccc;cursor:default;font-size:12px;left:50%;line-height:1;max-width:80%;opacity:.8;overflow:hidden;position:absolute;text-align:center;text-overflow:ellipsis;-webkit-transform:translate(-50%);transform:translate(-50%);-webkit-transition:opacity .15s;transition:opacity .15s;white-space:nowrap}.vel-img-title:hover{opacity:1}");An(".vel-icon{fill:currentColor;height:1em;overflow:hidden;vertical-align:-.15em;width:1em}");An(".vel-toolbar{border-radius:4px;bottom:8px;display:-webkit-box;display:-ms-flexbox;display:flex;left:50%;opacity:.9;overflow:hidden;padding:0;position:absolute;-webkit-transform:translate(-50%);transform:translate(-50%)}.vel-toolbar,.vel-toolbar .toolbar-btn{background-color:#2d2d2d;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.vel-toolbar .toolbar-btn{-ms-flex-negative:0;-webkit-tap-highlight-color:transparent;color:#fff;cursor:pointer;flex-shrink:0;font-size:20px;outline:none;padding:6px 10px}.vel-toolbar .toolbar-btn:active,.vel-toolbar .toolbar-btn:hover{background-color:#3d3d3d}");const xl="vel",Ml=vs({name:"SvgIcon",props:{type:{type:String,default:""}},setup:e=>()=>n("svg",{class:`${xl}-icon icon`,"aria-hidden":"true"},[n("use",{"xlink:href":`#icon-${e.type}`},null)])}),ki=typeof window<"u",Js=()=>{};let Lp=!1;if(ki)try{const e={};Object.defineProperty(e,"passive",{get(){Lp=!0}}),window.addEventListener("test-passive",Js,e)}catch{}const Ju=function(e,t,a){let l=arguments.length>3&&arguments[3]!==void 0&&arguments[3];ki&&e.addEventListener(t,a,!!Lp&&{capture:!1,passive:l})},Xu=(e,t,a)=>{ki&&e.removeEventListener(t,a)},rk=e=>{e.preventDefault()},dk=Object.prototype.toString,Bd=e=>t=>dk.call(t).slice(8,-1)===e,uk=e=>!!e&&Bd("Object")(e),Zu=e=>!!e&&Bd("String")(e);function ck(e){return e!=null}const Ak=vs({name:"Toolbar",props:{zoomIn:{type:Function,default:Js},zoomOut:{type:Function,default:Js},rotateLeft:{type:Function,default:Js},rotateRight:{type:Function,default:Js},resize:{type:Function,default:Js},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1}},setup:e=>()=>n("div",{class:`${xl}-toolbar`},[!e.zoomDisabled&&n(P,null,[n("div",{role:"button","aria-label":"zoom in button",class:"toolbar-btn toolbar-btn__zoomin",onClick:e.zoomIn},[n(Ml,{type:"zoomin"},null)]),n("div",{role:"button","aria-label":"zoom out button",class:"toolbar-btn toolbar-btn__zoomout",onClick:e.zoomOut},[n(Ml,{type:"zoomout"},null)])]),n("div",{role:"button","aria-label":"resize image button",class:"toolbar-btn toolbar-btn__resize",onClick:e.resize},[n(Ml,{type:"resize"},null)]),!e.rotateDisabled&&n(P,null,[n("div",{role:"button","aria-label":"image rotate left button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateLeft},[n(Ml,{type:"rotate-left"},null)]),n("div",{role:"button","aria-label":"image rotate right button",class:"toolbar-btn toolbar-btn__rotate",onClick:e.rotateRight},[n(Ml,{type:"rotate-right"},null)])])])}),pk=()=>n("div",{class:`${xl}-loading`},[n("div",{class:"ring"},null)]),fk=()=>n("div",{class:`${xl}-on-error`},[n("div",{class:"ring"},null),n(Ml,{type:"img-broken"},null)]),mk=(e,t)=>{let{slots:a}=t;return n("div",{class:`${xl}-img-title`},[a.default?a.default():""])},hk=vs({name:"DefaultIcons",setup:()=>()=>n("svg",{"aria-hidden":!0,style:"position: absolute; width: 0; height: 0; overflow: hidden; visibility: hidden;"},[n("symbol",{id:"icon-rotate-right",viewBox:"0 0 1024 1024"},[n("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973z m282.559912-479.07185A509.887841 509.887841 0 0 0 511.99984 0.00032C229.215928 0.00032 0 229.216248 0 512.00016s229.215928 511.99984 511.99984 511.99984 511.99984-229.215928 511.99984-511.99984c0-3.743999-0.032-7.455998-0.128-11.167997-1.631999-11.295996-8.159997-27.103992-31.87199-27.103991-27.487991 0-31.67999 21.247993-32.03199 32.06399l0.032 4.127999a30.62399 30.62399 0 0 0 0.16 2.079999H959.9997c0 247.423923-200.575937 447.99986-447.99986 447.99986S63.99998 759.424083 63.99998 512.00016 264.575917 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 1 277.439913 96.22397l-94.91197 91.679971c-25.439992 24.607992-17.439995 44.991986 17.887994 45.599986l188.031942 3.295999a64.31998 64.31998 0 0 0 65.055979-62.84798l3.295999-188.127942C969.407697 15.040315 949.311703 5.792318 923.871711 30.368311l-87.999972 85.023973z",fill:""},null)]),n("symbol",{id:"icon-rotate-left",viewBox:"0 0 1024 1024"},[n("path",{d:"M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973zM188.159941 115.392284A509.887841 509.887841 0 0 1 511.99984 0.00032c282.783912 0 511.99984 229.215928 511.99984 511.99984s-229.215928 511.99984-511.99984 511.99984S0 794.784072 0 512.00016c0-3.743999 0.032-7.455998 0.128-11.167997 1.631999-11.295996 8.159997-27.103992 31.87199-27.103991 27.487991 0 31.67999 21.247993 32.03199 32.06399L63.99998 509.920161a30.62399 30.62399 0 0 1-0.16 2.079999H63.99998c0 247.423923 200.575937 447.99986 447.99986 447.99986s447.99986-200.575937 447.99986-447.99986S759.423763 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 0-277.439913 96.22397l94.91197 91.679971c25.439992 24.607992 17.439995 44.991986-17.887994 45.599986L123.551961 300.800226a64.31998 64.31998 0 0 1-65.055979-62.84798l-3.295999-188.127942C54.591983 15.040315 74.687977 5.792318 100.127969 30.368311l87.999972 85.023973z",fill:""},null)]),n("symbol",{id:"icon-resize",viewBox:"0 0 1024 1024"},[n("path",{d:"M456.036919 791.8108 270.553461 791.8108 460.818829 601.572038l-39.593763-39.567157L231.314785 751.915162l0.873903-183.953615c0-15.465227-12.515035-27.981285-27.981285-27.981285s-27.981285 12.515035-27.981285 27.981285l0 251.829516c0 8.3072 3.415796 14.975063 8.826016 19.564591 5.082762 5.192256 12.132318 8.416693 19.947308 8.416693l251.036453 0c15.46625 0 27.981285-12.514012 27.981285-27.981285C484.018204 804.325835 471.504192 791.8108 456.036919 791.8108zM838.945819 184.644347c-5.082762-5.191232-12.132318-8.416693-19.947308-8.416693L567.961034 176.227654c-15.46625 0-27.981285 12.515035-27.981285 27.981285 0 15.46625 12.514012 27.981285 27.981285 27.981285l185.483458 0L563.206754 422.427962l39.567157 39.567157 189.910281-189.910281-0.873903 183.953615c0 15.46625 12.514012 27.981285 27.981285 27.981285s27.981285-12.514012 27.981285-27.981285L847.772858 204.208938C847.771835 195.902762 844.356039 189.234899 838.945819 184.644347zM847.771835 64.303538 176.227142 64.303538c-61.809741 0-111.924115 50.115398-111.924115 111.924115l0 671.544693c0 61.809741 50.114374 111.924115 111.924115 111.924115l671.544693 0c61.809741 0 111.924115-50.114374 111.924115-111.924115l0-671.544693C959.69595 114.418936 909.581576 64.303538 847.771835 64.303538zM903.733381 847.772346c0 30.878265-25.056676 55.962569-55.962569 55.962569L176.227142 903.734916c-30.90487 0-55.962569-25.084305-55.962569-55.962569l0-671.544693c0-30.9325 25.056676-55.962569 55.962569-55.962569l671.544693 0c30.90487 0 55.962569 25.03007 55.962569 55.962569L903.734404 847.772346z"},null)]),n("symbol",{id:"icon-img-broken",viewBox:"0 0 1024 1024"},[n("path",{d:"M810.666667 128H213.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333v597.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h597.333334c46.933333 0 85.333333-38.4 85.333333-85.333333V213.333333c0-46.933333-38.4-85.333333-85.333333-85.333333z m0 682.666667H213.333333v-195.413334l42.24 42.24 170.666667-170.666666 170.666667 170.666666 170.666666-170.24L810.666667 530.346667V810.666667z m0-401.493334l-43.093334-43.093333-170.666666 171.093333-170.666667-170.666666-170.666667 170.666666-42.24-42.666666V213.333333h597.333334v195.84z"},null)]),n("symbol",{id:"icon-prev",viewBox:"0 0 1024 1024"},[n("path",{d:"M784.652701 955.6957 346.601985 517.644983c-2.822492-2.822492-2.822492-7.902977 0-11.289967l439.179713-439.179713c6.77398-6.77398 10.725469-16.370452 10.725469-25.966924L796.507166 36.692393c0-20.32194-16.370452-36.692393-36.692393-36.692393l-4.515987 0c-9.596472 0-19.192944 3.951488-25.966924 10.725469L250.072767 489.420066c-12.418964 12.418964-12.418964 32.740904 0 45.159868l477.565601 477.565601c7.338479 7.338479 17.499449 11.854465 28.224917 11.854465l0 0c22.015436 0 40.079383-18.063947 40.079383-40.079383l0 0C796.507166 973.759647 791.99118 963.598677 784.652701 955.6957z"},null)]),n("symbol",{id:"icon-next",viewBox:"0 0 1024 1024"},[n("path",{d:"M246.121279 955.6957l438.050717-438.050717c2.822492-2.822492 2.822492-7.902977 0-11.289967L244.992282 67.175303c-6.77398-6.77398-10.725469-16.370452-10.725469-25.966924L234.266814 36.692393C234.266814 16.370452 250.637266 0 270.959206 0l4.515987 0c9.596472 0 19.192944 3.951488 25.966924 10.725469l478.694598 478.694598c12.418964 12.418964 12.418964 32.740904 0 45.159868l-477.565601 477.565601c-7.338479 7.338479-17.499449 11.854465-28.224917 11.854465l0 0c-22.015436 0-40.079383-18.063947-40.079383-40.079383l0 0C234.266814 973.759647 238.7828 963.598677 246.121279 955.6957z"},null)]),n("symbol",{id:"icon-zoomin",viewBox:"0 0 1024 1024"},[n("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null),n("path",{d:"M367.488 238.144h127.104v390.72H367.488z"},null)]),n("symbol",{id:"icon-close",viewBox:"0 0 1024 1024"},[n("path",{d:"M570.24 512l259.2 259.2-58.88 58.24L512 570.24l-261.12 261.12-58.24-58.24L453.76 512 194.56 252.8l58.24-58.24L512 453.76l261.12-261.12 58.24 58.24z"},null)]),n("symbol",{id:"icon-zoomout",viewBox:"0 0 1024 1024"},[n("path",{d:"M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z"},null),n("path",{d:"M235.712 369.92h390.72v127.104H235.712z"},null)])])}),Qn=ki?window:global;let ec=Date.now();function _k(e){const t=Date.now(),a=Math.max(0,16-(t-ec)),l=setTimeout(e,a);return ec=t+a,l}function er(e){return(Qn.requestAnimationFrame||_k).call(Qn,e)}function tc(e){(Qn.cancelAnimationFrame||Qn.clearTimeout).call(Qn,e)}function ac(e,t){const a=e.clientX-t.clientX,l=e.clientY-t.clientY;return Math.sqrt(a*a+l*l)}function tr(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!zf(e)}var ar=vs({name:"VueEasyLightbox",props:{imgs:{type:[Array,String],default:()=>""},visible:{type:Boolean,default:!1},index:{type:Number,default:0},scrollDisabled:{type:Boolean,default:!0},escDisabled:{type:Boolean,default:!1},moveDisabled:{type:Boolean,default:!1},titleDisabled:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!0},teleport:{type:[String,Object],default:null},swipeTolerance:{type:Number,default:50},loop:{type:Boolean,default:!1},rtl:{type:Boolean,default:!1},zoomScale:{type:Number,default:.12},maxZoom:{type:Number,default:3},minZoom:{type:Number,default:.1},rotateDisabled:{type:Boolean,default:!1},zoomDisabled:{type:Boolean,default:!1},pinchDisabled:{type:Boolean,default:!1},dblclickDisabled:{type:Boolean,default:!1}},emits:{hide:()=>!0,"on-error":e=>!0,"on-prev":(e,t)=>!0,"on-next":(e,t)=>!0,"on-prev-click":(e,t)=>!0,"on-next-click":(e,t)=>!0,"on-index-change":(e,t)=>!0,"on-rotate":e=>!0},setup(e,t){let{emit:a,slots:l}=t;const{imgRef:s,imgState:i,setImgSize:c}=(()=>{const Be=T(),$e=Zs({width:0,height:0,maxScale:1});return{imgRef:Be,imgState:$e,setImgSize:()=>{if(Be.value){const{width:He,height:Re,naturalWidth:yt}=Be.value;$e.maxScale=yt/He,$e.width=He,$e.height=Re}}}})(),p=T(e.index),f=T(""),_=Zs({scale:1,lastScale:1,rotateDeg:0,top:0,left:0,initX:0,initY:0,lastX:0,lastY:0,touches:[]}),g=Zs({loadError:!1,loading:!1,dragging:!1,gesturing:!1,wheeling:!1}),y=K(()=>{return Be=e.imgs,Bd("Array")(Be)?e.imgs.map($e=>typeof $e=="string"?{src:$e}:function(He){return uk(He)&&Zu(He.src)}($e)?$e:void 0).filter(ck):Zu(e.imgs)?[{src:e.imgs}]:[];var Be}),v=K(()=>y.value[p.value]),w=K(()=>{var Be;return(Be=y.value[p.value])==null?void 0:Be.src}),k=K(()=>{var Be;return(Be=y.value[p.value])==null?void 0:Be.title}),b=K(()=>{var Be;return(Be=y.value[p.value])==null?void 0:Be.alt}),S=K(()=>({cursor:g.loadError?"default":e.moveDisabled?g.dragging?"grabbing":"grab":"move",top:`calc(50% + ${_.top}px)`,left:`calc(50% + ${_.left}px)`,transition:g.dragging||g.gesturing?"none":"",transform:`translate(-50%, -50%) scale(${_.scale}) rotate(${_.rotateDeg}deg)`})),$=()=>{a("hide")},D=()=>{_.scale=1,_.lastScale=1,_.rotateDeg=0,_.top=0,_.left=0,g.loadError=!1,g.dragging=!1,g.loading=!0},F=(Be,$e)=>{const He=p.value;D(),p.value=Be,y.value[p.value]===y.value[Be]&&xe(()=>{g.loading=!1}),e.visible&&He!==Be&&($e&&$e(He,Be),a("on-index-change",He,Be))},B=()=>{const Be=p.value,$e=e.loop?(Be+1)%y.value.length:Be+1;!e.loop&&$e>y.value.length-1||F($e,(He,Re)=>{a("on-next",He,Re),a("on-next-click",He,Re)})},U=()=>{const Be=p.value;let $e=Be-1;if(Be===0){if(!e.loop)return;$e=y.value.length-1}F($e,(He,Re)=>{a("on-prev",He,Re),a("on-prev-click",He,Re)})},Q=Be=>{Math.abs(1-Be)<.05?Be=1:Math.abs(i.maxScale-Be)<.05&&(Be=i.maxScale),_.lastScale=_.scale,_.scale=Be},V=()=>{const Be=_.scale+e.zoomScale;Be<i.maxScale*e.maxZoom&&Q(Be)},I=()=>{const Be=_.scale-e.zoomScale;Be>e.minZoom&&Q(Be)},M=()=>{const Be=_.rotateDeg%360;a("on-rotate",Math.abs(Be<0?Be+360:Be))},O=()=>{_.rotateDeg-=90,M()},L=()=>{_.rotateDeg+=90,M()},H=()=>{_.scale=1,_.top=0,_.left=0},j=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return!e.moveDisabled&&Be===0},{onMouseDown:W,onMouseMove:G,onMouseUp:Z}=((Be,$e,He)=>{let Re,yt=!1;return{onMouseDown:gt=>{Be.initX=Be.lastX=gt.clientX,Be.initY=Be.lastY=gt.clientY,$e.dragging=!0,yt=!1,gt.stopPropagation()},onMouseUp:gt=>{He(gt.button)&&tc(Re),$e.dragging=!1,yt=!1},onMouseMove:gt=>{if($e.dragging)if(He(gt.button)){if(yt)return;yt=!0,Re=er(()=>{const{top:Rt,left:Tt,lastY:Dt,lastX:_t}=Be;Be.top=Rt-Dt+gt.clientY,Be.left=Tt-_t+gt.clientX,Be.lastX=gt.clientX,Be.lastY=gt.clientY,yt=!1})}else Be.lastX=gt.clientX,Be.lastY=gt.clientY;gt.stopPropagation()}}})(_,g,j),{onTouchStart:ne,onTouchMove:ce,onTouchEnd:z}=((Be,$e,He,Re,yt)=>{let gt,Rt=!1;return{onTouchStart:Tt=>{const{touches:Dt}=Tt;Dt.length>1&&yt()?(He.gesturing=!0,$e.touches=Dt):($e.initX=$e.lastX=Dt[0].clientX,$e.initY=$e.lastY=Dt[0].clientY,He.dragging=!0),Tt.stopPropagation()},onTouchMove:Tt=>{if(Rt)return;const{touches:Dt}=Tt,{lastX:_t,lastY:Gt,left:bt,top:St,scale:Pt}=$e;if(!He.gesturing&&He.dragging){if(!Dt[0])return;const{clientX:Ht,clientY:Qt}=Dt[0];Re()?gt=er(()=>{$e.lastX=Ht,$e.lastY=Qt,$e.top=St-Gt+Qt,$e.left=bt-_t+Ht,Rt=!1}):($e.lastX=Ht,$e.lastY=Qt)}else He.gesturing&&$e.touches.length>1&&Dt.length>1&&yt()&&(gt=er(()=>{const Ht=(ac($e.touches[0],$e.touches[1])-ac(Dt[0],Dt[1]))/Be.width;$e.touches=Dt;const Qt=Pt-1.3*Ht;Qt>.5&&Qt<1.5*Be.maxScale&&($e.scale=Qt),Rt=!1}))},onTouchEnd:()=>{tc(gt),He.dragging=!1,He.gesturing=!1,Rt=!1}}})(i,_,g,j,()=>!e.pinchDisabled),ue=()=>{e.dblclickDisabled||(_.scale!==i.maxScale?(_.lastScale=_.scale,_.scale=i.maxScale):_.scale=_.lastScale)},ie=Be=>{g.loadError||g.gesturing||g.loading||g.dragging||g.wheeling||!e.scrollDisabled||e.zoomDisabled||(g.wheeling=!0,setTimeout(()=>{g.wheeling=!1},80),Be.deltaY<0?V():I())},J=Be=>{const $e=Be;e.visible&&(!e.escDisabled&&$e.key==="Escape"&&e.visible&&$(),$e.key==="ArrowLeft"&&(e.rtl?B():U()),$e.key==="ArrowRight"&&(e.rtl?U():B()))},N=()=>{e.maskClosable&&$()},ae=()=>{c()},oe=()=>{g.loading=!1},fe=Be=>{g.loading=!1,g.loadError=!0,a("on-error",Be)},re=()=>{e.visible&&c()};be(()=>e.index,Be=>{Be<0||Be>=y.value.length||F(Be)}),be(()=>g.dragging,(Be,$e)=>{const He=!Be&&$e;if(!j()&&He){const Re=_.lastX-_.initX,yt=_.lastY-_.initY,gt=e.swipeTolerance;Math.abs(Re)>Math.abs(yt)&&(Re<-1*gt?B():Re>gt&&U())}}),be(()=>e.visible,Be=>{if(Be){D();const $e=y.value.length;if($e===0)return p.value=0,g.loading=!1,void xe(()=>g.loadError=!0);p.value=e.index>=$e?$e-1:e.index<0?0:e.index,e.scrollDisabled&&Ee()}else e.scrollDisabled&&ye()});const Ee=()=>{document&&(f.value=document.body.style.overflowY,document.body.style.overflowY="hidden")},ye=()=>{document&&(document.body.style.overflowY=f.value)};Ie(()=>{Ju(document,"keydown",J),Ju(window,"resize",re)}),cl(()=>{Xu(document,"keydown",J),Xu(window,"resize",re),e.scrollDisabled&&ye()});const Ce=()=>g.loading?l.loading?l.loading({key:"loading"}):n(pk,{key:"img-loading"},null):g.loadError?l.onerror?l.onerror({key:"onerror"}):n(fk,{key:"img-on-error"},null):n("div",{class:`${xl}-img-wrapper`,style:S.value,key:"img-wrapper"},[n("img",{alt:b.value,ref:s,draggable:"false",class:`${xl}-img`,src:w.value,onMousedown:W,onMouseup:Z,onMousemove:G,onTouchstart:ne,onTouchmove:ce,onTouchend:z,onLoad:ae,onDblclick:ue,onDragstart:Be=>{Be.preventDefault()}},null)]),ve=()=>{if(l["prev-btn"])return l["prev-btn"]({prev:U});if(y.value.length<=1)return;const Be=!e.loop&&p.value<=0;return n("div",{role:"button","aria-label":"previous image button",class:"btn__prev "+(Be?"disable":""),onClick:U},[e.rtl?n(Ml,{type:"next"},null):n(Ml,{type:"prev"},null)])},Ue=()=>{if(l["next-btn"])return l["next-btn"]({next:B});if(y.value.length<=1)return;const Be=!e.loop&&p.value>=y.value.length-1;return n("div",{role:"button","aria-label":"next image button",class:"btn__next "+(Be?"disable":""),onClick:B},[e.rtl?n(Ml,{type:"prev"},null):n(Ml,{type:"next"},null)])},Ke=()=>{if(!(e.titleDisabled||g.loading||g.loadError))return l.title?l.title({currentImg:v.value}):k.value?n(mk,null,{default:()=>[k.value]}):void 0},We=()=>{let Be;if(e.visible)return n("div",{onTouchmove:rk,class:[`${xl}-modal`,e.rtl?"is-rtl":""],onClick:Ge(N,["self"]),onWheel:ie},[n(hk,null,null),n(Xl,{name:`${xl}-fade`,mode:"out-in"},tr(Be=Ce())?Be:{default:()=>[Be]}),n("img",{style:"display:none;",src:w.value,onError:fe,onLoad:oe},null),n("div",{class:`${xl}-btns-wrapper`},[ve(),Ue(),Ke(),l["close-btn"]?l["close-btn"]({close:$}):n("div",{role:"button","aria-label":"close image preview button",class:"btn__close",onClick:$},[n(Ml,{type:"close"},null)]),l.toolbar?l.toolbar({toolbarMethods:{zoomIn:V,zoomOut:I,rotate:O,rotateLeft:O,rotateRight:L,resize:H},zoomIn:V,zoomOut:I,rotate:O,rotateLeft:O,rotateRight:L,resize:H}):n(Ak,{zoomIn:V,zoomOut:I,resize:H,rotateLeft:O,rotateRight:L,rotateDisabled:e.rotateDisabled,zoomDisabled:e.zoomDisabled},null)])])};return()=>{let Be;if(e.teleport){let $e;return n(ii,{to:e.teleport},{default:()=>[n(Xl,{name:`${xl}-fade`},tr($e=We())?$e:{default:()=>[$e]})]})}return n(Xl,{name:`${xl}-fade`},tr(Be=We())?Be:{default:()=>[Be]})}}});const vk=Object.assign(ar,{install:e=>{e.component(ar.name,ar)}}),gk={name:"Attachments",components:{MediaButton:uA,VueEasyLightbox:vk,IconButton:at,Delete:Wc},props:{multiple:Boolean,attachments:{type:[Array,Object],default:()=>[]},empty_text:String,isSingle:Boolean,title:String,type:String,icon:String,showList:{type:Boolean,default:!0},showDeleteButton:{type:Boolean,default:!0},previewImage:{type:Boolean,default:!0},mediaInputSize:{type:String},mediaInputBg:{type:String}},emits:["removeImage","mediaUploaded"],data(){return{visible:!1,imageIndex:0,lightboxData:[],images:T([])}},computed:{showMediaButtonAsIcon:function(){return!this.multiple&&this.attachments.length===1}},watch:{attachments:{handler:function(e,t){return this.lightboxData=[],Array.isArray(e)&&e.length>0&&e.map((a,l)=>{this.lightboxData.push(a.url)}),e},deep:!0}},mounted:function(){Array.isArray(this.attachments)&&this.attachments.length>0&&this.attachments.forEach(e=>{this.lightboxData.push(e.url),this.images.push({id:e.id,url:e.url,title:e.title})})},methods:{translate:u,removeImageEvent(e){this.$emit("removeImage",e)},onMediaSelected(e){this.images=e.map(t=>({id:t.id,title:t.title,url:t.url})),this.$emit("mediaUploaded",this.images)}}},yk={class:"fct-attachments-wrap",style:{position:"relative"}},bk={class:"fct-attachment-img-wrap"},wk=["src","alt","onClick"],Ck={class:"fct-attachments-button"};function kk(e,t,a,l,s,i){const c=C("VueEasyLightbox"),p=C("MediaButton"),f=C("IconButton"),_=C("Delete");return r(),h(P,null,[n(c,{visible:s.visible,imgs:s.lightboxData,index:s.imageIndex,onHide:t[0]||(t[0]=()=>{s.visible=!1})},null,8,["visible","imgs","index"]),o("div",yk,[a.attachments?(r(),h("ul",{key:0,class:de(`fct-attachments-list ${a.multiple?"is-multiple":"fct-single-attachment"} ${a.attachments.length>0?"is-single":""}`)},[a.showList===!0?(r(!0),h(P,{key:0},te(a.attachments,(g,y)=>(r(),h("li",{key:y,class:de([[a.mediaInputSize,a.mediaInputBg],"fct-attachment-item"])},[o("div",bk,[a.previewImage?(r(),h("img",{key:0,src:g.url,alt:g.title,onClick:()=>{s.imageIndex=y,s.visible=!0}},null,8,wk)):x("",!0),i.showMediaButtonAsIcon&&!a.multiple?(r(),E(f,{key:1,size:"x-small"},{default:d(()=>[n(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)]),o("div",Ck,[a.showDeleteButton?(r(),E(f,{key:0,tag:"button",bg:"danger",outline:"",size:"x-small",onClick:Ge(v=>i.removeImageEvent(y),["prevent"]),title:i.translate("Delete media")},{default:d(()=>[a.multiple?(r(),E(_,{key:0})):(r(),h(P,{key:1},[R(m(i.translate("Remove")),1)],64))]),_:2},1032,["onClick","title"])):x("",!0),i.showMediaButtonAsIcon&&a.multiple?(r(),E(f,{key:1,size:"x-small"},{default:d(()=>[n(p,{"icon-mode":!0,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])]),_:1})):x("",!0)])],2))),128)):x("",!0),i.showMediaButtonAsIcon?x("",!0):(r(),h("li",{key:1,class:de([a.mediaInputSize,a.mediaInputBg])},[n(p,{"icon-mode":!1,attachments:a.attachments,title:a.multiple?"":a.title,onOnMediaSelected:i.onMediaSelected,multiple:a.multiple,icon:a.icon},null,8,["attachments","title","onOnMediaSelected","multiple","icon"])],2))],2)):x("",!0),ga(e.$slots,"default")])],64)}const Rp=nt(gk,[["render",kk]]),Bk={key:0},xk={key:0,class:"setting-label"},Bi={__name:"MediaInput",props:{modelValue:{default:""},showSupported:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},fullWidth:{type:Boolean,default:!1},icon:{type:String},title:{type:String},mediaInputSize:{type:String},mediaInputBg:{type:String},field:{type:Object}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=T();let i=T([]);const c=()=>{a.multiple?s.value=[]:s.value="",i.value=[],l("update:modelValue",s.value)},p=_=>{if(_.length)if(a.multiple){s.value=[],i.value=[];for(const g of _)s.value.push(g),i.value.push(g)}else s.value=_,i.value=_;l("update:modelValue",s.value)};be(()=>a.modelValue,_=>{Array.isArray(_)&&_.length>0?s.value=_:_&&typeof _=="string"&&_!==""?s.value=[_]:_&&typeof _=="object"?s.value=[_]:s.value=[],f()});const f=()=>{i.value=[],Object.values(s.value).forEach((_,g)=>{_!==void 0&&_!==""&&i.value.push(_)})};return Ie(()=>{Array.isArray(a.modelValue)&&a.modelValue.length>0?s.value=a.modelValue:a.modelValue&&typeof a.modelValue=="string"&&a.modelValue!==""?s.value=[a.modelValue]:a.modelValue&&typeof a.modelValue=="object"?s.value=[a.modelValue]:s.value=[],f()}),(_,g)=>(r(),h(P,null,[n(Rp,{attachments:A(i),onMediaUploaded:p,onRemoveImage:c,icon:e.icon,title:e.title,mediaInputSize:e.mediaInputSize,mediaInputBg:e.mediaInputBg},null,8,["attachments","icon","title","mediaInputSize","mediaInputBg"]),e.showSupported?(r(),h("div",Bk,[e.field&&e.field.label?(r(),h("label",xk,m(e.field.label),1)):x("",!0),o("span",null,m(A(u)("%1$s Recommended width: %2$s pixels minimum.","HEIC, WEBP, SVG, PNG, or JPG.","512")),1)])):x("",!0)],64))}},Sk={class:"setting-media-wrap"},Op={__name:"Media",props:bl({name:{type:String,required:!0},field:{type:Object},fieldKey:{type:String},value:{required:!0},variant:{type:String},nesting:{type:Boolean,default:!1},statePath:{type:String},form:{type:Object,required:!0},callback:{type:Function,required:!0},label:{type:String},attribute:{required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=Il(e,"modelValue");return(a,l)=>(r(),h("div",Sk,[n(Bi,va({modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=s=>t.value=s),field:e.field,icon:"Upload"},e.attribute),null,16,["modelValue","field"])]))}},Fk=Object.freeze(Object.defineProperty({__proto__:null,default:Op},Symbol.toStringTag,{value:"Module"})),$k={__name:"InputRenderer",props:{form:{type:Object,required:!0},field:{type:Object,required:!0},value:{type:Object,required:!0},statePath:{type:String,required:!0},fieldKey:{type:String,required:!0},fullStatePath:{type:String,required:!0}},setup(e){const t=e;T(!1),Jt().ctx;const a=_=>typeof _.label=="function"?_.label(t.value,t.statePath,t.form):_.label,l=(_,g)=>{if(typeof _=="function")return _({data:t.value,form:t.form,statePath:t.statePath,field:t.field,event:Array.isArray(g)&&g.length===1?g[0]:g})},s=T(!1);let i={};Ie(async()=>{i=await Cd.attributesBuilders(t.field,l,t.form),s.value=!0});const c={switch:Up,checkbox:Ip,radio:Qp,input:Ws,text:Ws,email:Ws,number:Ws,textarea:Ws,color:kd,date:Dp,time:Vp,select:Tp,media:Op,remote_select:Mp},p=K(()=>c[t.field.type]||null),f=K(()=>({modelValue:t.value[t.fieldKey],form:t.form,statePath:t.statePath,field:t.field,fieldKey:t.fieldKey,value:t.value[t.fieldKey],nesting:!1,label:a(t.field),attribute:i,callback:l}));return(_,g)=>e.field.type==="wp-editor"?(r(),E(ls,{key:0,shortCodes:e.field.shortcodes.data,modelValue:t.value[t.fieldKey],onUpdate:g[0]||(g[0]=y=>{t.value[t.fieldKey]=y})},null,8,["shortCodes","modelValue"])):p.value&&s.value?(r(),E(gl(p.value),va({key:1,onChange:g[1]||(g[1]=y=>{e.form.triggerChange(y)}),onInput:g[2]||(g[2]=y=>{e.form.triggerChange(e.value[e.fieldKey])}),modelValue:e.value[e.fieldKey],"onUpdate:modelValue":g[3]||(g[3]=y=>e.value[e.fieldKey]=y)},f.value),null,16,["modelValue"])):x("",!0)}},Ek=["innerHTML"],Uk={key:0},Ik={key:0},xi={__name:"FormRenderer",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},statePath:{type:String}},setup(e){const t=e,a=t.statePath??"",l=["grid","section","tab","tab-pane"];T(!1),Jt().ctx;const s=(c,p)=>{if(typeof c.label=="function"){let f=i(c)?a:p+".",_=i(c)?t.value:t.value[p];return c.label(_,f,t.form)}return c.label},i=c=>c.disable_nesting!==!1;return(c,p)=>(r(!0),h(P,null,te(e.schema,(f,_)=>(r(),h(P,{key:_},[e.form.isVisible(f,e.statePath+_)?(r(),h(P,{key:0},[f.type==="html"?(r(),h("div",{key:0,class:de(`setting-html-wrapper ${f.wrapperClass??""}`),innerHTML:f.value},null,10,Ek)):(r(),h(P,{key:1},[f.component?(r(),h("div",{key:0,class:de(f.wrapperClass??"")},[f.component&&f.label?(r(),E(pa,{key:0,title:s(f,_),content:f.tooltip,class:"setting-label",placement:f.tooltip_placement},{default:d(()=>[f.labelOptional?(r(),h("span",Uk,"("+m(f.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),n(Sp,{modelValue:e.value[_],"onUpdate:modelValue":g=>e.value[_]=g,name:f.component,form:e.form,statePath:i(f)?A(a):_+".",field:f,"field-key":_,value:i(f)?e.value:e.value[_],nesting:i(f)},{fieldNote:d(()=>[f.note&&f.hide_note!==!0?(r(),E(Nr,{key:0,note:f.note},null,8,["note"])):x("",!0)]),validationError:d(()=>[n(Wu,{form:e.form,"error-key":A(a)+_},null,8,["form","error-key"])]),_:2},1032,["modelValue","onUpdate:modelValue","name","form","statePath","field","field-key","value","nesting"])],2)):x("",!0),l.includes(f.type)?(r(),E(O2,{key:1,form:e.form,field:f,value:e.value,"full-state-path":A(a),statePath:i(f)?A(a):_+".","field-key":_},null,8,["form","field","value","full-state-path","statePath","field-key"])):x("",!0),typeof f.type<"u"&&!l.includes(f.type)&&!["custom","component","html","hidden"].includes(f.type)?(r(),h("div",{key:2,class:de(`setting-fields-inner ${f.wrapperClass??""}`)},[f.type!=="checkbox"&&!f.component&&f.label!==!1?(r(),E(pa,{key:0,class:"setting-label",title:s(f,_),content:f.tooltip,placement:f.tooltip_placement},{default:d(()=>[f.labelOptional?(r(),h("span",Ik,"("+m(f.labelOptional)+")",1)):x("",!0)]),_:2},1032,["title","content","placement"])):x("",!0),n($k,{form:e.form,field:f,value:e.value,"full-state-path":A(a),"state-path":e.statePath,"field-key":_},null,8,["form","field","value","full-state-path","state-path","field-key"]),f.note&&!f.component?(r(),E(Nr,{key:1,note:f.note},null,8,["note"])):x("",!0),f.component?x("",!0):(r(),E(Wu,{key:2,form:e.form,"error-key":A(a)+_},null,8,["form","error-key"]))],2)):x("",!0)],64))],64)):x("",!0)],64))),128))}},Qk={key:0,class:"vue-form-wrap"},Dk={key:0,class:"form-section-save-action"},Vk={key:0,class:"cmd block leading-none"},Si={__name:"VueForm",props:{form:{type:Object,required:!0},schema:{type:Object},value:{type:Object},showSubmitButton:{type:Boolean,default:!1},submitButtonText:{type:String,default:"Save"},loading:{type:Boolean,default:!1}},emits:["onSubmit","onChange","onSubmitButtonClick"],setup(e,{expose:t,emit:a}){const l=nl(),s=e,i=a;be(()=>s.form.isReady,()=>{xe(()=>nn.scrollToHashSection(l.hash))},{once:!0}),Ie(()=>{xe(()=>{c.registerCopyAction(),s.form.isReady&&nn.scrollToHashSection(l.hash)})}),T({});const c=Jt().ctx,p=()=>{i("onSubmitButtonClick")};return t({getState:()=>s.form.values}),(_,g)=>{const y=C("el-button");return e.form.isReady?(r(),h("div",Qk,[n(xi,{form:e.form,ref:"formRenderer",schema:e.form.schema,value:e.form.values},null,8,["form","schema","value"]),e.showSubmitButton?(r(),h("div",Dk,[n(y,{onClick:p,type:"primary",loading:e.loading},{default:d(()=>[e.loading?x("",!0):(r(),h("span",Vk,"⌘s")),R(" "+m(e.submitButtonText),1)]),_:1},8,["loading"])])):x("",!0)])):x("",!0)}}},Tk={key:0},Pp={__name:"DynamicFormLoader",props:["schema","values","submit_button_text","form_name","widget"],emits:["change"],setup(e,{expose:t,emit:a}){let l=bd();const s=a,i=e,c=()=>{const g=i.form_name,y={};return y[g]={...l.values},y},p=()=>{l.reset()},f=()=>{var g;return((g=i.widget)==null?void 0:g.reset_on_save)==!0},_=oi("triggerChange");return Ie(()=>{l.setSchema(i.schema).setDefaults(i.values).initForm(),l.onDataChanged(g=>{_==null||_(),s("change")})}),t({getState:c,resetForm:p,resetOnSave:f}),(g,y)=>A(l).isReady?(r(),h("div",Tk,[n(Si,{showSubmitButton:!1,submitButtonText:e.submit_button_text,form:A(l),onOnSubmitButtonClick:y[0]||(y[0]=()=>{A(l).values}),onOnChange:y[1]||(y[1]=v=>{}),"validation-errors":{}},null,8,["submitButtonText","form"])])):x("",!0)}},Mk={__name:"EChart",props:{option:{type:Object,required:!0},height:{type:String,default:"400px"},width:{type:String,default:"100%"}},setup(e){const t=e,a=T(null);let l=null;const s=()=>{a.value&&(l=na(a.value),l.setOption(t.option))};be(()=>t.option,f=>{l&&f&&l.setOption(f,!0)},{deep:!0});const i=(f,_)=>{if(f==null||f==="")return _;const g=Number(f);return isNaN(g)?f:`${g}px`},c=K(()=>i(t.height,"400px")),p=K(()=>i(t.width,"100%"));return Ie(()=>{s(),window.addEventListener("resize",()=>l==null?void 0:l.resize())}),cl(()=>{window.removeEventListener("resize",()=>l==null?void 0:l.resize()),l==null||l.dispose()}),(f,_)=>(r(),h("div",{ref_key:"chartRef",ref:a,style:ra({width:p.value,height:c.value})},null,4))}},Lk={class:"fct-step-indicator"},Rk={class:"indicator-title"},Ok={class:"indicator-steps"},Pk={class:"indicator-progress"},Hk={class:"indicator-steps-bar"},Nk=["onClick"],Kk={__name:"StepIndicator",props:{steps:{type:Array,required:!0},currentStep:{type:Number,default:1}},emits:["step-click"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),h("div",Lk,[o("div",Rk,m(e.steps[e.currentStep-1].label),1),o("div",Ok,[o("div",Pk,m(e.currentStep)+"/"+m(e.steps.length)+" "+m(l.$t("Completed")),1),o("div",Hk,[(r(!0),h(P,null,te(e.steps,(i,c)=>(r(),h("div",{key:c,class:"indicator-step",onClick:p=>a("step-click",c+1)},[o("div",{class:de(["indicator-step-bar",c<e.currentStep?"is-completed":""])},null,2)],8,Nk))),128))])])]))}},Gk=["type","disabled","aria-disabled"],zk={key:0,class:"fct-btn-spinner"},jk="6px",qk={__name:"LoadingButton",props:{loading:Boolean,disabled:Boolean,type:{type:String,default:""},size:{type:String,default:""},plain:Boolean,nativeType:{type:String,default:"button"},duration:{type:Number,default:300}},emits:["click"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>a.disabled||a.loading),i=()=>`width ${a.duration}ms ease, opacity ${a.duration}ms ease, margin-right ${a.duration}ms ease`,c=y=>{y.style.width="0",y.style.opacity="0",y.style.overflow="hidden",y.style.marginRight="6px"},p=(y,v)=>{const w=y.scrollWidth+"px";y.style.transition=i(),requestAnimationFrame(()=>{y.style.width=w,y.style.opacity="1",y.style.marginRight=""}),setTimeout(()=>v(),a.duration)},f=y=>{y.style.width="auto",y.style.overflow="",y.style.marginRight=""},_=y=>{y.style.width=y.scrollWidth+"px",y.style.opacity="1",y.style.overflow="hidden",y.style.marginRight=jk},g=(y,v)=>{y.offsetHeight,y.style.transition=i(),y.style.width="0",y.style.opacity="0",y.style.marginRight="0";const w=k=>{k.propertyName==="width"&&(y.removeEventListener("transitionend",w),v())};y.addEventListener("transitionend",w)};return(y,v)=>(r(),h("button",{type:e.nativeType,class:de(["el-button",e.type&&`el-button--${e.type}`,e.size&&`el-button--${e.size}`,{"is-plain":e.plain,"is-loading":e.loading,"is-disabled":s.value}]),disabled:s.value,"aria-disabled":s.value,onClick:v[0]||(v[0]=w=>l("click",w))},[n(Xl,{onBeforeEnter:c,onEnter:p,onAfterEnter:f,onBeforeLeave:_,onLeave:g},{default:d(()=>[e.loading?(r(),h("span",zk,v[1]||(v[1]=[o("i",{class:"el-icon is-loading"},[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[o("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"})])],-1)]))):x("",!0)]),_:1}),o("span",null,[ga(y.$slots,"default",{},void 0,!0)])],10,Gk))}},Yk=nt(qk,[["__scopeId","data-v-fa8794a2"]]),Hp={__name:"VueTemplateLoader",props:{widget:{type:Object,required:!0},data:{required:!1}},setup(e){var c,p;const t=Nc(Kc),a=Object.freeze({get:(...f)=>Ae.get(...f),post:(...f)=>Ae.post(...f),put:(...f)=>Ae.put(...f),delete:(...f)=>Ae.delete(...f),patch:(...f)=>Ae.patch(...f),upload:(...f)=>Ae.upload(...f),getNonce:()=>Ae.getNonce()}),l=Object.freeze({success:(...f)=>q.success(...f),error:(...f)=>q.error(...f),info:(...f)=>q.info(...f),validationErrors:(...f)=>q.validationErrors(...f)}),s={Vue:t,Rest:a,Notify:l,translate:u,Animation:ya,StepIndicator:Kk,LoadingButton:Yk,ElMessage:(c=window==null?void 0:window.ELEMENT)==null?void 0:c.ElMessage,ElMessageBox:(p=window==null?void 0:window.ELEMENT)==null?void 0:p.ElMessageBox},i=f=>typeof f=="string"?Em(f,s).component:vs(f);return(f,_)=>(r(),E(gl(i(e.widget.component)),va({ref:"componentRefs",data:e.data},{...e.widget}),null,16,["data"]))}},Wk=["innerHTML"],pn={__name:"DynamicTemplates",props:{widgetsQuery:{type:Object,default:{},required:!1},filter:{type:String,default:"",required:!1},data:{required:!1}},emits:["change"],setup(e,{expose:t,emit:a}){Jt().ctx;const l=a,s=e,i=T([]),c=Nc(Kc),p={},f=D=>{window.fluent_cart_admin.app={vue:c,components:D,xhr:Ae,notify:q},window.fluent_cart_admin.hooks.applyFilters(s.filter+"_components",[],c,D).forEach(({name:B,component:U})=>{p[B]=vs(U)})};Ds(()=>{let F=Jt().appContext.components;f(F);let B=window.fluent_cart_admin.hooks.applyFilters(s.filter,[],c,F);Array.isArray(B)&&(i.value=i.value.concat(B));const U={filter:s.filter,data:s.widgetsQuery};Ae.get("widgets",U).then(Q=>{Array.isArray(Q.widgets)&&(i.value=i.value.concat(Q.widgets))}),s.widgetsQuery});const _=D=>vs(D),g=D=>p[D]||null,y=T([]),v=async(D,F)=>{const B=y.value.map(U=>typeof U[D]=="function"?U[D](F):Promise.resolve());return await Promise.all(B),!0};t({beforeUpdatingData:async D=>await v("beforeUpdatingData",D),afterUpdatingData:async D=>await v("afterUpdatingData",D),getFormStates:()=>{let D=[];if(Array.isArray($.value))for(let F of $.value)D={...D,...F.getState()};return D},resetForms:()=>{if(Array.isArray($.value))for(let D of $.value)D.resetOnSave()&&D.resetForm()}});const $=T();return(D,F)=>(r(!0),h(P,null,te(i.value,B=>(r(),h(P,null,[B.type!=="vue-component"&&B.type!=="vue-template"||B.use_card==!0?(r(),E(Se,{key:0},{default:d(()=>[n(Ve,{title:B.title,subtitle:B.subtitle,border_bottom:""},null,8,["title","subtitle"]),n(ke,null,{default:d(()=>[B.type==="html"?(r(),h("div",{key:0,innerHTML:B.content},null,8,Wk)):B.type==="chart"?(r(),E(Mk,{key:1,option:B.data,height:`${B.height||400}`,width:`${B.width||"100%"}`},null,8,["option","height","width"])):B.type==="form"?(r(),E(Pp,{key:2,schema:B.schema,values:B.values,submit_button_text:B.submit_button_text,form_name:B.form_name,ref_for:!0,ref_key:"formRefs",ref:$,widget:B,onChange:F[0]||(F[0]=()=>l("change"))},null,8,["schema","values","submit_button_text","form_name","widget"])):typeof B.component=="object"?(r(),E(gl(_(B.component)),va({key:3,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...B,data:e.data}),null,16)):g(B.component)?(r(),E(gl(g(B.component)),va({key:4,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...B,data:e.data}),null,16)):(r(),h(P,{key:5},[R(m(B.content),1)],64))]),_:2},1024)]),_:2},1024)):B.type==="vue-component"?(r(),h(P,{key:1},[typeof B.component=="object"?(r(),E(gl(_(B.component)),va({key:0,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...B,data:e.data}),null,16)):g(B.component)?(r(),E(gl(g(B.component)),va({key:1,ref_for:!0,ref_key:"componentRefs",ref:y},{ref_for:!0},{...B,data:e.data}),null,16)):x("",!0)],64)):B.type==="vue-template"?(r(),E(Hp,{key:2,widget:B,data:e.data},null,8,["widget","data"])):x("",!0)],64))),256))}},ua=e=>e!=null&&!isNaN(Number(e))?new Intl.NumberFormat(void 0,{maximumFractionDigits:2}).format(Number(e)):e,Jk={class:"fct-dashboard-stat-widgets"},Xk={class:"right w-full"},Zk=["href"],eB={class:"fct-dashboard-stat-widget__icon"},tB={class:"fct-dashboard-stat-widget__content"},aB={class:"fct-dashboard-stat-widget__title"},lB={class:"fct-dashboard-stat-widget__value inner-value"},sB=["innerHTML"],nB={key:1,class:"fct-dashboard-stat-widget__inner"},oB={class:"fct-dashboard-stat-widget__content"},iB={class:"fct-dashboard-stat-widget__title"},rB=["href"],dB={key:1},uB={class:"fct-dashboard-stat-widget__value"},cB={__name:"StatsWidget",setup(e){const t=T(!0),a=T([]),l=()=>{t.value=!0,Ae.get("dashboard/stats").then(s=>{a.value=s.stats}).catch(s=>{q.error(s)}).finally(()=>{t.value=!1})};return Ie(()=>{l()}),(s,i)=>{const c=C("el-skeleton-item"),p=C("el-skeleton");return r(),h("div",Jk,[t.value?(r(),h(P,{key:0},te(4,f=>n(p,{key:f,animated:"",class:"bg-white dark:bg-dark-700 flex flex-col items-start py-5 px-4.5 rounded-[12px] gap-3"},{template:d(()=>[n(c,{variant:"circle",class:"w-10 h-10 flex-none"}),o("div",Xk,[n(c,{variant:"p",class:"w-full"}),n(c,{variant:"p",class:"w-10"})])]),_:2},1024)),64)):(r(),h(P,{key:1},[(r(!0),h(P,null,te(a.value,(f,_)=>(r(),h("div",{key:_,class:"fct-dashboard-stat-widget"},[f.url?(r(),h("a",{key:0,href:f.url,class:"fct-dashboard-stat-widget__inner no-underline"},[o("div",eB,[n(Y,{class:"w-5",name:f.icon},null,8,["name"])]),o("div",tB,[o("h3",aB,[o("span",null,m(f.title),1)]),o("span",lB,[f.has_currency?(r(),h("span",{key:0,innerHTML:A(ft).scaled(f.current_count)},null,8,sB)):(r(),h(P,{key:1},[R(m(A(sa)(A(ua)(f.current_count))||0),1)],64))])])],8,Zk)):(r(),h("div",nB,[i[0]||(i[0]=Dn('<div class="fct-dashboard-stat-widget__icon"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.20248 2.62165L5.7818 3.27834C3.59393 4.28965 2.5 4.7953 2.5 5.62533C2.5 6.45535 3.59393 6.961 5.7818 7.97231L7.20249 8.629C8.57936 9.26544 9.26781 9.58366 10 9.58366C10.7322 9.58366 11.4206 9.26544 12.7975 8.629L14.2182 7.97231C16.4061 6.961 17.5 6.45535 17.5 5.62533C17.5 4.7953 16.4061 4.28965 14.2182 3.27834L12.7975 2.62165C11.4206 1.98521 10.7322 1.66699 10 1.66699C9.26781 1.66699 8.57937 1.98521 7.20248 2.62165Z" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M17.3233 9.24805C17.4411 9.41368 17.5 9.5863 17.5 9.77614C17.5 10.5944 16.4061 11.0928 14.2182 12.0897L12.7975 12.7371C11.4206 13.3644 10.7322 13.6781 10 13.6781C9.26781 13.6781 8.57936 13.3644 7.20249 12.7371L5.7818 12.0897C3.59394 11.0928 2.5 10.5944 2.5 9.77614C2.5 9.5863 2.55889 9.41368 2.67667 9.24805" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.9806 13.5557C17.3269 13.8315 17.5 14.1064 17.5 14.4319C17.5 15.2501 16.4061 15.7486 14.2182 16.7455L12.7975 17.3928C11.4206 18.0202 10.7322 18.3339 10 18.3339C9.26781 18.3339 8.57936 18.0202 7.20249 17.3928L5.7818 16.7455C3.59394 15.7486 2.5 15.2501 2.5 14.4319C2.5 14.1064 2.67315 13.8315 3.01945 13.5557" stroke="#122368" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></div>',1)),o("div",oB,[o("h3",iB,[f.url?(r(),h("a",{key:0,class:"link",href:f.url},m(f.title),9,rB)):(r(),h("span",dB,m(f.title),1))]),o("span",uB,m(f.current_count),1)])]))]))),128)),n(pn,{data:{stats:a.value},filter:"dashboard_stats_widget"},null,8,["data"])],64))])}}},lc=200,AB=800,pB=.1,fB=.3,sc=.5,mB=.5,hB=12,_B=800,vB=1600,gB=150,yB=3500,bB=["#FFC700","#FF0000","#2E3191","#41BBC7"];var xd={props:{particleCount:{type:Number,default:gB},particleSize:{type:Number,default:hB},duration:{type:Number,default:yB},colors:{type:Array,default:bB},force:{type:Number,default:mB},stageHeight:{type:Number,default:_B},stageWidth:{type:Number,default:vB},shouldDestroyAfterDone:{type:Boolean,default:!0}},setup(e){const t=T(!0),a=(F,B)=>{D(F,{degree:B})},l=K(()=>i(e.particleCount,e.colors));jf(()=>{e.particleCount>300&&console.log("[VUE-CONFETTI-EXPLOSION] That's a lot of confetti, you sure about that? A lesser number like 200 will still give off the party vibes while still not bricking the device 😉")});const s=K(()=>$(e.particleCount,e.duration,e.colors,e.particleSize,e.force,e.stageHeight,e.stageWidth));Ie(async()=>{await c(e.duration),e.shouldDestroyAfterDone&&(t.value=!1)});const i=(F,B)=>{const U=360/F;return Array.from({length:F},(Q,V)=>({color:B[V%B.length],degree:V*U}))},c=F=>new Promise(B=>setTimeout(B,F));function p(F){let B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return Math.round((F+Number.EPSILON)*10**B)/10**B}function f(F,B){if(F===B)return!0;if(F==null||B==null||F.length!==B.length)return!1;for(let U=0;U<F.length;U++)if(F[U]!==B[U])return!1;return!0}const _=(F,B,U,Q,V)=>(F-B)*(V-Q)/(U-B)+Q,g=(F,B)=>{const U=F+B;return U>360?U-360:U},y=()=>Math.random()>.5,v=[0,0,1],w=[[1,1,0],[1,0,1],[0,1,1],[1,0,0],[0,1,0],v],k=F=>!f(w[F],v)&&y(),b=F=>typeof F>"u",S=F=>{console.error(F)};function $(F,B,U,Q,V,I,M){const O=Number.isSafeInteger;return!b(F)&&O(F)&&F<0?(S("particleCount must be a positive integer"),!1):!b(B)&&O(B)&&B<0?(S("duration must be a positive integer"),!1):!b(U)&&!Array.isArray(U)?(S("colors must be an array of strings"),!1):!b(Q)&&O(Q)&&Q<0?(S("particleSize must be a positive integer"),!1):!b(V)&&O(V)&&(V<0||V>1)?(S("force must be a positive integer and should be within 0 and 1"),!1):!b(I)&&typeof I=="number"&&O(I)&&I<0?(S("floorHeight must be a positive integer"),!1):!b(M)&&typeof M=="number"&&O(M)&&M<0?(S("floorWidth must be a positive integer"),!1):!0}function D(F,B){let{degree:U}=B;const Q=_(Math.abs(g(U,90)-180),0,180,-e.stageWidth/2,e.stageWidth/2),V=Math.random()*(AB-lc)+lc,I=Math.round(Math.random()*(w.length-1)),M=e.duration-Math.round(Math.random()*1e3),O=Math.random()<pB,L=k(I),H=O?p(Math.random()*fB,2):0,j=H*-1,W=H,G=p(Math.abs(_(Math.abs(g(U,90)-180),0,180,-1,1)),4),Z=p(Math.random()*sc,4),ne=p(Math.random()*e.force*(y()?1:-1),4),ce=sc,z=p(Math.max(_(Math.abs(U-180),0,180,e.force,-e.force),0),4),ue=(ie,J)=>F==null?void 0:F.style.setProperty(ie,J+"");ue("--x-landing-point",`${Q}px`),ue("--duration-chaos",`${M}ms`),ue("--x1",`${H}`),ue("--x2",`${j}`),ue("--x3",`${W}`),ue("--x4",`${G}`),ue("--y1",`${Z}`),ue("--y2",`${ne}`),ue("--y3",`${ce}`),ue("--y4",`${z}`),ue("--width",`${L?e.particleSize:Math.round(Math.random()*4)+e.particleSize/2}px`),ue("--height",(L?e.particleSize:Math.round(Math.random()*2)+e.particleSize)+"px"),ue("--rotation",`${w[I].join()}`),ue("--rotation-duration",`${V}ms`),ue("--border-radius",`${L?"50%":"0"}`)}return{isVisible:t,isValid:s,stageHeight:e.stageHeight,particles:l,setItemRef:a}}};function wB(e,t,a,l,s,i){return l.isVisible&&l.isValid?(r(),h("div",{key:0,class:"confetti-container",style:ra(`--floor-height: ${l.stageHeight}px;`)},[(r(!0),h(P,null,te(l.particles,c=>{let{color:p,degree:f}=c;return r(),h("div",{key:f,class:"particle",ref:_=>l.setItemRef(_,f)},[o("div",{style:ra(`--bgcolor: ${p};`)},null,4)],512)}),128))],4)):x("",!0)}function CB(e,t){t===void 0&&(t={});var a=t.insertAt;if(!(typeof document>"u")){var l=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a==="top"&&l.firstChild?l.insertBefore(s,l.firstChild):l.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var kB=` | |
| 108 | 107 | @keyframes y-axis-4ff796ae { |
| 109 | 108 | to { |
| 110 | 109 | transform: translate3d(0, var(--floor-height), 0); |
| 111 | 110 | } |
| @@ -147,148 +146,155 @@ | ||
| 147 | 146 | background-color: var(--bgcolor); |
| 148 | 147 | animation: rotation-4ff796ae var(--rotation-duration) infinite linear; |
| 149 | 148 | border-radius: var(--border-radius); |
| 150 | 149 | } |
| 151 | -`;MB(LB);md.render=TB;md.__scopeId="data-v-4ff796ae";var RB=(()=>{const e=md;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();at.extend(li);at.extend(Oc);let ua=class{static withTimezone(t){const a=at(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class OB extends sl{constructor(){super(...arguments);Oe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:ua.withTimezone(at().format("YYYY-MM-DD 23:59:59")),subscriptionType:""})}get dropdownOpen(){return this.data.showDropdown}toggleDropdown(){this.data.showDropdown=!this.data.showDropdown}setFilterOption(a){this.data.filterOptions=a}get filters(){return this.data.filterOptions}get filteredFilters(){var l;const a=(l=this.data.searchQuery)==null?void 0:l.toLowerCase().trim();return this.filters.filter(s=>a?s.label.toLowerCase().includes(a)||s.value.toLowerCase().includes(a):!0)}get visibleFilters(){return this.filteredFilters.filter(a=>this.shouldRenderOption(a))}selectActiveFilter(a){this.data.activeFilter=a}get activeFilterOptions(){return this.data.activeFilter||null}selectFilterOption(a){const l=this.activeFilterOptions;l&&(this.data.selectedFilters[l.value]={label:l.label,value:a.value,type:l.type,options:l.options},this.data[l.value]=a.value,this.triggerFilterChanged())}selectFilterOptionMulti(a){const l=this.activeFilterOptions;if(!l)return;this.data.selectedFilters[l.value]||(this.data.selectedFilters[l.value]={label:l.label,value:[],type:l.type,options:l.options});let s=this.data.selectedFilters[l.value].value;if(a.value==="all")this.data.selectedFilters[l.value].value=[{label:a.label,value:a.value}],this.data[l.value]=["all"];else{const i=s.findIndex(p=>p.value===a.value);i>-1?s.splice(i,1):s.push({label:a.label,value:a.value});const c=s.findIndex(p=>p.value==="all");c>-1&&s.splice(c,1),this.data[l.value]=s.map(p=>p.value)}this.triggerFilterChanged()}setDateRange(a){const l=at(a[0]),s=at(a[1]);this.data.selectedFilters.dateRange={label:u("Date"),value:[l,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[Wa.data.dateRange[0],Wa.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[ua.withTimezone(at(this.data.dateRange[0])),ua.withTimezone(at(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,l=null){const s=l||this.activeFilterOptions;s&&(this.data.selectedFilters[s.value]={label:s.label,value:a,type:s.type},this.triggerFilterChanged())}setTreeSelectItem(a){const l=a.filter(s=>!s.children||s.children.length===0).map(s=>({id:s.value,label:s.label}));this.handleTreeSelections(l),this.triggerFilterChanged()}removeTreeSelectItem(a){var i;const s=(((i=this.data.selectedFilters.variation_ids)==null?void 0:i.value)||[]).filter(c=>c.id!==a);this.handleTreeSelections(s),this.data.variation_ids=this.data.variation_ids.filter(c=>c!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:u("Products"),type:"tree-select"}),this.data.selectedFilters.variation_ids.value=a):delete this.data.selectedFilters.variation_ids}clearTreeSelect(){delete this.data.selectedFilters.variation_ids,this.data.variation_ids=[],Wa.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const l=this.activeFilterOptions;if(!l)return!1;const s=this.data.selectedFilters[l.value];return s?s.value===a.value:this.data[l.value]===a.value}isFilterOptionSelectedMulti(a){const l=this.activeFilterOptions,s=this.data.selectedFilters[l==null?void 0:l.value];return s?s.value.some(c=>c.value===a.value):!1}setMultiSelectChange(a,l){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const s=l.some(c=>c.value==="all"),i=this.data.selectedFilters[a].value||[];s?i.length===1&&i[0].value==="all"&&l.length>1?this.data.selectedFilters[a].value=l.filter(c=>c.value!=="all"):this.data.selectedFilters[a].value=[l.find(c=>c.value==="all")]:this.data.selectedFilters[a].value=l,this.triggerFilterChanged()}onFilterChanged(a){return this.data.onFilterChanged=a}setCompareTypeChange(a){this.data.compareType=a,this.data.selectedFilters.compareType={value:a},a!=="custom"&&this.triggerFilterChanged()}setCompareDateChange(a){this.data.compareDate=a,this.data.selectedFilters.compareDate={value:ua.withTimezone(at(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(Wa.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],s=al();return l.includes(s.name)?!1:a.value==="currency"?this.data.currencies&&this.data.currencies.length>1:!0}applyFilterChange(){this.triggerFilterChanged()}resetFilters(){this.data.selectedFilters={},this.data.currency="",this.data.variation_ids=[],this.data.dateRange=[ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Wa.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),Wa.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],Wa.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,l){const s=this.data.selectedFilters[a];if(!s)return;const i=s.value.filter(c=>c.id!==l);i.length?this.data.selectedFilters[a].value=i:delete this.data.selectedFilters[a],a==="variation_ids"&&(this.data.variation_ids=this.data.variation_ids.filter(c=>c!==l)),this.triggerFilterChanged()}triggerFilterChanged(){this.storeSelectedFilters(),typeof this.data.onFilterChanged=="function"&&this.data.onFilterChanged(this.data.selectedFilters)}get activeFilters(){return this.data.selectedFilters}applicableFilters(){return Object.fromEntries(["orderStatus","orderTypes","compareDate","currency","compareType","subscriptionType","variation_ids","paymentStatus","rangeKey"].map(l=>[l,this.data[l]]))}storeSelectedFilters(){const a="report-filter",l=Lt.get(a)||{},s=this.applicableFilters(),i={...l,...s};Lt.set(a,i),Lt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Lt.get(this.data.storageKey)}retrieveSavedReportFilters(){return Lt.get("report-filter")}}function pp(){return OB.init()}class HB extends sl{constructor(){super(...arguments);Oe(this,"filterState",null);Oe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:ua.withTimezone(at().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Oe(this,"storageKey","report-filter");Oe(this,"currencyStorageKey",`${this.storageKey}_currencies`);Oe(this,"listeners",{})}beforeInit(){this.filterState=pp(),this.mergeWithStorage();const a=Lt.get(this.storageKey),l=Lt.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Lt.get(this.storageKey),l=Lt.get(this.currencyStorageKey);this.data.paymentStatus=a.paymentStatus??this.data.paymentStatus,this.data.orderStatus=a.orderStatus??this.data.orderStatus,this.data.orderTypes=a.orderTypes??this.data.orderTypes,this.data.compareType=a.compareType?a.compareType:this.data.compareType,this.data.compareDate=a.compareDate??this.data.compareDate,this.data.subscriptionType=a.subscriptionType??this.data.subscriptionType,this.data.currency=a.currency?this.data.currency:ze.get("shop.currency"),this.data.dateRange=[a.startDate??this.data.dateRange[0],a.endDate??this.data.dateRange[1]],this.data.currencies=l??this.data.currencies,this.data.rangeKey=a.rangeKey,this.data.variation_ids=a.variation_ids?a.variation_ids:this.data.variation_ids,this.data.filterMode=a.filterMode??this.data.filterMode,this.data.storeMode=a.storeMode??this.data.storeMode}fetchReportMeta(){ce.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[l,s]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=l),this.data.currencySign=s,this.data.storeMode=a.storeMode,this.data.firstOrderDate=at(a.first_order_date||at().startOf("month")).format("YYYY-MM-DD 00:00:00"),this.syncStorage()}).catch(a=>{}).finally(()=>{this.data.loading=!1})}get currentCurrencySign(){return this.data.currencies&&this.data.currencies.hasOwnProperty(this.data.currency)?this.data.currencies[this.data.currency]:""}addListener(a,l){this.listeners[a]=l,this.data.active_tab=a}async onFilterChange(){this.syncStorage(),this.setDateDiff();for(let a in this.listeners)this.listeners[a](this.applicableFilters)}onModeChange(a){this.data.filterMode=a,this.syncStorage()}syncStorage(){Lt.set(this.storageKey,this.applicableFilters.params),Lt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=Lc.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,m]=a.value();l=this.data.rangeKey==="All Time"?ua.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):ua.withTimezone(at(p).format("YYYY-MM-DD 00:00:00")),s=ua.withTimezone(at(m).format("YYYY-MM-DD 23:59:59"))}else l=ua.withTimezone(at(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=ua.withTimezone(at(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const i={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:ze.get("app_config.isProActive")?l:ua.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:ze.get("app_config.isProActive")?s:ua.withTimezone(at().endOf("month").format("YYYY-MM-DD 23:59:59")),rangeKey:this.data.rangeKey,variation_ids:this.data.variation_ids,filterMode:this.data.filterMode,storeMode:this.data.storeMode,firstOrderDate:this.data.firstOrderDate,compareType:this.data.compareType,compareDate:this.data.compareDate,subscriptionType:this.data.subscriptionType};let c=this.data.orderTypes;return c.includes("all")||(i.orderTypes=c),{params:i}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,l]=this.data.dateRange;this.data.dateDiff=at(l).diff(at(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=ua.withTimezone(at().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"))),a==="subscriptionType"&&(this.data.subscriptionType=""),a==="orderTypes"&&(this.data.orderTypes=["all"]),(a==="orderStatus"||a==="paymentStatus")&&(this.data[a]=["all"]),a==="variation_ids"&&(this.data.variation_ids=[]),a==="dateRange"&&(this.data[a]=[ua.withTimezone(at().startOf("month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Lt.get(this.data.storageKey)}}const Wa=HB.init();class PB extends sl{constructor(){super(...arguments);Oe(this,"data",{summaryData:{net_revenue:0,order_count:0,subscription_renewal_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,average_order_net:0,average_order_items:0,average_customer_orders:0,average_customer_ltv:0},previousSummary:{},fluctuations:{net_revenue:0,order_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,subscrition_renewal:0},graphs:{netRevenueGraph:{},orderGraph:{},itemsSoldGraph:{},refundCountGraph:{},refundsGraph:{},newCustomerGraph:{},subscriptionRenewalGraph:{}},topSoldProducts:[],failedOrders:[],topSoldVariants:[],isBusy:{graphs:{netRevenueGraph:!1,orderGraph:!1,itemsSoldGraph:!1,refundCountGraph:!1,refundsGraph:!1,newCustomerGraph:!1,subscriptionRenewalGraph:!1},summaryData:!1,topSoldProductsAndFailedOrders:!1,topSoldVariants:!0,topSoldProducts:!0,fluctuations:!1,salesReport:!0}})}get controllerKey(){return"DefaultReportController"}makeRequest(a,l,s,i){if(i&&i.startsWith("graphs.")){const p=i.split(".")[1];this.data.isBusy.graphs[p]=!0}else this.data.isBusy[i]=!0;let c;return typeof l=="object"?c=ce.get("reports/"+a,l):c=ce.get("reports/"+a),this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):rt.set(this.data,s,rt.get(i,l))}).catch(i=>{}).finally(()=>{if(s&&s.startsWith("graphs.")){const i=s.split(".")[1];this.data.isBusy.graphs[i]=!1}else this.data.isBusy[s]=!1})}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}getTopSoldVariants(a={}){return this.makeRequest("fetch-top-sold-variants",a,"topSoldVariants","topSoldVariants")}getSalesReport(a={}){return this.data.isBusy.salesReport=!0,this.makeRequest("sales-report",a,"salesReport").then(()=>this.data.isBusy.salesReport=!1)}}const El=PB.init(),NB={key:0,class:"fct-report-sold-product-list has-scroll"},KB={class:"list-left-content"},GB={class:"list-image"},jB=["src"],zB=["src"],qB={class:"list-title"},YB=["title"],WB={class:"list-id"},XB={class:"list-right-content"},JB={class:"list-value"},ZB=["innerHTML"],hd={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=K(()=>t.data);return(l,s)=>{const i=B("el-skeleton"),c=B("router-link");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[n(Ln,{class:"top-sold-products","card-options":{heading:A(u)("Top Sold Products"),linkButtonText:A(u)("View All"),linkButtonUrl:"products"}},{default:d(()=>[e.loading?(r(),$(i,{key:0,animated:"",rows:7})):(r(),h(O,{key:1},[a.value.length>0?(r(),h("ul",NB,[(r(!0),h(O,null,ae(a.value,p=>(r(),h("li",{key:p.product_id},[n(c,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:d(()=>[o("div",KB,[o("div",GB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,jB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,zB))]),o("div",qB,[o("div",{class:"list-title-inner",title:p.product_name},f(p.product_name),9,YB),o("div",WB,"#"+f(A(Xt)(p.product_id)),1)])]),o("div",XB,[o("div",JB,f(A(Xt)(p.quantity_sold))+" "+f(A(u)(" Sold")),1),o("div",{class:"list-price",innerHTML:A(Je).scaled(p.total_amount)},null,8,ZB)])]),_:2},1032,["to"])]))),128))])):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},ek={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},tk=["innerHTML"],ak={class:"fluent_cart_dashboard_inner"},lk={class:"fluent_cart_dashboard_main"},sk={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},nk={class:"fluent_cart_dashboard_aside"},ok={class:"fct-congrats-dialog-content"},ik={class:"fct-congrats-dialog-content-inner"},rk={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},dk=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=V(!1),a=V([]),l=V(!1);Nr("dashboardTogglePageNotification",y=>{l.value=y});const i=()=>{const[y,v]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v,paymentStatus:"all"};Ka.getSalesGrowthChart({params:{...C,groupKey:"daily"}})},c=()=>{Ka.getRecentOrders({params:null})},p=()=>{const y={paymentStatus:"all"};Ka.getCountryHeatMap({params:{...y,groupKey:"daily"}})},m=()=>{const[y,v]=[at().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),at().format("YYYY-MM-DD 23:59:59")],C={startDate:y,endDate:v};Ka.getTopSoldProducts({params:{...C}})},_=()=>{Zs.getVueParams(),Lt.get("onboarding_congratulations","no")!=="yes"&&ze.get("total_products_count")==0&&(Lt.set("onboarding_congratulations","yes"),t.value=!0)},g=()=>ze.get("admin_url")+"settings/store-settings/pages_setup";return Qe(()=>{window.addEventListener("getSalesGrowth",i),a.value=ze.get("dummy_product_info"),i(),p(),c(),_(),m()}),(y,v)=>{const C=B("el-col"),b=B("el-row"),w=B("el-button"),x=B("el-dialog");return r(),h("div",ek,[l.value?(r(),$(Za,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("Set up your pages first to get started %s",'<a href="'+g()+'" target="_blank">'+A(u)("Set up your pages")+"</a>")},null,8,tk)]),_:1})):k("",!0),o("div",ak,[o("div",lk,[n(VC),n(Pt,{permission:"dashboard_stats/view"},{default:d(()=>[o("div",sk,[n(ee,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(A(u)("Last %s Days",A(Xt)(30))),1)]),n(kB)]),_:1}),n(Pt,{permission:"reports/view"},{default:d(()=>[n(Sw,{chartData:A(Ka).data.salesGrowthChart,loading:A(Ka).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(b,{gutter:24},{default:d(()=>[n(Pt,{permission:"reports/view"},{default:d(()=>[n(C,{lg:12},{default:d(()=>[n(Yw)]),_:1})]),_:1}),n(Pt,{permission:"reports/view"},{default:d(()=>[n(C,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[n(hd,{data:A(Ka).topSoldProducts,loading:A(Ka).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Pt,{permission:"reports/view"},{default:d(()=>[n(C,{class:"mt-6"},{default:d(()=>[n(Qw,{data:A(Ka).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",nk,[n(yC)])]),n(x,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":v[1]||(v[1]=F=>t.value=F),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[o("div",ok,[o("div",ik,[v[2]||(v[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,f(A(u)("Congratulations!")),1),o("p",null,f(A(u)("You successfully finished your onboarding & your store is ready.")),1),n(w,{type:"primary",onClick:v[0]||(v[0]=F=>t.value=!1)},{default:d(()=>[R(f(A(u)("Let's go")),1)]),_:1})])]),o("div",rk,[n(A(RB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),uk={name:"FilterFields",props:{conditionals:{type:Object,required:!0,default:{}},fields:{type:Object,required:!0,default:{}},editorShortcodes:{type:Array,default:()=>[]},disabled:{type:Boolean,required:!0,default:!1},labels:{default:()=>({status_label:"Enable conditional logic",notification_if_start:"Send this notification if",notification_if_end:"of the following match:"})}},data(){return{defaultRules:{field:null,operator:"=",value:null},comingSoon:!1}},computed:{items(){return this.conditionals.conditions}},mounted(){this.conditionals.conditions.length||this.conditionals.conditions.push({...this.defaultRules})},methods:{add(e){this.items.splice(e+1,0,{...this.defaultRules})},remove(e){this.items.splice(e,1)}}},ck={key:2},Ak=["onClick"],pk=["onClick"];function fk(e,t,a,l,s,i){const c=B("el-checkbox"),p=B("el-option"),m=B("el-select"),_=B("el-col"),g=B("el-option-group"),y=B("el-input"),v=B("el-row");return r(),h("div",null,[a.disabled?(r(),$(c,{key:1,disabled:"",onClick:t[1]||(t[1]=C=>s.comingSoon=!0)},{default:d(()=>[R(f(a.labels.status_label),1)]),_:1})):(r(),$(c,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=C=>a.conditionals.status=C)},{default:d(()=>[R(f(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",ck,[R(f(a.labels.notification_if_start)+" ",1),n(m,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=C=>a.conditionals.type=C)},{default:d(()=>[(r(),h(O,null,ae({all:"All",any:"Any"},(C,b)=>n(p,{key:b,value:b},{default:d(()=>[R(f(C),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+f(a.labels.notification_if_end)+" ",1),(r(!0),h(O,null,ae(i.items,(C,b)=>(r(),$(v,{key:b,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[n(_,{md:8},{default:d(()=>[n(m,{size:"default",modelValue:i.items[b].field,"onUpdate:modelValue":w=>i.items[b].field=w,style:{width:"100%"},onChange:w=>i.items[b].value=""},{default:d(()=>[(r(!0),h(O,null,ae(a.fields,(w,x)=>(r(),$(p,{key:x,label:w.admin_label,value:x},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),n(_,{md:5},{default:d(()=>[n(m,{size:"default",modelValue:i.items[b].operator,"onUpdate:modelValue":w=>i.items[b].operator=w},{default:d(()=>[n(g,{label:"General Operators"},{default:d(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[C.field]&&!Object.keys(a.fields[C.field].options).length?(r(),h(O,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):k("",!0)]),_:2},1024),n(g,{label:"Advanced Operators"},{default:d(()=>[n(p,{value:"length_equal",label:"Equal to Data Length"}),n(p,{value:"length_less_than",label:"Less than to Data length"}),n(p,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(_,{md:8},{default:d(()=>[i.items[b].operator=="length_equal"||i.items[b].operator=="length_less_than"||i.items[b].operator=="length_greater_than"?(r(),$(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(O,{key:1},[a.fields[C.field]&&Object.keys(a.fields[C.field].options).length?(r(),$(m,{key:0,size:"default",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w,style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(a.fields[C.field].options,(w,x)=>(r(),$(p,{key:x,label:w,value:x},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),$(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[b].value,"onUpdate:modelValue":w=>i.items[b].value=w},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),n(_,{md:3,class:"action-btns"},{default:d(()=>[o("i",{class:"el-icon-plus",onClick:w=>i.add(b)},null,8,Ak),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:w=>i.remove(b)},null,8,pk)):k("",!0)]),_:2},1024)]),_:2},1024))),128))])):k("",!0)])}const mk=lt(uk,[["render",fk]]),hk={name:"ErrorView",props:["field","errors"],computed:{Str(){return oa}}},_k={key:0,class:"fct-inline-error ff"};function vk(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",_k,f(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):k("",!0)}const Ro=lt(hk,[["render",vk]]),gk={name:"InputPopover",components:{Popover:Rc},props:{value:String,placeholder:{type:String,default:""},placement:{type:String,default:"bottom"},icon:{type:String,default:"el-icon-more"},fieldType:{type:String,default:"text"},data:Array,attrName:{type:String,default:"attribute_name"},defaultValue:{type:[String,Number,Boolean,Array],default:""}},data(){return{model:this.defaultValue}},watch:{model(){this.$emit("update:modelValue",this.model)}},methods:{insertShortcode(e){this.model==null&&(this.model=""),this.model+=e.replace(/param_name/,this.attrName)}}},yk={class:"flex-1"},bk={key:0,class:"input-textarea-value"};function wk(e,t,a,l,s,i){const c=B("el-input"),p=B("Popover");return r(),h("div",{class:de(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",yk,[a.fieldType=="textarea"?(r(),h("div",bk,[n(c,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=m=>s.model=m)},null,8,["placeholder","modelValue"])])):(r(),$(c,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=m=>s.model=m),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),n(p,{class:de(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const Ck=lt(gk,[["render",wk]]),Bk={name:"FieldGeneral",components:{inputPopover:Ck},props:{value:[String,Number,Boolean,Array],editorShortcodes:Array,field_type:{type:String,default:"text"},defaultValue:{type:[String,Number],default:""}},data(){return{fieldValue:this.defaultValue}},watch:{fieldValue(){this.$emit("update:modelValue",this.fieldValue)}},methods:{onValueUpdated(e){this.fieldValue=e,this.$emit("onValueUpdated",this.fieldValue)}}},kk={class:"fct-field-general"};function xk(e,t,a,l,s,i){const c=B("input-popover");return r(),h("div",kk,[n(c,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:s.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=p=>s.fieldValue=p),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(p){i.onValueUpdated(p)}),defaultValue:s.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const ql=lt(Bk,[["render",xk]]),Sk={key:0,class:"fct-merge-fields"},Fk={class:"fct-merge-fields-container"},$k={key:3},Ek={name:"FieldMaps",components:{ErrorView:Ro,FieldGeneral:ql},props:["settings","merge_fields","field","errors","merge_model","inputs","editorShortcodes"],data(){return{appReady:!1}},mounted(){(Array.isArray(this.merge_model)||!this.merge_model)&&this.$emit("setMergeModelObj"),this.appReady=!0},methods:{onValueUpdated(e,t){this.merge_model[t]=e}}},Uk=Object.assign(Ek,{setup(e){return(t,a)=>{const l=B("el-option"),s=B("el-select"),i=B("el-form-item");return t.appReady?(r(),h("div",Sk,[o("div",Fk,[(r(!0),h(O,null,ae(e.field.primary_fileds,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c.label,required:c.required},{default:d(()=>[c.input_options==="emails"?(r(),$(s,{key:0,modelValue:e.settings[c.key],"onUpdate:modelValue":m=>e.settings[c.key]=m,placeholder:t.$t("Select a Field"),clearable:"",class:de(e.errors.errors[c.key]?"is-error":"")},{default:d(()=>[(r(!0),h(O,null,ae(e.inputs,(m,_)=>(r(),h(O,{key:_},[(m==null?void 0:m.attributes.type)==="email"?(r(),$(l,{key:0,value:m==null?void 0:m.attributes.code,label:m==null?void 0:m.attributes.name},null,8,["value","label"])):k("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):c.input_options==="all"?(r(),$(s,{key:1,modelValue:e.settings[c.key],"onUpdate:modelValue":m=>e.settings[c.key]=m,placeholder:t.$t("Select a Field"),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(e.inputs,(m,_)=>(r(),$(l,{key:_,value:m.attributes.name,label:m.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),$(ql,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[c.key],modelValue:e.settings[c.key],"onUpdate:modelValue":m=>e.settings[c.key]=m},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),c.help_text?(r(),h("div",$k,f(c.help_text),1)):k("",!0),n(Ro,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(O,{key:0},ae(e.field.default_fields,c=>(r(),h("div",{class:"fct-merge-fields-item",key:c.name},[n(i,{label:c.label,required:c.required},{default:d(()=>[n(ql,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[c.name],"onUpdate:modelValue":p=>e.settings.default_fields[c.name]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),n(Ro,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):k("",!0),(r(!0),h(O,null,ae(e.merge_fields,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c},{default:d(()=>[n(ql,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(m){t.onValueUpdated(m,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):k("",!0)}}}),Ik={name:"ListSelectFilter",props:["settings","field"],computed:{listItems(){let e=this.settings[this.field.filter_by];this.field.parsedType=="number"&&(e=parseInt(e));let t=[];return $n(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},Qk={class:"fluent_cart_list_select_filter"};function Dk(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select");return r(),h("div",Qk,[n(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=m=>a.settings[a.field.key]=m),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(O,null,ae(i.listItems,m=>(r(),$(c,{key:m.label,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const Vk=lt(Ik,[["render",Dk]]),Tk={name:"DropdownLabelRepeater",components:{FieldGeneral:ql},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{loading:!1}},methods:{addItemAfter(e){this.loading=!0,this.settings[this.field.key].splice(e+1,0,{item_value:"",label:""}),this.$nextTick(()=>{this.loading=!1})},removeItem(e){this.loading=!0,this.settings[this.field.key].splice(e,1),this.$nextTick(()=>{this.loading=!1})}}},Mk={class:"dropdown_label_repeater"},Lk={key:0,class:"fluent_cart-table"};function Rk(e,t,a,l,s,i){const c=B("el-input"),p=B("FieldGeneral"),m=B("el-button"),_=B("el-button-group");return r(),h("div",Mk,[s.loading?k("",!0):(r(),h("table",Lk,[o("thead",null,[o("tr",null,[o("th",null,f(a.field.field_label||"Field Label"),1),o("th",null,f(a.field.value_label||"Field Value"),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(O,null,ae(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[o("td",null,[n(c,{placeholder:a.field.field_label||"Field Label",modelValue:g.label,"onUpdate:modelValue":v=>g.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),o("td",null,[n(p,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),o("td",null,[n(_,null,{default:d(()=>[n(m,{type:"success",onClick:v=>i.addItemAfter(y)},{default:d(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),n(m,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(y)},{default:d(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const Ok=lt(Tk,[["render",Rk]]),Hk={name:"DropdownManyFields",components:{FieldGeneral:ql,DynamicIcon:ee,IconButton:Xe},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{test:"null",rendered_labels:{remote_text:this.field.remote_text||"Field Label",local_text:this.field.local_text||"Field Value"}}},mounted(){(!this.settings[this.field.key]||!this.settings[this.field.key].length)&&(this.settings[this.field.key]=[{item_value:this.field,label:""}])},methods:{addNewItem(){this.settings[this.field.key].push({item_value:"",label:""})},removeItem(e){this.settings[this.field.key].length!==1&&this.settings[this.field.key].splice(e,1)}}},Pk={class:"dropdown_label_repeater w-full"},Nk={class:"fluent_cart-table w-full text-left"},Kk={class:"action-btns"},Gk={class:"dropdown_label_repeater_footer"};function jk(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=B("FieldGeneral"),_=B("DynamicIcon"),g=B("IconButton"),y=B("el-button");return r(),h("div",Pk,[o("table",Nk,[t[1]||(t[1]=o("colgroup",null,[o("col",{width:"25%"}),o("col",{width:"70%"}),o("col",{width:"10%"})],-1)),o("thead",null,[o("tr",null,[o("th",null,f(s.rendered_labels.remote_text),1),o("th",null,f(s.rendered_labels.local_text),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(O,null,ae(a.settings[a.field.key],(v,C)=>(r(),h("tr",{key:"item_"+C},[o("td",null,[n(p,{modelValue:v.label,"onUpdate:modelValue":b=>v.label=b},{default:d(()=>[(r(!0),h(O,null,ae(a.field.options,(b,w)=>(r(),$(c,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[n(m,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":b=>v.item_value=b},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",Kk,[n(g,{size:"x-small",tag:"button",onClick:Ne(b=>i.removeItem(C),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",Gk,[n(y,{text:"",onClick:Ne(i.addNewItem,["prevent"])},{default:d(()=>[n(_,{name:"Plus"}),R(" "+f(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const zk=lt(Hk,[["render",jk]]),qk={name:"ChainedFields",props:["settings","field","value"],data(){return{loading:!1,app_ready:!1,categories:[],subcategories:[],chained_settings:{category:"",sub_category:""},selected_subcategory:""}},computed:{listItems(){}},watch:{"settings.list_id"(){this.field.require_list&&this.fetchSettings()}},mounted(){this.settings[this.field.key]?this.chained_settings=this.settings[this.field.key]:this.settings[this.field.key]=this.chained_settings,this.app_ready=!0,this.fetchSettings()},methods:{fetchSettings(){this.loading=!0,this.$post("integration/feed/chained",{route:this.field.remote_url,settings:this.settings}).then(e=>{this.loading=!1,this.categories=e.data.categories,this.subcategories=e.data.subcategories,e.data.reset_values&&(this.chained_settings={category:"",sub_category:""})}).catch(e=>{})},handleCategoryChange(){this.$set(this.settings,this.field.key.category,this.selected_category),this.fetchSettings()}}},Yk={class:"fluent_cart_chained_filter"};function Wk(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=Va("loading");return jt((r(),h("div",Yk,[n(p,{onChange:t[0]||(t[0]=_=>i.handleCategoryChange()),clearable:"",modelValue:s.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=_=>s.chained_settings.category=_),placeholder:a.field.category_label},{default:d(()=>[(r(!0),h(O,null,ae(s.categories,_=>(r(),$(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),jt(n(p,{modelValue:s.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=_=>s.chained_settings.sub_category=_),clearable:"",placeholder:a.field.subcategory_label},{default:d(()=>[(r(!0),h(O,null,ae(s.subcategories,_=>(r(),$(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Vl,s.chained_settings.category]])])),[[m,s.loading]])}const Xk=lt(qk,[["render",Wk]]),Jk={name:"ChainedSelects",props:["settings","field","value"],data(){return{app_ready:!1,loading:!1}},mounted(){this.fetchSettings(),this.app_ready=!0},methods:{fetchSettings(){this.loading=!0,this.$get(this.field.remote_url,{settings:this.settings}).then(e=>{this.loading=!1;let t=e.data;$n(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),$n(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},Zk={class:"fluent_cart_chained_filter"};function e8(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=B("el-col"),_=B("el-row"),g=Va("loading");return jt((r(),h("div",Zk,[n(_,{gutter:0},{default:d(()=>[(r(!0),h(O,null,ae(a.field.fields_options,(y,v)=>(r(),$(m,{span:12,key:v,class:"fluent_carteach_filter"},{default:d(()=>[o("label",null,f(a.field.options_labels[v].label),1),n(p,{onChange:C=>i.handleSlectChange(v),filterable:"",clearable:"",placeholder:a.field.options_labels[v].placeholder,multiple:a.field.options_labels[v].type=="multi-select",modelValue:a.value[v],"onUpdate:modelValue":C=>a.value[v]=C},{default:d(()=>[(r(!0),h(O,null,ae(y,(C,b)=>(r(),$(c,{key:b,value:b,label:C},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const t8=lt(Jk,[["render",e8]]),a8={name:"RoutingFilterFields",components:{DynamicIcon:ee,IconButton:Xe,FieldGeneral:ql},props:{routings:{type:Array,required:!0,default(){return[]}},fields:{type:Object,required:!0,default(){return{}}},disabled:{type:Boolean,required:!1,default:!1},labels:{default:()=>({input_label:"Send To",input_placeholder:"Email Address"})},input_type:{type:String,default:"text"},input_options:{type:Object,required:!1,default(){return{}}},editorShortcodes:{type:Object}},data(){return{defaultRules:{input_value:"",field:"",operator:"=",value:null},comingSoon:!1}},mounted(){(!this.routings||!this.routings.length)&&this.routings.push({...this.defaultRules})},methods:{add(e){this.routings.splice(e+1,0,{...this.defaultRules})},remove(e){this.routings.splice(e,1)}}},l8={class:"fluent_cart_routing_fields"},s8={key:0,class:"fluent_cart_routing_table"},n8={class:"fluent_cart_inline"},o8={class:"action-btns"};function i8(e,t,a,l,s,i){const c=B("el-input"),p=B("el-option"),m=B("el-select"),_=B("FieldGeneral"),g=B("DynamicIcon"),y=B("IconButton");return r(),h("div",l8,[a.disabled?k("",!0):(r(),h("table",s8,[o("tbody",null,[(r(!0),h(O,null,ae(a.routings,(v,C)=>(r(),h("tr",{key:C},[o("td",null,[o("label",n8,f(a.labels.input_label),1),a.input_type=="text"?(r(),$(c,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),$(m,{key:1,modelValue:v.input_value,"onUpdate:modelValue":b=>v.input_value=b,placeholder:a.labels.input_placeholder},{default:d(()=>[(r(!0),h(O,null,ae(a.input_options,(b,w)=>(r(),$(p,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):k("",!0)]),t[0]||(t[0]=o("td",null,"If",-1)),o("td",null,[n(_,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":b=>v.field=b,defaultValue:v.field,onChange:b=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[n(m,{modelValue:v.operator,"onUpdate:modelValue":b=>v.operator=b,class:"w-[100px]"},{default:d(()=>[n(p,{value:"=",label:"equal"}),n(p,{value:"!=",label:"not equal"}),n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(r(),h(O,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):k("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),$(m,{key:0,modelValue:v.value,"onUpdate:modelValue":b=>v.value=b,style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(a.fields[v.field].options,(b,w)=>(r(),$(p,{key:w,label:b,value:w},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),$(c,{key:1,placeholder:"Enter a value",modelValue:v.value,"onUpdate:modelValue":b=>v.value=b},null,8,["modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",o8,[n(y,{size:"x-small",tag:"button",onClick:Ne(b=>i.add(C),["prevent"])},{default:d(()=>[n(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),$(y,{key:0,size:"x-small",tag:"button",onClick:Ne(b=>i.remove(C),["prevent"])},{default:d(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):k("",!0)])])]))),128))])]))])}const r8=lt(a8,[["render",i8]]),d8={name:"SelectionRouting",components:{RoutingFilterFields:r8,FiledGeneral:ql},props:["field","settings","inputs","editorShortcodes"]},u8={class:"fluent_cart_field_routing"},c8={class:"mb-4"},A8={key:3};function p8(e,t,a,l,s,i){const c=B("el-checkbox"),p=B("el-option"),m=B("el-select"),_=B("el-input"),g=B("FiledGeneral"),y=B("RoutingFilterFields");return r(),h("div",u8,[o("div",c8,[n(c,{modelValue:a.settings[a.field.routing_key],"onUpdate:modelValue":t[0]||(t[0]=v=>a.settings[a.field.routing_key]=v),"true-value":"routing","false-value":"simple"},{default:d(()=>[R(f(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),$(m,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(O,null,ae(a.field.options,(v,C)=>(r(),$(p,{key:C,value:C,label:v},null,8,["value","label"]))),128))]),_:1},8,["disabled","multiple","modelValue","placeholder"])):a.field.simple_component=="text"?(r(),$(_,{key:1,disabled:a.settings[a.field.routing_key]!="simple",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[2]||(t[2]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},null,8,["disabled","modelValue","placeholder"])):a.field.simple_component=="value_text"&&a.settings[a.field.routing_key]=="simple"?(r(),$(g,{key:2,editorShortcodes:a.editorShortcodes,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[3]||(t[3]=v=>a.settings[a.field.key]=v)},null,8,["editorShortcodes","modelValue"])):k("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",A8,f(a.field.inline_tip),1)):k("",!0)]),a.settings[a.field.routing_key]=="routing"?(r(),$(y,{key:0,routings:a.settings[a.field.settings_key],input_type:a.field.routing_input_type,fields:a.inputs,labels:a.field.labels,input_options:a.field.options,editorShortcodes:a.editorShortcodes},null,8,["routings","input_type","fields","labels","input_options","editorShortcodes"])):k("",!0)])}const f8=lt(d8,[["render",p8]]),m8={name:"CustomComponentRender",props:{field:{type:Object,required:!0},settings:{type:Object,required:!0}},data(){return{message:"This is a custom component render"}},render(){if(this.field&&this.field.render_template){const e=`<div>${this.field.render_template}</div>`,t=ff(e).bind(this);return mf(t,{settings:this.settings,app:this})}return null}},h8={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return rl},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},_8={class:"fct-feed-header mb-5"},v8={class:"mb-5 flex items-center justify-between"},g8={class:"capitalize"};function y8(e,t,a,l,s,i){const c=B("el-breadcrumb-item"),p=B("el-breadcrumb"),m=B("el-switch");return r(),h("div",_8,[o("div",v8,[n(p,{"separator-icon":i.ArrowRight},{default:d(()=>[n(c,{to:i.prevRoute},{default:d(()=>[R(f(e.$t("Integrations")),1)]),_:1},8,["to"]),n(c,null,{default:d(()=>[o("span",g8,f(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),n(m,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=_=>a.settings.enabled=_),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const b8=lt(h8,[["render",y8]]);class w8{constructor(){this.errors={}}get(t){if(this.errors[t])return this.errors[t]}first(t){if(this.errors[t]){let a=Object.keys(this.errors[t]);return a.length?this.errors[t][a[0]]:""}}has(t){return!!this.errors[t]}record(t){this.errors=t}clear(t){t?this.errors[t]=null:this.errors={}}}const C8={name:"RestSelector",props:["field","modelValue"],emits:["update:modelValue"],data(){return{model:this.modelValue,loading:!1,options:[]}},watch:{model(e){this.$emit("update:modelValue",e)}},mounted(){this.fetchOptions("")},methods:{fetchOptions(e){let t=this.field.option_key;this.field.extended_key&&(t+="_"+this.field.extended_key);let a="";if(this.field.cacheable){if(a+="_fcrm_ajax_cache_"+t,window[a]){this.options=window[a];return}}else if(this.field.experimental_cache&&(a+="_fcrm_ajax_cache_"+t+"_"+e+" "+JSON.stringify(this.model),this.field.sub_option_key&&(a+="_"+JSON.stringify(this.field.sub_option_key)),window[a])){this.options=window[a];return}if(this.doing_ajax)return!1;this.loading=!0;const l={search:e,values:this.model,option_key:t};this.field.sub_option_key&&(l.sub_option_key=this.field.sub_option_key),this.$get("integration/feed/dynamic_options",l).then(s=>{this.options=s.options,a&&s.options&&(window[a]=s.options)}).catch(s=>{this.handleError(s)}).finally(()=>{this.loading=!1})}}};function B8(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=Va("loading");return jt((r(),$(p,{modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=_=>s.model=_),multiple:a.field.is_multiple,filterable:"",remote:!a.field.cacheable,clearable:a.field.clearable,disabled:a.field.disabled,"reserve-keyword":"","allow-create":a.field.creatable,size:a.field.size,placeholder:a.field.placeholder||e.$t("Please enter a keyword"),"remote-method":i.fetchOptions},{default:d(()=>[(r(!0),h(O,null,ae(s.options,_=>(r(),$(c,{key:_.id,label:_.title,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[m,s.loading]])}const k8=lt(C8,[["render",B8]]),x8={name:"FeedEditor",components:{FilterFields:mk,MergeFieldMapper:Uk,FiledGeneral:ql,ListSelectFilter:Vk,DropDownLabelRepeater:Ok,DropDownManyFields:zk,ChainedFields:Xk,ChainedSelects:t8,SelectionRouting:f8,CardContainer:xe,CardBody:ke,CardHeader:Ve,LabelHint:ca,FeedHeader:b8,ErrorView:Ro,CustomComponentRender:m8,RestSelector:k8},data(){return{loading_app:!1,loading_list:!1,errors:new w8,integration_id:parseInt(this.$route.params.integration_id),integration_name:this.$route.params.integration_name,saving:!1,merge_fields:{},settings:{},settings_fields:{},attachedForms:[],inputs:[],editorShortcodes:[],scope:"",product_variations:[]}},computed:{getTitle(){let e=this.settings_fields.integration_title||"";return this.integration_id?`Update ${e} Integration Feed`:`Add New ${e} Integration Feed`},maybeShowSaveButton(){let e=this.settings_fields,t=this.merge_fields;return e.button_require_list&&t||!e.button_require_list}},mounted(){this.loadIntegrationSettings()},methods:{translate:u,loadIntegrationSettings(){if(this.$route.name==="product_integration_feed_editor"){this.loading_app=!0;const e=this.$route.params.product_id;this.$get(`products/${e}/integrations/${this.integration_name}/settings`,{integration_id:this.integration_id}).then(t=>{this.loading_app=!1,this.settings_fields=t.settings_fields,this.scope=t.scope,this.product_variations=t.product_variations,this.settings=t.settings,this.editorShortcodes=Object.values(t.shortcodes||{}),this.inputs=t.inputs,this.settings.name||(this.settings.name=t.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=t.merge_fields}).catch(t=>{var a;this.loading_app=!1,t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)})}else this.loading_app=!0,this.$get("integration/global-feeds/settings",{integration_id:this.integration_id,integration_name:this.integration_name}).then(e=>{this.loading_app=!1,this.settings_fields=e.settings_fields,this.settings=e.settings,this.editorShortcodes=Object.values(e.shortcodes),this.inputs=e.inputs,this.settings.name||(this.settings.name=e.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=e.merge_fields}).catch(e=>{var t,a;this.loading_app=!1,this.handleError(((a=(t=e.responseJSON)==null?void 0:t.data)==null?void 0:a.message)||"Failed to load integration settings")})},loadMergeFields(){this.loading_list=!0,this.fieldsLoaded=!1,this.$get("integration/feed/lists",{integration_id:this.integration_id,list_id:this.settings.list_id,integration_name:this.integration_name}).then(e=>{this.loading_list=!1,this.merge_fields=e.merge_fields,this.fieldsLoaded=!0}).catch(e=>{})},saveNotification(){if(this.errors.clear(),this.$route.name==="product_integration_feed_editor"){this.saving=!0;const e=this.$route.params.product_id;let t={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post(`products/${e}/integrations`,t).then(a=>{a.feedData&&(this.settings=a.feedData),a.created&&this.$router.push({name:"product_integrations",params:{product_id:e}}),this.handleSuccess(a.message||"Integration saved successfully"),this.errors.clear()}).catch(a=>{var l;this.errors.record(((l=a==null?void 0:a.data)==null?void 0:l.errors)||{}),this.handleError(a)}).finally(()=>{this.saving=!1})}else{this.saving=!0;let e={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post("integration/global-feeds/settings",e).then(t=>{t.created&&this.$router.push({name:"integrations"}),this.handleSuccess(t.message)}).catch(t=>{var a;this.errors.record(((a=t==null?void 0:t.data)==null?void 0:a.errors)||{}),this.handleError(t)}).finally(()=>{this.saving=!1})}},setMergeModel(e){this.settings[e.key]={}}}},S8={class:"fct-integration-container fct-layout-width"},F8={class:"fct-add-integration py-7.5"},$8={class:"grid gap-5"},E8={key:0,class:"fct-setting-form-content"},U8=["innerHTML"],I8={class:"fct-setting-form-fields"},Q8=["innerHTML"],D8=["innerHTML"],V8=["innerHTML"],T8={key:0,class:"fct-setting-form-row"},M8={class:"fct-setting-form-content"},L8={class:"fct-setting-form-content"},R8={class:"fct-setting-form-fields"},O8={class:"fct-inline-tip pl-6"},H8={key:0,class:"setting-save-action"};function P8(e,t,a,l,s,i){const c=B("el-skeleton-item"),p=B("el-skeleton"),m=B("FeedHeader"),_=B("LabelHint"),g=B("el-input"),y=B("ErrorView"),v=B("el-option"),C=B("el-select"),b=B("MergeFieldMapper"),w=B("el-checkbox"),x=B("el-checkbox-group"),F=B("el-option-group"),L=B("FilterFields"),U=B("FiledGeneral"),S=B("ListSelectFilter"),M=B("DropDownLabelRepeater"),I=B("DropDownManyFields"),T=B("el-radio"),Q=B("el-radio-group"),E=B("el-input-number"),D=B("ChainedFields"),H=B("ChainedSelects"),P=B("SelectionRouting"),G=B("RestSelector"),J=B("CardBody"),oe=B("CardContainer"),Z=B("el-button"),W=B("el-form"),pe=Va("loading");return r(),h("div",S8,[o("div",F8,[n(p,{loading:s.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:d(()=>[n(c,{variant:"h3",class:"w-[150px] mb-5"}),o("div",$8,[o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})]),o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})])])]),_:1},8,["loading"]),s.loading_app?k("",!0):(r(),$(W,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(m,{settings:s.settings,integration_name:s.integration_name},null,8,["settings","integration_name"]),n(oe,null,{default:d(()=>[n(J,null,{default:d(()=>[(r(!0),h(O,null,ae(s.settings_fields.fields,(N,j)=>(r(),h("div",{key:j,class:de(["fct-setting-form-row",N.key])},[N.label?(r(),h("div",E8,[N.tips?(r(),$(_,{key:0,title:N.label,content:N.tips,placement:"top-start",required:N.required},null,8,["title","content","required"])):(r(),$(_,{key:1,title:N.label,required:N.required},null,8,["title","required"])),N.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:N.inline_tip},null,8,U8)):k("",!0)])):k("",!0),o("div",I8,[N.component==="text"?(r(),h(O,{key:0},[n(g,{placeholder:N.placeholder,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,class:de(s.errors.errors[N.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="list_ajax_options"?(r(),h(O,{key:1},[jt((r(),$(C,{onChange:t[0]||(t[0]=q=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=q=>s.settings.list_id=q),placeholder:N.placeholder,clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(q,X)=>(r(),$(v,{key:X,value:X,label:q},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[pe,s.loading_list]]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="map_fields"?(r(),$(b,{key:2,onSetMergeModelObj:q=>i.setMergeModel(N),errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[N.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):N.component==="select"?(r(),h(O,{key:3},[n(C,{filterable:"",clearable:"",multiple:N.is_multiple,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,placeholder:N.placeholder},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(q,X)=>(r(),$(v,{key:X,value:X,label:q},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="checkbox-single"?(r(),h(O,{key:4},[n(w,{modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},{default:d(()=>[R(f(N.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:N.inline_tip},null,8,Q8)):k("",!0)],64)):N.component==="yes-no-checkbox"?(r(),h(O,{key:5},[n(w,{"true-value":"yes","false-value":"no",modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},{default:d(()=>[R(f(N.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:N.inline_tip},null,8,D8)):k("",!0)],64)):N.component==="checkbox-multiple"?(r(),$(x,{key:6,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(q,X)=>(r(),$(w,{key:X,label:Number(X)},{default:d(()=>[R(f(q),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.component==="selection_group"?(r(),h(O,{key:7},[n(C,{modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,placeholder:N.placeholder,multiple:"",class:de(s.errors.errors[N.key]?"is-error":"")},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(q,X)=>(r(),$(F,{key:X,label:q.label},{default:d(()=>[(r(!0),h(O,null,ae(q.options,ie=>(r(),$(v,{key:ie.value,label:ie.label,value:ie.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),n(y,{field:N.key,errors:s.errors},null,8,["field","errors"])],64)):N.component==="conditional_block"?(r(),$(L,{key:8,fields:s.inputs,conditionals:s.settings[N.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):N.component==="value_text"?(r(),$(U,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[N.key],modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):N.component==="value_textarea"?(r(),$(U,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[N.key],modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):N.component==="list_select_filter"?(r(),$(S,{key:11,settings:s.settings,field:N},null,8,["settings","field"])):N.component==="dropdown_label_repeater"?(r(),$(M,{key:12,errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):N.component==="dropdown_many_fields"?(r(),$(I,{key:13,errors:s.errors,inputs:s.inputs,field:N,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):N.component==="radio_choice"?(r(),$(Q,{key:14,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(q,X)=>(r(),$(T,{key:X,label:X},{default:d(()=>[R(f(q),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.component==="number"?(r(),$(E,{key:15,size:"default",modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},null,8,["modelValue","onUpdate:modelValue"])):N.component==="chained_fields"?(r(),$(D,{key:16,settings:s.settings,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,field:N},null,8,["settings","modelValue","onUpdate:modelValue","field"])):N.component==="chained_select"?(r(),$(H,{key:17,settings:s.settings,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q,field:N},null,8,["settings","modelValue","onUpdate:modelValue","field"])):N.component==="html_info"?(r(),h("div",{key:18,innerHTML:N.html_info},null,8,V8)):N.component==="selection_routing"?(r(),$(P,{key:19,inputs:s.inputs,field:N,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):N.component==="rest_selector"?(r(),$(G,{key:20,field:N,modelValue:s.settings[N.key],"onUpdate:modelValue":q=>s.settings[N.key]=q},null,8,["field","modelValue","onUpdate:modelValue"])):N.component==="custom_component"?(r(),$(Cl("custom-component-render"),{key:21,field:N,settings:s.settings},null,8,["field","settings"])):k("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",T8,[o("div",M8,[o("div",L8,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",R8,[n(C,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=N=>s.settings.conditional_variation_ids=N),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(O,null,ae(s.product_variations,N=>(r(),$(v,{key:N.id,value:N.id,label:N.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",O8,f(e.$t("Leave empty to run this feed for all variations")),1)])])):k("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",H8,[n(Z,{type:"primary",loading:s.saving,onClick:i.saveNotification},{default:d(()=>[R(f(s.integration_id?`Update ${s.settings_fields.integration_title} Feed`:`Create ${s.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):k("",!0)]),_:1}))])])}const Nu=lt(x8,[["render",P8]]),N8={class:"setting-wrap"},K8={key:0,class:"integration-actions"},G8={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},j8={class:"text-base"},z8={key:1,class:"fct-integrations-table-wrap"},q8={class:"fct-integration-logo-wrap"},Y8=["src","alt"],W8={class:"text-xs text-gray-700"},X8=["onClick"],J8={class:"fct-event-triggers"},Z8={class:"fct-event-triggers"},e4={class:"fct-btn-group sm"},t4={key:2,class:"fct-integration-table-footer"},a4={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},l4={name:"GloablIntegration",props:["editorShortcodes"],data(){return{loading:!0,feeds:[],available_integrations:{},all_module_config_url:""}},computed:{hasActiveIntegrations(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.getFeeds()},methods:{getFeeds(){this.loading=!0,this.$get("integration/global-feeds").then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.loading=!1}).finally(()=>{this.loading=!1})},handleActive(e){let t={status:e.enabled};this.$post(`integration/global-feeds/change-status/${e.id}`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{var l;this.handleError((l=a==null?void 0:a.data)==null?void 0:l.message)})},removeFeed(e,t){let a=t.$index;this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`integration/global-feeds/${e}`).then(l=>{this.handleSuccess(l.message),this.feeds.splice(a,1)}).catch(l=>{var s;this.handleError(((s=l==null?void 0:l.data)==null?void 0:s.message)||"Failed to delete integration.")})}).catch(()=>{})},add(e){let t=this.available_integrations[e];t&&t.enabled?this.$router.push({name:"feed_editor",params:{integration_id:0,integration_name:e}}):this.$notify.error({message:this.$t("This integration is not enabled. Please enable it from the integration modules.")})},edit(e){this.$router.push({name:"feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},isEmpty:Zr}},s4=Object.assign(l4,{setup(e){return(t,a)=>{const l=B("el-button"),s=B("el-dropdown-item"),i=B("el-dropdown-menu"),c=B("el-dropdown"),p=B("el-skeleton"),m=B("el-switch"),_=B("el-table-column"),g=B("el-tag"),y=B("el-popover"),v=B("el-tooltip"),C=B("el-table"),b=Va("loading");return r(),h("div",N8,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:d(()=>[t.hasActiveIntegrations?(r(),h("div",K8,[n(c,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(i,null,{default:d(()=>[(r(!0),h(O,null,ae(t.available_integrations,(w,x)=>(r(),$(s,{key:x,command:x},{default:d(()=>[R(f(w.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(l,{type:"info",plain:"",size:"small"},{default:d(()=>[R(f(t.$t("Add Integration"))+" ",1),n(ee,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):k("",!0)]),_:1},8,["title","text"]),n(ke,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(p,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?k("",!0):(r(),h(O,{key:0},[t.hasActiveIntegrations?(r(),h("div",z8,[jt((r(),$(C,{data:t.feeds},{empty:d(()=>[n(_t,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:d(()=>[n(_,{label:t.$t("Enabled"),width:60},{default:d(w=>[n(m,{"active-value":"yes","inactive-value":"no",onChange:x=>t.handleActive(w.row),modelValue:w.row.enabled,"onUpdate:modelValue":x=>w.row.enabled=x},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(_,{width:120,label:t.$t("Integration")},{default:d(w=>{var x,F;return[o("div",q8,[(x=t.available_integrations[w.row.provider])!=null&&x.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:t.available_integrations[w.row.provider].logo,alt:w.row.provider},null,8,Y8)):k("",!0),o("span",W8,f(((F=t.available_integrations[w.row.provider])==null?void 0:F.title)||w.row.provider),1)])]}),_:1},8,["label"]),n(_,{width:220,label:t.$t("Title")},{default:d(w=>[o("a",{class:"fct-action-link-btn",onClick:Ne(x=>t.edit(w.row),["prevent"]),href:"#"},f(w.row.name),9,X8)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:d(w=>[o("div",J8,[(r(!0),h(O,null,ae((w.row.feed.event_trigger||[]).slice(0,2),(x,F)=>(r(),$(g,{key:x},{default:d(()=>[n(ee,{name:"Trigger"}),R(" "+f(A(oa).headline(x)),1)]),_:2},1024))),128)),(w.row.feed.event_trigger||[]).length>2?(r(),$(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(g,{type:"info"},{default:d(()=>[R(" +"+f((w.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",Z8,[(r(!0),h(O,null,ae((w.row.feed.event_trigger||[]).slice(2),(x,F)=>(r(),$(g,{key:x+F},{default:d(()=>[n(ee,{name:"Trigger"}),R(" "+f(A(oa).headline(x)),1)]),_:2},1024))),128))])]),_:2},1024)):k("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:d(w=>[o("div",e4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button",onClick:x=>t.edit(w.row),size:"x-small",hover:"primary"},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button",size:"x-small",onClick:x=>t.removeFeed(w.row.id,w),hover:"danger"},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[b,t.loading]])])):(r(),h("div",G8,[o("p",j8,f(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(l,{tag:"a",type:"primary",href:t.all_module_config_url},{default:d(()=>[R(f(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?k("",!0):(r(),h("div",t4,[o("a",a4,f(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),n4={name:"Integrations",components:{Badge:Aa,FluidTabItem:Co,FluidTab:Gr,CardBody:ke,CardContainer:xe,CardHeader:Ve,PageHeading:ll,IconButton:Xe,DynamicIcon:ee,Empty:_t,GlobalIntegrationFeeds:s4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:ze.get("admin_url"),upgradeUrl:ze.get("app_config.upgrade_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};$n(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};$n(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return Zr(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:u,changeModuleType(e){this.module_type=e},installAddon(e,t){this.installing=!0,this.installingAdding=t,this.$post("integration/feed/install-plugin",{addon:t}).then(a=>{this.$notify.success(a.message),window.location.reload()}).catch(a=>{this.handleError(a)}).finally(()=>{this.installing=!1,this.installingAdding=""})}}},o4={class:"fct-integration-container fct-layout-width"},i4={style:{"margin-top":"100px"},class:"fct-integration-content"},r4={class:"fct-integration-content-head"},d4={class:"fct-card-header-title mb-1"},u4={class:"card-header-text mt-0"},c4={class:"flex items-center gap-3 justify-between py-5 mt-5 border border-solid border-gray-divider border-x-0 dark:border-dark-500 flex-col md:flex-row"},A4={class:"fct-integration-search"},p4={key:1},f4={class:"fct-integration-card-content"},m4={class:"fct-integration-card-content-inner"},h4={class:"fct-integration-card-logo"},_4=["src","alt"],v4={class:"title"},g4={class:"desc"},y4={key:0,class:"mt-2"},b4={key:1,class:"mt-2"};function w4(e,t,a,l,s,i){const c=B("PageHeading"),p=B("GlobalIntegrationFeeds"),m=B("DynamicIcon"),_=B("IconButton"),g=B("FluidTabItem"),y=B("FluidTab"),v=B("el-input"),C=B("el-skeleton"),b=B("Badge"),w=B("el-button"),x=B("Empty"),F=B("CardBody"),L=B("CardContainer");return r(),h("div",o4,[n(c,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",i4,[n(L,null,{default:d(()=>[n(F,null,{default:d(()=>[o("div",r4,[n(_,{circle:"",size:"large"},{default:d(()=>[n(m,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",d4,f(e.$t("Integration Modules")),1),o("p",u4,f(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",c4,[n(y,null,{default:d(()=>[(r(!0),h(O,null,ae(s.modules,(U,S)=>(r(),$(g,{key:S,class:de(["uppercase",U===s.module_type?"active":""]),onClick:M=>i.changeModuleType(U)},{default:d(()=>[R(f(U),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",A4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=U=>s.search=U)},{prefix:d(()=>[n(m,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),$(C,{key:0,loading:!0,animated:"",rows:4})):k("",!0),s.fetching?k("",!0):(r(),h("div",p4,[(r(!0),h(O,null,ae(i.filteredAddons,(U,S)=>(r(),h("div",{key:S,class:de(["fct-integration-card","addon-enabled-"+U.enabled])},[o("div",f4,[o("div",m4,[o("div",h4,[U.logo?(r(),h("img",{key:0,src:U.logo,alt:U.title},null,8,_4)):k("",!0)]),o("div",null,[o("h5",v4,[R(f(U.title)+" ",1),U.is_pro&&!U.enabled?(r(),$(b,{key:0,status:"warning",text:"Pro"})):(r(),$(b,{key:1,status:U.enabled?"active":"info",text:U.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",g4,f(U.description),1),U.is_pro&&!U.is_pro_active?(r(),h("div",y4,[n(w,{type:"warning",size:"small",tag:"a",href:s.upgradeUrl,target:"_blank"},{default:d(()=>[n(m,{name:"Crown",class:"mr-1"}),R(" "+f(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!U.enabled&&U.installable?(r(),h("div",b4,[n(w,{loading:s.installingAdding==S,disabled:s.installingAdding==S,onClick:M=>i.installAddon(U,S),type:"primary",size:"small"},{default:d(()=>[R(f(i.translate("Install %s",U.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):k("",!0)])])])],2))),128))])),i.is_no_modules&&!s.fetching?(r(),$(x,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):k("",!0)]),_:1})]),_:1})])])}const C4=lt(n4,[["render",w4]]),B4={class:"fct-connect-details"},k4={key:0,class:"fct-connect-require"},x4=["src"],S4={key:1,class:"fct-connect-success"},F4={class:"inline-flex items-center gap-3"},$4={key:0,class:"display-name"},E4={class:"display-role"},U4={name:"ConnectAccount",props:["connect","connectConfig","mode","method","methodName","methodLabel","brandColor"],data(){return{saving:!1}},methods:{disconnect(){this.saving=!0,this.$post("settings/payment-methods/disconnect",{method:this.method,mode:this.mode}).then(e=>{this.saving=!1,this.$emit("reload_settings",!0)})}}},Ku=Object.assign(U4,{setup(e){return(t,a)=>{var c;const l=B("el-button"),s=B("el-tag"),i=B("el-popconfirm");return r(),h("div",B4,[!e.connect||e.connect.error?(r(),h("div",k4,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,x4),o("h4",null,f(A(u)("Connect your %1$s %2$s account",e.mode,e.methodName)),1),n(l,{tag:"a",href:e.connectConfig[e.mode+"_redirect"],style:na({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:d(()=>[R(f(A(u)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),h("div",S4,[o("div",F4,[o("div",null,[e.connect.display_name?(r(),h("p",$4,f(e.connect.display_name),1)):k("",!0),o("h4",E4,f(t.$t("Administrator"))+" ("+f(t.$t("Owner"))+") ",1)]),n(s,{size:"small",type:"success"},{default:d(()=>[R(f(A(u)("Connected")),1)]),_:1})]),n(i,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((c=e.connectConfig)==null?void 0:c.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:d(()=>[n(l,{type:"danger",plain:""},{default:d(()=>[R(f(A(u)("Disconnect")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])]))])}}}),I4={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=B("el-tab-pane"),s=B("el-tabs");return r(),$(s,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=i=>e.settings[e.index]=i)},{default:d(()=>[(r(!0),h(O,null,ae(e.tabs.schema,(i,c)=>(r(),$(l,{label:i.label,name:i.value,key:c},{default:d(()=>[o("div",null,[n(_d,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},Q4={class:"setting-label"},D4=["innerHTML"],V4={key:0},T4={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=B("el-icon"),s=B("el-tooltip"),i=B("el-radio"),c=B("el-radio-group");return r(),h(O,null,[o("p",Q4,[R(f(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),$(s,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:e.fields[e.index].tooltip},null,8,D4)]),default:d(()=>[n(l,null,{default:d(()=>[n(A(nl))]),_:1})]),_:1})):k("",!0)]),n(c,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=p=>e.settings[e.index]=p)},{default:d(()=>[(r(!0),h(O,null,ae(e.fields[e.index].options,(p,m)=>(r(),$(i,{label:p,value:m,key:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=o("br",null,null,-1)),a[2]||(a[2]=o("br",null,null,-1)),(r(!0),h(O,null,ae(e.fields[e.index].dependants,(p,m)=>(r(),h("div",{key:m},[e.settings[e.index]===p.value?(r(),h("div",V4,[n(_d,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):k("",!0)]))),128))],64)}}},M4={name:"PayPalWebhookSetup",components:{Notify:z},props:["mode","webhook_info","testConnect","liveConnect"],data(){return{isLoading:!1,setupStatus:null,checkingWebhook:!1}},computed:{isConnected(){return this.mode==="test"&&this.testConnect||this.mode==="live"&&this.liveConnect}},watch:{testConnect(){this.checkWebhookStatus()},liveConnect(){this.checkWebhookStatus()}},mounted(){this.checkWebhookStatus()},methods:{checkWebhookStatus(){this.isConnected&&(this.checkingWebhook=!0,this.$get("settings/payment-methods/paypal/webhook/check",{mode:this.mode}).then(e=>{this.checkingWebhook=!1}).catch(e=>{this.checkingWebhook=!1}))},setupWebhook(){this.isLoading=!0,this.$post("settings/payment-methods/paypal/webhook/setup",{mode:this.mode}).then(e=>{this.isLoading=!1,this.setupStatus="success",z.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",z.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},L4={key:0,class:"fluent_cart_paypal_webhook_setup"},R4={class:"fluent_cart_paypal_webhook_setup_title"},O4=["innerHTML"],H4={key:1};function P4(e,t,a,l,s,i){const c=B("el-button"),p=Va("loading");return i.isConnected?(r(),h("div",L4,[o("p",R4,"PayPal "+f(a.mode)+" webhook setup",1),a.webhook_info?jt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,O4)),[[p,s.checkingWebhook]]):(r(),h("div",H4,[t[1]||(t[1]=o("p",{class:"fluent_cart_paypal_webhook_setup_description"}," Configure PayPal webhooks to receive real-time payment notifications ",-1)),t[2]||(t[2]=o("br",null,null,-1)),n(c,{type:e.text,loading:s.isLoading,onClick:i.setupWebhook,disabled:s.isLoading,class:"setup-button",size:"small"},{default:d(()=>t[0]||(t[0]=[o("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):k("",!0)}const N4=lt(M4,[["render",P4],["__scopeId","data-v-f187f73f"]]),K4={key:0,class:"fct-col"},G4=["innerHTML"],j4={key:1,class:"fct-col"},z4={class:"font-bold p-6 mt-6 text-center bg-gray-200"},q4={key:2,class:"fct-col"},Y4={class:"text-red-700"},W4={key:1},X4={key:0},J4={class:"flex items-center justify-between"},Z4={key:1,class:"flex items-center justify-between"},ex={class:"text-red-700"},tx={key:3,class:"fct-col"},ax={class:"setting-label"},lx=["innerHTML"],sx={key:0,class:"fct-settings-description"},nx={key:4,class:"fct-col"},ox=["innerHTML"],ix={key:0,class:"fct-settings-description"},rx={key:5,class:"fct-col"},dx={class:"setting-label"},ux=["innerHTML"],cx={key:0,class:"fct-settings-description"},Ax={key:6,class:"fct-col"},px={class:"setting-label flex items-center gap-1"},fx=["innerHTML"],mx={class:"options-img"},hx=["src"],_x={class:"options-name"},vx={class:"options-text"},gx={key:0,class:"fct-settings-description"},yx={key:7,class:"fct-col"},bx={key:0},wx=["innerHTML"],Cx={key:8,class:"fct-col"},Bx={class:"setting-label"},kx={key:0,class:"fct-settings-description"},xx={key:9,class:"fct-col"},Sx={class:"setting-label"},Fx={key:0,class:"fct-settings-description"},$x={key:10,class:"fct-col"},Ex={class:"setting-label"},Ux={key:0,class:"fct-settings-description"},Ix={key:11,class:"fct-col"},Qx={class:"setting-label"},Dx=["innerHTML"],Vx={key:0,class:"fct-settings-description"},Tx={key:12,class:"fct-col"},Mx={class:"setting-label"},Lx=["innerHTML"],Rx={key:0,class:"fct-settings-description"},Ox={key:13,class:"fct-col"},Hx={class:"setting-label"},Px=["innerHTML"],Nx={key:0,class:"fct-settings-description"},Kx={key:14,class:"fct-col"},Gx={class:"setting-label"},jx={key:0,class:"fct-settings-description"},zx={key:15,class:"fct-col"},qx=["innerHTML"],Yx={key:1},Wx={key:0,class:"setting-label"},Xx={key:1,class:"copyable-content"},Jx={key:2},Zx={key:0,class:"setting-label"},e3={class:"fct-payment-steps-list"},t3={class:"fct-payment-steps-number"},a3=["innerHTML"],l3={key:4,class:"fct-events-wrap"},s3={class:"setting-label"},n3={class:"flex items-center gap-2 flex-wrap"},o3={class:"copyable-content"},i3={key:5,class:"fct-webhook-notice"},r3={class:"fct-webhook-notice-title"},d3={class:"fct-webhook-notice-desc"},u3={key:0},c3={key:16,class:"fct-col"},A3={key:0},p3={key:0},f3={class:"setting-label"},m3={class:"flex flex-wrap gap-2"},h3=["href"],_3={key:1},v3={class:"setting-label"},g3={class:"flex flex-wrap gap-2"},y3=["href"],b3={key:17,class:"fct-col"},w3={key:18,class:"fct-col"},_d={__name:"Renderer",props:{fields:Object,settings:Object,routeName:String,methodName:String,methodTitle:String,methodLabel:String,brandColor:{type:String,default:"#253241"}},emits:["onSettingsChange"],setup(e,{emit:t}){const a=zt().ctx,l=V({}),s=V(null),i=V(null),c=V(!1),p=V({}),m=ze.get("shop.order_mode"),_=e,g=t,y=K(()=>{var U,S,M;return((U=_.settings)==null?void 0:U.payment_mode)==="test"?(S=_.settings)==null?void 0:S.define_test_keys:(M=_.settings)==null?void 0:M.define_live_keys});K(()=>{var U,S;return(U=_.fields)!=null&&U.payment_mode&&((S=_.settings)==null?void 0:S.payment_mode)!==m&&g("onSettingsChange",{..._.settings,payment_mode:m}),!0});const v=K(()=>{var U;return((U=_.settings)==null?void 0:U.payment_mode)==="test"?"test":"live"}),C=()=>{c.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then(U=>{U&&(c.value=!1,l.value=U.connect_config,g("onSettingsChange",U.settings),s.value=U.live_account,i.value=U.test_account,s.value.error&&(p.value=s.value),i.value.error&&(p.value=i.value),c.value=!1)}).catch(U=>{c.value=!1,p.value=U}).finally(()=>{c.value=!1})},b=U=>{const S=U.target;if(S.classList.contains("fct-install-addon-btn")||S.closest(".fct-install-addon-btn")){U.preventDefault(),U.stopPropagation();const M=S.classList.contains("fct-install-addon-btn")?S:S.closest(".fct-install-addon-btn"),I=M.getAttribute("data-addon-slug"),T=M.getAttribute("data-addon-file"),Q=M.getAttribute("data-source-type"),E=M.getAttribute("data-source-link"),D=M.getAttribute("data-repo-link");I&&T&&D&&x({slug:I,source_type:Q||"github",source_link:E||"",repo_link:D||""});return}if(S.classList.contains("fct-activate-addon-btn")||S.closest(".fct-activate-addon-btn")){U.preventDefault(),U.stopPropagation();const I=(S.classList.contains("fct-activate-addon-btn")?S:S.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");I&&F({file:I})}},w=ze.get("app_config.isProActive"),x=U=>{if(!w){window.open(U.repo_link,"_blank","noopener,noreferrer");return}const S=document.querySelector(`[data-addon-slug="${U.slug}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:U.slug,source_type:U.source_type,source_link:U.source_link}).then(M=>{z.success({message:M.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(M=>{z.error({message:(M==null?void 0:M.message)||u("Failed to install addon")}),S&&(S.disabled=!1,S.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10H18L12 16L6 10H11V3H13V10M4 19H20V12H22V20C22 20.5304 21.7893 21.0391 21.4142 21.4142C21.0391 21.7893 20.5304 22 20 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V12H4V19Z"/></svg>'+u("Install Addon"))})},F=U=>{const S=document.querySelector(`[data-addon-file="${U.file}"]`);S&&(S.disabled=!0,S.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:U.file}).then(M=>{z.success({message:M.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(M=>{z.error({message:(M==null?void 0:M.message)||u("Failed to activate addon")}),S&&(S.disabled=!1,S.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>'+u("Activate Addon"))})},L=U=>U?Array.isArray(U)?U:U[v.value]??[]:[];return Qe(()=>{C(),document.addEventListener("click",b)}),Ct(()=>{document.removeEventListener("click",b)}),(U,S)=>{const M=B("el-skeleton-item"),I=B("el-skeleton"),T=B("el-icon"),Q=B("el-tooltip"),E=B("el-switch"),D=B("el-checkbox"),H=B("el-option"),P=B("el-select"),G=B("el-radio"),J=B("el-radio-group"),oe=B("el-input"),Z=B("el-input-number"),W=B("el-checkbox-group"),pe=B("el-tag");return r(),h("div",{class:de([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(O,null,ae(e.fields,(N,j)=>{var q,X,ie,ge,fe,he;return r(),h("div",{class:"fct-setting-row fct-row",key:j},[N.type==="notice"?(r(),h("div",K4,[o("p",{innerHTML:N.value},null,8,G4)])):k("",!0),N.type==="upcoming"?(r(),h("div",j4,[o("h1",z4,f(A(u)("Upcoming")),1)])):k("",!0),N.type==="provider"?(r(),h("div",q4,[N.value=="connect"?(r(),h(O,{key:0},[e.settings.payment_mode=="test"?(r(),h(O,{key:0},[n(I,{loading:c.value,animated:""},{template:d(()=>[n(M,{variant:"h3",class:"w-[150px] mb-3"}),n(M,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),c.value?k("",!0):(r(),$(Ku,{key:0,onReload_settings:S[0]||(S[0]=le=>C()),method:e.routeName,methodName:e.methodName,methodLabel:e.methodLabel,connectConfig:l.value,mode:"test",connect:i.value,brandColor:e.brandColor},null,8,["method","methodName","methodLabel","connectConfig","connect","brandColor"]))],64)):e.settings.payment_mode=="live"?(r(),h(O,{key:1},[c.value?k("",!0):(r(),$(Ku,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:S[1]||(S[1]=le=>C()),connectConfig:l.value,mode:"live",methodLabel:e.methodLabel,connect:s.value,brandColor:e.brandColor},null,8,["method","methodName","connectConfig","methodLabel","connect","brandColor"]))],64)):k("",!0),o("p",Y4,f((q=p.value)==null?void 0:q.error),1)],64)):(r(),h("div",W4,[y.value?(r(),h("div",X4,[o("div",null,[n(qC,{title:A(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[o("div",J4,[o("div",null,[o("b",null,f(A(u)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",Z4,[o("div",null,[o("b",null,f(A(u)("Payment API settings is not enabled by API keys / Connect")),1),S[3]||(S[3]=o("br",null,null,-1)),o("p",null,f(A(u)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",ex,f((X=p.value)==null?void 0:X.error),1)])]))]))])):k("",!0),N.type==="enable"?(r(),h("div",tx,[o("p",ax,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,lx)]),default:d(()=>[n(T,null,{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(E,{modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,"active-value":"yes","inactive-value":"no","active-text":A(u)("Active"),"inactive-text":A(u)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),N.description?(r(),h("p",sx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="checkbox"?(r(),h("div",nx,[n(D,{"true-value":"yes","false-value":"no",modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,disabled:N.disabled},{default:d(()=>[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,ox)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),N.description?(r(),h("p",ix,f(N.description),1)):k("",!0)])):k("",!0),N.type==="select"?(r(),h("div",rx,[o("p",dx,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,ux)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(P,{placeholder:N.placeholder,modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,filterable:N.filterable!==!1},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(le,me)=>(r(),$(H,{label:le.label,value:le.value,key:me},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),N.description?(r(),h("p",cx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="radio"?(r(),h("div",Ax,[o("p",px,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,fx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(J,{modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,class:de({"fct-payment-setting-radio-box":typeof Object.values(N.options)[0]=="object"})},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(le,me)=>(r(),h(O,{key:me},[typeof le=="object"?(r(),$(G,{key:0,value:me},{default:d(()=>[o("div",mx,[o("img",{src:le.icon,alt:""},null,8,hx)]),o("div",null,[o("span",_x,f(le.label),1),o("span",vx,f(le.text),1)])]),_:2},1032,["value"])):(r(),$(G,{key:1,value:me},{default:d(()=>[R(f(le),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),N.description?(r(),h("p",gx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="webhook_info"&&((ie=e.settings)==null?void 0:ie.payment_mode)===N.mode?(r(),h("div",yx,[e.routeName==="paypal"&&!y.value?(r(),h("div",bx,[n(N4,{testConnect:i.value,liveConnect:s.value,webhook_info:N.info,onReload_settings:S[2]||(S[2]=le=>C()),mode:N==null?void 0:N.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):N.info?(r(),h("div",{key:1,innerHTML:N.info},null,8,wx)):k("",!0)])):k("",!0),N.type==="input"||N.type==="password"?(r(),h("div",Cx,[o("p",Bx,f(N.label),1),n(oe,{type:N.type,placeholder:N.placeholder,modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,maxlength:N.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),N.description?(r(),h("p",kx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="email"?(r(),h("div",xx,[o("p",Sx,f(N.label),1),n(oe,{type:"email",placeholder:N.placeholder,modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le},null,8,["placeholder","modelValue","onUpdate:modelValue"]),N.description?(r(),h("p",Fx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="number"?(r(),h("div",$x,[o("p",Ex,f(N.label),1),n(Z,{placeholder:N.placeholder,modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,max:N.max,min:N.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),N.description?(r(),h("p",Ux,f(N.description),1)):k("",!0)])):k("",!0),N.type==="text"?(r(),h("div",Ix,[o("p",Qx,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Dx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(oe,{type:"text",placeholder:N.placeholder,modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,disabled:N.disabled,maxlength:N.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),N.description?(r(),h("p",Vx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="color"?(r(),h("div",Tx,[o("p",Mx,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Lx)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(pd,{modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,field:N},null,8,["modelValue","onUpdate:modelValue","field"]),N.description?(r(),h("p",Rx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="file"?(r(),h("div",Ox,[o("p",Hx,[R(f(N.label)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:N.tooltip},null,8,Px)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(hi,{modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le,icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),N.description?(r(),h("p",Nx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="checkbox_group"?(r(),h("div",Kx,[o("p",Gx,[R(f(N.title)+" ",1),N.tooltip?(r(),$(Q,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",null,f(N.tooltip),1)]),default:d(()=>[n(T,{class:"text-gray-500"},{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),n(W,{modelValue:e.settings[j],"onUpdate:modelValue":le=>e.settings[j]=le},{default:d(()=>[(r(!0),h(O,null,ae(N.options,(le,me)=>(r(),$(D,{label:me,key:me},{default:d(()=>[R(f(le),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),N.description?(r(),h("p",jx,f(N.description),1)):k("",!0)])):k("",!0),N.type==="html_attr"?(r(),h("div",zx,[typeof N.value=="string"?(r(),h("div",{key:0,innerHTML:N.value},null,8,qx)):typeof N.value=="object"&&N.value!==null?(r(),h("div",Yx,[N.value.title?(r(),h("p",Wx,f(N.value.title),1)):k("",!0),N.value.webhook_url?(r(),h("code",Xx,f(N.value.webhook_url),1)):k("",!0),N.value.description?(r(),h("p",Jx,f(N.value.description),1)):k("",!0),N.value.steps?(r(),h(O,{key:3},[N.value.steps.title?(r(),h("p",Zx,f(N.value.steps.title),1)):k("",!0),o("ul",e3,[(r(!0),h(O,null,ae(L(N.value.steps.list),(le,me)=>(r(),h("li",{key:me},[o("span",t3,f(me+1),1),o("span",{innerHTML:le},null,8,a3)]))),128))])],64)):k("",!0),N.value.events?(r(),h("div",l3,[o("p",s3,f(N.value.events.title),1),o("ul",n3,[(r(!0),h(O,null,ae(L(N.value.events.list),(le,me)=>(r(),h("li",{key:me},[o("code",o3,f(le),1)]))),128))])])):k("",!0),N.value.webhook_notice?(r(),h("div",i3,[o("h4",r3,f(N.value.webhook_notice.title),1),o("div",d3,f(N.value.webhook_notice.description),1),N.value.webhook_notice.list&&N.value.webhook_notice.list.length?(r(),h("ul",u3,[(r(!0),h(O,null,ae(N.value.webhook_notice.list,(le,me)=>(r(),h("li",{key:me},f(le),1))),128))])):k("",!0)])):k("",!0)])):k("",!0)])):k("",!0),N.type==="active_methods"?(r(),h("div",c3,[(ge=N.value)!=null&&ge.activated_methods?(r(),h("div",A3,[e.settings.payment_mode==="live"&&j==="live_active_methods"?(r(),h("div",p3,[o("p",f3,f(N.label),1),R(" "+f(U.active_methods)+" ",1),o("ul",m3,[(r(!0),h(O,null,ae(N.value.activated_methods,(le,me)=>(r(),$(pe,{key:me},{default:d(()=>[R(f(le!=null&&le.name?le.name:le),1)]),_:2},1024))),128))]),o("p",null,[R(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(fe=N.value)==null?void 0:fe.configure_url,target:"_blank"},f(A(u)("here")),9,h3)])])):k("",!0),e.settings.payment_mode==="test"&&j==="test_active_methods"?(r(),h("div",_3,[o("p",v3,f(N.label),1),o("ul",g3,[R(f(U.active_methods)+" ",1),(r(!0),h(O,null,ae(N.value.activated_methods,(le,me)=>(r(),$(pe,{key:me},{default:d(()=>[R(f(le!=null&&le.name?le.name:le),1)]),_:2},1024))),128))]),o("p",null,[R(f(A(u)("You can configure methods "))+" ",1),o("a",{href:(he=N.value)==null?void 0:he.configure_url,target:"_blank"},f(A(u)("here")),9,y3)])])):k("",!0)])):k("",!0)])):k("",!0),N.type==="tabs"?(r(),h("div",b3,[n(I4,{fields:e.fields,settings:e.settings,index:j,tabs:e.fields[j]},null,8,["fields","settings","index","tabs"])])):k("",!0),N.type==="radio-select-dependants"?(r(),h("div",w3,[n(T4,{fields:e.fields,settings:e.settings,index:j},null,8,["fields","settings","index"])])):k("",!0)])}),128))],2)}}},C3={class:"setting-wrap"},B3={class:"setting-wrap-inner"},k3={class:"mb-5 flex items-center justify-between"},x3={class:"setting-switcher flex items-center gap-3"},S3={class:"setting-save-action"},F3={name:"GlobalPaymentComponents",data(){return{fields:{},settings:{},saving:!1,fetching:!1,is_key_defined:!1,labelPosition:"top",webhook_url:"",fetchRoute:"",pages:[],route_name:"",ipn_url:"Blank",verifiedMessage:!1,verifiedStatus:!1,verifying:!1,methodName:"",methodTitle:"",methodLabel:"",brandColor:"#253241",editDesignModal:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",addonInfo:null,thank_you_page_instructions:""}},watch:{$route(e,t){this.getRoute(),this.getSettings(),this.getPageName()}},mounted(){this.getRoute(),this.getSettings(),window.outerWidth<500&&(this.labelPosition="top")},methods:{editDesign(){this.$router.push({name:"payment-design",params:{method:this.route_name}})},savePaymentDesign(){this.editDesignModal=!1,this.mediaSelection.length>0?this.checkout_logo=this.mediaSelection[0].url:this.checkout_logo="",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(e=>{this.saving=!1,Xs("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return cs.getUrl("images/payment-methods/"+t+"-icon.svg")},updateSettings(e){this.settings=e},getSettings(){this.fetching=!0,this.$get("settings/payment-methods/all").then(e=>{const t=e.gateways.find(a=>a.route===this.route_name);t&&(this.brandColor=t.brand_color||"#000000")}).catch(()=>{}),this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,c,p;this.fetching=!1,this.fields=e.fields,this.settings=e.settings,this.addonInfo=e.addon_info||null,this.registerCopyAction(),this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.checkout_logo?{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}:""}).catch(e=>{var t;this.fetching=!1,ar(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Failed to load settings")})},saveSettings(){this.saving=!0,this.$post("settings/payment-methods",{settings:this.settings,method:this.route_name}).then(e=>{this.saving=!1,Xs("Settings updated!")}).catch(e=>{var t;this.saving=!1,ar(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Something went wrong!")})},verifyKeys(e,t){this.verifying=!0},getRoute(){var e,t,a,l,s,i,c,p,m;this.route_name=this.$route.name,this.methodName=(e=this.$route)==null?void 0:e.name,(a=(t=this.$route)==null?void 0:t.meta)!=null&&a.admin_title?this.methodTitle=(s=(l=this.$route)==null?void 0:l.meta)==null?void 0:s.admin_title:this.methodTitle=(c=(i=this.$route)==null?void 0:i.meta)==null?void 0:c.title,this.methodLabel=(m=(p=this.$route)==null?void 0:p.meta)==null?void 0:m.label,this.fetchRoute=`settings/payments/${this.$route.name}`},getPageName(){let e="";return this.$route.meta.title?e=this.$route.meta.title+" Settings":e=this.$route.name.charAt(0).toUpperCase()+this.$route.name.slice(1).toLowerCase()+" Settings",e}}},$3=Object.assign(F3,{setup(e){const t=zt().ctx;return fs().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=B("el-breadcrumb-item"),c=B("el-breadcrumb"),p=B("el-switch"),m=B("Edit"),_=B("el-icon"),g=B("el-skeleton"),y=B("el-button");return r(),h("div",C3,[o("div",B3,[o("div",k3,[n(c,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[n(i,{to:{path:"/settings/payments"}},{default:d(()=>[R(f(l.$t("Payment Settings")),1)]),_:1}),n(i,null,{default:d(()=>[o("span",null,f(l.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",x3,[n(p,{modelValue:l.settings.is_active,"onUpdate:modelValue":s[0]||(s[0]=v=>l.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":l.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),n(xe,null,{default:d(()=>[n(Ve,{title:l.methodTitle,border_bottom:""},{action:d(()=>[n(_,{class:"text-gray-500 cursor-pointer",onClick:l.editDesign},{default:d(()=>[n(m)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(ke,{class:"pt-0"},{default:d(()=>[n(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?k("",!0):(r(),$(_d,{key:0,onOnSettingsChange:l.updateSettings,routeName:l.route_name,methodName:l.methodName,methodTitle:l.methodTitle,methodLabel:l.methodLabel,brandColor:l.brandColor,fields:l.fields,settings:l.settings},null,8,["onOnSettingsChange","routeName","methodName","methodTitle","methodLabel","brandColor","fields","settings"]))]),_:1})]),_:1}),o("div",S3,[n(y,{onClick:s[1]||(s[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:d(()=>[R(f(l.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),E3={class:"setting-wrap"},U3={class:"setting-wrap-inner"},I3={class:"setting-save-action"},Q3={name:"PaymentDesign",components:{SettingsHeader:Ea},data(){return{settings:{},fetching:!1,saving:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",thank_you_page_instructions:"",route_name:"",methodTitle:"",routeLabel:""}},mounted(){this.initRouteData(),this.getSettings()},methods:{goBack(){this.$router.push({path:`/settings/payments/${this.route_name}`})},savePaymentDesign(){var t;this.saving=!0;let e="";Array.isArray(this.mediaSelection)&&this.mediaSelection.length>0?e=((t=this.mediaSelection[0])==null?void 0:t.url)||"":this.mediaSelection&&typeof this.mediaSelection=="object"&&this.mediaSelection.url?e=this.mediaSelection.url:typeof this.mediaSelection=="string"&&(e=this.mediaSelection),this.checkout_logo=e||"",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(a=>{this.saving=!1,Xs("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,ar("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,c,p;this.fetching=!1,this.settings=e.settings,this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.checkout_logo?[{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}]:""}).catch(()=>{this.fetching=!1})},initRouteData(){var a,l,s,i,c,p;this.route_name=this.$route.params.method||this.$route.name,(l=(a=this.$route)==null?void 0:a.meta)!=null&&l.admin_title?this.methodTitle=(i=(s=this.$route)==null?void 0:s.meta)==null?void 0:i.admin_title:this.methodTitle=((p=(c=this.$route)==null?void 0:c.meta)==null?void 0:p.title)||"",this.routeLabel=this.methodTitle||this.route_name;const e=this.$t("Gateway & checkout instructions"),t=this.methodTitle?`${this.methodTitle} - ${e}`:e;this.$route&&this.$route.meta&&(this.$route.meta.title=t)}}},D3=Object.assign(Q3,{setup(e){return(t,a)=>{const l=B("el-breadcrumb-item"),s=B("el-breadcrumb"),i=B("el-icon"),c=B("el-button"),p=B("el-skeleton"),m=B("el-input"),_=B("el-form-item"),g=B("el-form");return r(),h("div",E3,[n(Ea,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:d(()=>[n(s,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[n(l,{to:{path:"/settings/payments"}},{default:d(()=>[R(f(t.$t("Payment Settings")),1)]),_:1}),n(l,null,{default:d(()=>[o("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},f(t.$route.params.method),1)]),_:1}),n(l,null,{default:d(()=>[o("span",null,f(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),o("div",U3,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Customization"),border_bottom:""},{action:d(()=>[n(c,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:d(()=>[n(i,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:d(()=>[n(A(Qf))]),_:1},8,["onClick"]),R(" "+f(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?k("",!0):(r(),$(g,{key:0,"label-position":"left"},{default:d(()=>[n(_,{label:t.$t("Checkout Label")},{default:d(()=>[n(m,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),n(_,{label:t.$t("Checkout Logo")},{default:d(()=>[n(hi,{modelValue:t.mediaSelection,"onUpdate:modelValue":a[2]||(a[2]=y=>t.mediaSelection=y),icon:"Upload",title:t.$t("Upload Logo")},null,8,["modelValue","title"])]),_:1},8,["label"]),n(_,{"label-position":"top"},{default:d(()=>[n(ca,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),n(Wl,{modelValue:t.checkout_instructions,"onUpdate:modelValue":a[3]||(a[3]=y=>t.checkout_instructions=y),onUpdate:a[4]||(a[4]=y=>{t.checkout_instructions=y})},null,8,["modelValue"])]),_:1}),a[7]||(a[7]=o("div",{class:"h-10"},null,-1)),n(_,{"label-position":"top"},{default:d(()=>[n(ca,{title:t.$t("Thank you page Instruction"),content:t.$t("Thank you page Instruction will be displayed on the thank you page receipt section.")},null,8,["title","content"]),n(Wl,{modelValue:t.thank_you_page_instructions,"onUpdate:modelValue":a[5]||(a[5]=y=>t.thank_you_page_instructions=y),onUpdate:a[6]||(a[6]=y=>{t.thank_you_page_instructions=y})},null,8,["modelValue"])]),_:1})]),_:1,__:[7]}))]),_:1})]),_:1}),o("div",I3,[n(c,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[R(f(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),V3={class:"fct-integration-setting-content"},T3={class:"fct-integration-setting-head"},M3={class:"flex items-center gap-3 mb-2"},L3=["src"],R3={class:"title"},O3=["innerHTML"],H3={key:0,class:"integration_success_state"},P3=["innerHTML"],N3={key:1,class:"fct-integration-setting-body"},K3={class:"fct-integration-setting-body-inner"},G3=["innerHTML"],j3=["innerHTML"],z3=["target","href"],q3={key:0},Y3={key:0,class:"fct-integration-setting-body-footer"},W3={key:2},X3={name:"GeneralIntegration",components:{InfoFilled:nl,Setting:Vc},props:["settings_key"],data(){return{integration:{},loading:!1,saving:!1,settings:{},error_message:""}},watch:{settings_key(){this.integration={},this.settings={},this.getIntegrationSettings()}},mounted(){this.getIntegrationSettings()},methods:{save(){this.saving=!0,this.$post("integration/global-settings",{settings_key:this.settings_key,integration:this.integration}).then(e=>{if(this.saving=!1,this.handleSuccess(e.data.message),e.data.redirect_url){window.location.href=e.data.redirect_url;return}this.integration.status=e.data.status}).catch(e=>{this.integration.status=!1,e&&e.data.message?this.handleError(e.data.message):e&&e.responseJSON.data.message&&this.handleerror(e.responseJSON.data.message)})},getIntegrationSettings(){this.loading=!0,this.$get("integration/global-settings",{settings_key:this.settings_key}).then(e=>{this.loading=!1,this.integration=e.data.integration,this.settings=e.data.settings}).catch(e=>{this.error_message=e.responseJSON.data.message})},disconnect(e){this.integration=e,this.save()},authenticate(e,t){this.loading=!0,this.$post("integration/global-settings"+e,{settings_key:this.settings_key,integration:this.integration}).then(a=>{this.loading=!1,a.data.url?window.open(a.data.url,"_blank"):this.handleSuccess(a.data.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})}}},J3=Object.assign(X3,{setup(e){const t=zt().ctx;return fs().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=B("el-button"),c=B("el-icon"),p=B("el-tooltip"),m=B("el-option"),_=B("el-select"),g=B("el-input"),y=B("el-form-item"),v=B("el-form"),C=Va("loading");return r(),h("div",V3,[o("div",T3,[o("div",M3,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,L3)):k("",!0),o("h3",R3,f(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,O3)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",H3,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,P3),o("div",null,[n(i,{onClick:s[0]||(s[0]=b=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:d(()=>[R(f(l.settings.discard_settings.disconnect_button_text),1)]),_:1}),l.settings.discard_settings.show_verify?(r(),$(i,{key:0,onClick:s[1]||(s[1]=b=>l.save()),type:"primary"},{default:d(()=>[R(f(l.settings.discard_settings.verify_button_text),1)]),_:1})):k("",!0)])])):jt((r(),h("div",N3,[o("div",K3,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,G3)):k("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(O,null,ae(l.settings.fields,(b,w)=>(r(),$(y,{key:w},{label:d(()=>[R(f(b.label)+" ",1),b.label_tips?(r(),$(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:d(()=>[o("div",{innerHTML:b.label_tips},null,8,j3)]),default:d(()=>[n(c,null,{default:d(()=>[n(A(nl))]),_:1})]),_:2},1024)):k("",!0)]),default:d(()=>[b.type=="authenticate-button"?(r(),$(i,{key:0,onClick:x=>l.authenticate(b.end_point,b.params)},{default:d(()=>[R(f(b.button_text),1)]),_:2},1032,["onClick"])):b.type=="select"?(r(),$(_,{key:1,modelValue:l.integration[w],"onUpdate:modelValue":x=>l.integration[w]=x},{default:d(()=>[(r(!0),h(O,null,ae(b.options,(x,F)=>(r(),$(m,{key:F,label:x,value:F},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):b.type=="link"?(r(),h(O,{key:2},[o("a",{target:b.target,class:de(b.btn_class),href:b.link},f(b.link_text),11,z3),o("p",null,f(b.tips),1)],64)):(r(),h(O,{key:3},[n(g,{placeholder:b.placeholder,type:b.type,modelValue:l.integration[w],"onUpdate:modelValue":x=>l.integration[w]=x},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),b.tips?(r(),h("p",q3,f(b.tips),1)):k("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?k("",!0):(r(),h("div",Y3,[n(i,{type:"primary",onClick:l.save},{default:d(()=>[R(f(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[C,l.loading]]),l.error_message?(r(),h("p",W3,f(l.error_message),1)):k("",!0)])}}}),Z3={class:"fct-integration-setting-container fct-layout-width"},eS={class:"single-page-header"},tS={class:"single-page-body"},aS={class:"fct-integration-setting-wrap"},lS={name:"IntegrationEditor"},sS=Object.assign(lS,{setup(e){return(t,a)=>{const l=B("el-breadcrumb-item"),s=B("el-breadcrumb");return r(),h("div",Z3,[o("div",eS,[n(s,{"separator-icon":A(rl)},{default:d(()=>[n(l,{to:{name:"integrations"}},{default:d(()=>[R(f(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:d(()=>[R(f(A(oa).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",tS,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",aS,[n(J3,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),nS={class:"fct-form-group"},oS={for:"store-country"},iS={class:"fct-form-group"},rS={class:"fct-form-group"},dS={class:"fct-form-group"},uS={__name:"OnboardingStoreInfoStep",props:{savedFormData:{type:Object,default:null},initialSettings:{type:Object,default:null},countries:{type:Array,default:()=>[]},currencies:{type:Object,default:()=>({})}},emits:["storeCountryChanged"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=V({store_name:"",store_logo:"",store_country:"",currency:""});Ce(()=>l.savedFormData??l.initialSettings,m=>{m&&(i.value.store_name=m.store_name??"",i.value.store_logo=m.store_logo??"",i.value.store_country=m.store_country??"",i.value.currency=m.currency??"")},{immediate:!0});const c=m=>{s("storeCountryChanged",m),m&&ce.post("settings/store",{store_country:m,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const m=Array.isArray(i.value.store_logo)&&i.value.store_logo.length>0?i.value.store_logo[0]:i.value.store_logo;try{await ce.post("onboarding/",{store_name:i.value.store_name,store_logo:m,store_country:i.value.store_country,currency:i.value.currency})}catch{z.warning(u("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(m,_)=>{const g=B("el-option"),y=B("el-select"),v=B("el-input");return r(),h(O,null,[o("div",nS,[o("label",oS,f(A(u)("Store Country")),1),n(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=C=>i.value.store_country=C),placeholder:A(u)("Store Country"),onChange:c,filterable:""},{default:d(()=>[(r(!0),h(O,null,ae(e.countries,(C,b)=>(r(),$(g,{key:b,label:C.name,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",iS,[o("label",null,f(A(u)("Shop Name")),1),n(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=C=>i.value.store_name=C)},null,8,["modelValue"])]),o("div",rS,[o("label",null,f(A(u)("Store Currency")),1),n(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=C=>i.value.currency=C),filterable:"",placeholder:A(u)("Select")},{default:d(()=>[(r(!0),h(O,null,ae(e.currencies,(C,b)=>(r(),$(g,{key:b,label:C.label,value:C.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",dS,[o("label",null,f(A(u)("Shop Image/Logo")),1),n(hi,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=C=>i.value.store_logo=C),showSupported:"",icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","title"])])],64)}}},vd=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],cS=[...vd,"GB","AU","NZ","CA","IN"],AS=[...vd,"GB","AU","NZ"],pS={class:"fct-tax-step"},fS={class:"fct-tax-step-toggle-row"},mS={class:"fct-tax-step-toggle-row__label"},hS={class:"fct-alert-content"},_S={class:"fct-alert-text"},vS={class:"fct-form-group"},gS={key:0,class:"fct-tax-step-country-chip"},yS={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},bS={class:"fct-form-group"},wS={class:"fct-tax-step-radio-group",role:"radiogroup"},CS=["aria-checked"],BS={class:"fct-tax-step-radio-card__label"},kS={class:"fct-tax-step-radio-card__desc"},xS=["aria-checked"],SS={class:"fct-tax-step-radio-card__label"},FS={class:"fct-tax-step-radio-card__desc"},$S={key:0,class:"fct-form-group"},ES={class:"fct-tax-step-radio-group",role:"radiogroup"},US=["aria-checked"],IS={class:"fct-tax-step-radio-card__label"},QS={class:"fct-tax-step-radio-card__desc"},DS=["aria-checked"],VS={class:"fct-tax-step-radio-card__label"},TS={class:"fct-tax-step-radio-card__desc"},MS=["aria-checked"],LS={class:"fct-tax-step-radio-card__label"},RS={class:"fct-tax-step-radio-card__desc"},OS={class:"fct-form-group"},HS={class:"fct-tax-step-optional"},PS={class:"fct-form-help-text"},NS={class:"fct-alert-content"},KS={class:"fct-alert-text"},GS={__name:"OnboardingTaxStep",props:{savedFormData:{type:Object,default:null},storeCountry:{type:String,default:""},countryName:{type:String,default:""},initialTaxSettings:{type:Object,default:null}},setup(e,{expose:t}){const a=e,l=V({collectTaxes:!1,taxInclusion:"excluded",euMethod:"oss",vatNumber:""}),s=K(()=>vd.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},c=K(()=>{if(!s.value)return u("Tax ID / VAT Number");if(l.value.euMethod==="oss")return u("OSS VAT Number");if(l.value.euMethod==="specific"){const y=a.countryName||a.storeCountry;return u("%1$s VAT Number",y)}return u("Home VAT Number")}),p=K(()=>s.value?u("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?u("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):u("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),m=y=>{l.value={collectTaxes:cS.includes(y),taxInclusion:AS.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};Ce(()=>a.storeCountry,m),Qe(()=>{if(a.savedFormData){l.value={...a.savedFormData};return}const y=a.initialTaxSettings;y&&y.enable_tax==="yes"?l.value={collectTaxes:!0,taxInclusion:y.tax_inclusion||"excluded",euMethod:y.eu_method||"oss",vatNumber:y.vat_number||""}:m(a.storeCountry)});const _=async()=>{try{await ce.post("onboarding/save-tax",{enable_tax:l.value.collectTaxes?"yes":"no",store_country:a.storeCountry,tax_inclusion:l.value.taxInclusion,eu_method:l.value.euMethod,vat_number:l.value.vatNumber})}catch{z.warning(u("Tax settings could not be saved. You can configure them in Tax → Settings."))}return!0},g=(y,v)=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i(v))};return t({onNextStep:_,getFormData:()=>({...l.value})}),(y,v)=>{const C=B("el-switch"),b=B("el-input");return r(),h("div",pS,[o("div",fS,[o("span",mS,f(A(u)("Collect taxes for my store")),1),n(C,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=w=>i({collectTaxes:w}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(O,{key:1},[o("div",vS,[o("label",null,f(A(u)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",gS,[n(ee,{name:"Globe"}),R(" "+f(e.countryName||e.storeCountry),1)])):(r(),h("span",yS,f(A(u)("Not set")),1))])]),e.storeCountry?(r(),h(O,{key:0},[o("div",bS,[o("label",null,f(A(u)("How do you display your prices?")),1),o("div",wS,[o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="included"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="included",onClick:v[1]||(v[1]=w=>i({taxInclusion:"included"})),onKeydown:v[2]||(v[2]=w=>g(w,{taxInclusion:"included"}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",BS,f(A(u)("Prices include tax")),1),o("div",kS,f(A(u)("Tax is already factored into your listed price.")),1)])],42,CS),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="excluded"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="excluded",onClick:v[3]||(v[3]=w=>i({taxInclusion:"excluded"})),onKeydown:v[4]||(v[4]=w=>g(w,{taxInclusion:"excluded"}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",SS,f(A(u)("Add tax at checkout")),1),o("div",FS,f(A(u)("Tax is shown separately and added to the subtotal.")),1)])],42,xS)])]),s.value?(r(),h("div",$S,[o("label",null,f(A(u)("Cross-border compliance")),1),o("div",ES,[o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="oss"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="oss",onClick:v[5]||(v[5]=w=>i({euMethod:"oss",vatNumber:""})),onKeydown:v[6]||(v[6]=w=>g(w,{euMethod:"oss",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",IS,f(A(u)("OSS (One Stop Shop)")),1),o("div",QS,f(A(u)("Charge each EU customer their country's VAT rate.")),1)])],42,US),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="home"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="home",onClick:v[7]||(v[7]=w=>i({euMethod:"home",vatNumber:""})),onKeydown:v[8]||(v[8]=w=>g(w,{euMethod:"home",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",VS,f(A(u)("Home Country Only")),1),o("div",TS,f(A(u)("Charge all EU customers your home country's rate.")),1)])],42,DS),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="specific"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="specific",onClick:v[9]||(v[9]=w=>i({euMethod:"specific",vatNumber:""})),onKeydown:v[10]||(v[10]=w=>g(w,{euMethod:"specific",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",LS,f(A(u)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",RS,f(A(u)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,MS)])])):k("",!0),o("div",OS,[o("label",null,[R(f(c.value)+" ",1),o("span",HS,f(A(u)("(optional)")),1)]),n(b,{"model-value":l.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=w=>i({vatNumber:w})),placeholder:s.value?"DE123456789":""},null,8,["model-value","placeholder"]),o("p",PS,f(A(u)("Your registration number, printed on invoices")),1)]),n(Za,{icon:"Info"},{content:d(()=>[o("div",NS,[o("p",KS,f(p.value),1)])]),_:1})],64)):k("",!0)],64)):(r(),$(Za,{key:0},{content:d(()=>[o("div",hS,[o("p",_S,f(A(u)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},jS={class:"dialog-footer"},zS={__name:"CreatePageButton",props:{title:{default:u("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,l=t,s=V(!1),i=V(a.title),c=()=>{ce.post("onboarding/create-page",{page_name:i.value,content:a.content}).then(p=>{l("onPageCreated",{value:p.page_id,label:`${i.value}( ${p.page_id})`,page_link:p.link}),i.value="",s.value=!1,z.success(u("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const m=Object.entries(p.page_name).length;let _="",g=0;for(const y in p.page_name)_+=p.page_name[y],g!==m&&(_+=` | |
| 152 | -`),g++;z.error(_)}else z.error(u("Sorry, Unable To Create Page!!"))})};return(p,m)=>{const _=B("el-input"),g=B("el-form-item"),y=B("el-form"),v=B("el-button"),C=B("el-dialog");return r(),h(O,null,[n(Xe,{onClick:m[0]||(m[0]=Ne(b=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[n(ee,{name:"Plus"})]),_:1}),n(C,{modelValue:s.value,"onUpdate:modelValue":m[3]||(m[3]=b=>s.value=b),title:A(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[o("div",jS,[n(v,{onClick:m[2]||(m[2]=b=>s.value=!1),type:"info",soft:""},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(v,{type:"primary",onClick:c},{default:d(()=>[R(f(A(u)("Create Page")),1)]),_:1})])]),default:d(()=>[n(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ne(c,["prevent"])},{default:d(()=>[n(g,{label:A(u)("Page Name"),required:""},{default:d(()=>[n(_,{modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=b=>i.value=b),placeholder:A(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},qS={class:"fct-form-group"},YS={class:"fct-form-group-inner"},WS={class:"input-prepend"},XS={class:"input-append"},JS={__name:"PageSelector",props:_l({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:_l(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=Sl(e,"modelValue",{get:c=>c?typeof c=="string"?Number(c):c:""}),l=t,s=V(!1),i=c=>{s.value=c};return(c,p)=>{const m=B("el-option"),_=B("el-select");return r(),h("div",qS,[o("label",null,f(e.title),1),o("div",YS,[o("div",{class:de(["fct-input-group w-full",{focused:s.value}])},[o("div",WS,[n(_,{filterable:"",modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g),onFocus:p[1]||(p[1]=g=>i(!0)),onBlur:p[2]||(p[2]=g=>i(!1)),placeholder:A(u)("Select"),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(e.pages,(g,y)=>(r(),$(m,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",XS,[n(zS,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},ZS={class:"fct-onboarding-form-body-header"},eF={class:"left"},tF={class:"fct-onboarding-form-body-header__title"},aF={class:"fct-onboarding-form-body-header__desc"},lF={key:0,class:"fct-onboarding-form-body-header__action"},sF={__name:"OnboardingPagesStep",props:{pages:{type:Array,default:()=>[]},initialSettings:{type:Object,default:null},savedFormData:{type:Object,default:null},onPagesUpdated:{type:Function,default:()=>{}}},setup(e,{expose:t}){const a=e,l=["checkout_page_id","cart_page_id","receipt_page_id","shop_page_id","customer_profile_page_id"],s={checkout_page_id:()=>u("Checkout"),cart_page_id:()=>u("Cart"),receipt_page_id:()=>u("Receipt"),shop_page_id:()=>u("Shop"),customer_profile_page_id:()=>u("Customer Profile")},i=V(Object.fromEntries(l.map(b=>[b,""])));Ce(()=>a.initialSettings,b=>{if(a.savedFormData){l.forEach(w=>{i.value[w]=a.savedFormData[w]??""});return}b&&l.forEach(w=>{i.value[w]=b[w]??""})},{immediate:!0});const c=V(u("Select Pages")),p=V(u("Select the pages you'd like from your website")),m=V(!1),_=V(!1),g=()=>{_.value=!0,ce.post("onboarding/create-pages",{}).then(b=>{l.forEach(w=>{var x;i.value[w]=String(((x=b.default_settings)==null?void 0:x[w])??"")}),m.value=!0,c.value=u("Existing Pages"),p.value=u("Select the pages you'd like from the list provided."),a.onPagesUpdated(b.pages)}).finally(()=>{_.value=!1})},y=(b,w)=>{i.value[w]=b.value,a.onPagesUpdated([...a.pages,b])};return t({onNextStep:async()=>{try{await ce.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value})}),(b,w)=>{const x=B("el-button");return r(),h(O,null,[o("div",ZS,[o("div",eF,[o("div",tF,f(c.value),1),o("div",aF,f(p.value),1)]),m.value?k("",!0):(r(),h("div",lF,[n(x,{onClick:g,loading:_.value},{default:d(()=>[_.value?k("",!0):(r(),$(ee,{key:0,name:"MagicPen"})),R(" "+f(A(u)("Generate All Pages")),1)]),_:1},8,["loading"])]))]),(r(),h(O,null,ae(l,F=>o("div",{key:F,class:"fct-form-group"},[n(JS,{title:s[F](),pages:e.pages,modelId:F,modelValue:i.value[F],"onUpdate:modelValue":L=>i.value[F]=L,onOnPageCreated:y},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))],64)}}},nF={class:"fct-form-group"},oF={class:"marker"},iF={class:"label"},rF={class:"marker"},dF={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=V("start-from-scratch"),s=(p=0)=>{if(!l.value||l.value==="start-from-scratch")return;const m=a.dummyProductInfo[l.value];!m||p>m.count-1||ce.post("products/create-dummy",{category:m.category,index:p}).then(()=>{s(p+1)}).catch(_=>{_.status_code!==400&&s(p+1)})},i=()=>{if(l.value&&l.value!=="start-from-scratch"){const p=Zs.appendToVueUrl(null,{import_product:l.value});window.location.href=Zs.appendQueryParams(p);return}window.location.href=ze.get("dashboard_url")};return t({onNextStep:async()=>{s();try{await ce.post("onboarding/",{category:l.value})}catch{}return setTimeout(i,300),!1}}),(p,m)=>{const _=B("el-icon"),g=B("el-radio-button"),y=B("el-radio-group");return r(),h("div",nF,[n(y,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=v=>l.value=v),size:"large"},{default:d(()=>[n(g,{value:"start-from-scratch"},{default:d(()=>[n(ee,{name:"Scratch"}),m[1]||(m[1]=o("span",{class:"label"},[R("Start "),o("br"),R("From scratch")],-1)),o("span",oF,[n(_,null,{default:d(()=>[n(A(ko))]),_:1})])]),_:1,__:[1]}),(r(!0),h(O,null,ae(e.dummyProductInfo,(v,C)=>(r(),$(g,{key:C,value:C},{default:d(()=>[n(ee,{name:v.icon},null,8,["name"]),o("span",iF,f(v.title),1),o("span",rF,[n(_,null,{default:d(()=>[n(A(ko))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])}}},uF={class:"fct-onboarding-wrap"},cF={key:0,class:"fct-onboarding-card"},AF={class:"fct-onboarding-card-body"},pF={class:"fct-onboarding-content-box"},fF={class:"fct-onboarding-card-head"},mF={class:"fct-onboarding-card-head-top"},hF=["src","alt"],_F={class:"fct-onboarding-steps-count"},vF={class:"fct-onboarding-card-title"},gF={class:"fct-onboarding-card-text"},yF={class:"fct-onboarding-content-box-inner"},bF={key:0,class:"fct-onboarding-load-error"},wF={key:1,class:"fct-onboarding-form-wrap active"},CF={class:"fct-onboarding-form-body"},BF={key:0,class:"fct-onboarding-bottom"},kF={class:"fct-onboarding-bottom-left"},xF={class:"fct-onboarding-bottom-right"},SF={key:0,class:"cmd"},FF={__name:"Onboarding",setup(e){const t=V(!1),a=V([]),l=V({}),s=V([]),i=V([]),c=V(null),p=V(null),m=V(null),_=V(null),g=V(null),y=V(""),v=K(()=>{if(!y.value)return"";const pe=s.value.find(N=>N.value===y.value);return pe?pe.name:y.value}),C=[{key:"store-info",title:()=>u("Welcome aboard! Let's create your online store."),component:uS,props:()=>({savedFormData:m.value,initialSettings:c.value,countries:s.value,currencies:l.value,onStoreCountryChanged:pe=>{y.value=pe}})},{key:"tax",title:()=>u("Set Up Tax Collection"),component:GS,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>u("Setup Your Pages"),component:sF,props:()=>({pages:a.value,initialSettings:c.value,savedFormData:g.value,onPagesUpdated:pe=>{a.value=pe}})},{key:"products",title:()=>u("Setup Your Products"),component:dF,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],b=C.length+1,w=V(1),x=K(()=>C[w.value-1]),F=K(()=>{var pe;return((pe=x.value)==null?void 0:pe.title())??""}),L=V(null),U=V(!1),S=()=>{w.value++},M=()=>{var N,j;const pe=(j=(N=L.value)==null?void 0:N.getFormData)==null?void 0:j.call(N);pe&&(x.value.key==="store-info"?m.value=pe:x.value.key==="tax"?_.value=pe:x.value.key==="pages"&&(g.value=pe))},I=async()=>{var pe,N;if(!U.value){U.value=!0;try{M(),await((N=(pe=L.value)==null?void 0:pe.onNextStep)==null?void 0:N.call(pe))!==!1&&S()}finally{U.value=!1}}},T=()=>{var pe,N;M(),(N=(pe=L.value)==null?void 0:pe.onPreviousStep)==null||N.call(pe),w.value>1&&w.value--},Q=()=>{S()},E=()=>{var pe,N;(N=(pe=L.value)==null?void 0:pe.onSkipAll)==null||N.call(pe),window.location.href=ze.get("dashboard_url")};fs().onSave(()=>{var pe;(pe=x.value)!=null&&pe.isFinal&&I()});const H=V(!1),P=()=>{t.value=!0,H.value=!1,ce.get("onboarding/").then(pe=>{var N;a.value=pe.pages,l.value=pe.currencies,c.value=pe.default_settings,y.value=((N=pe.default_settings)==null?void 0:N.store_country)??"",p.value=pe.tax_settings??null}).catch(()=>{H.value=!0}).finally(()=>{t.value=!1})},G=()=>{ce.get("address-info/countries").then(pe=>{s.value=pe.data})},J=cs.getUrl("images/logo/logo-full-dark.svg"),oe=cs.getUrl("images/logo/logo-full.svg"),Z=V(ze.get("asset_url")+"/images/logo/logo-full-dark.svg"),W=()=>{Z.value=Te.isDark()?oe:J};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",W),i.value=ze.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),Z.value=Te.isDark()?oe:J,P(),G()}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",W),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(pe,N)=>{const j=B("el-progress"),q=B("el-button"),X=Va("loading");return r(),h(O,null,[o("div",uF,[w.value<b?(r(),h("div",cF,[jt((r(),h("div",AF,[o("div",pF,[o("div",fF,[o("div",mF,[o("img",{src:Z.value,alt:A(u)("Fluent Cart")},null,8,hF),o("div",_F,f(A(u)("Step %1$s of %2$s",w.value,C.length)),1),n(j,{percentage:w.value/C.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("h2",vF,f(F.value),1),o("p",gF,f(A(u)("You've successfully Installed The Plugin.")),1)]),o("div",yF,[H.value?(r(),h("div",bF,[o("p",null,f(A(u)("Failed to load settings. Please refresh and try again.")),1),n(q,{onClick:P},{default:d(()=>[R(f(A(u)("Retry")),1)]),_:1})])):(r(),h("div",wF,[o("div",CF,[(r(),$(Cl(x.value.component),ga({key:x.value.key,ref_key:"stepRef",ref:L},x.value.props()),null,16))])]))])])])),[[X,t.value]])])):k("",!0)]),w.value<b?(r(),h("div",BF,[o("div",kF,[w.value>1?(r(),$(q,{key:0,text:"",onClick:E},{default:d(()=>[R(f(A(u)("Skip All")),1)]),_:1})):k("",!0)]),o("div",xF,[n(q,{onClick:T,type:"info",plain:"",disabled:w.value===1},{default:d(()=>[R(f(A(u)("Go Back")),1)]),_:1},8,["disabled"]),x.value.canSkip?(r(),$(q,{key:0,text:"",onClick:Q,disabled:U.value},{default:d(()=>[R(f(A(u)("Skip for now")),1)]),_:1},8,["disabled"])):k("",!0),x.value.isFinal?(r(),$(q,{key:2,type:"primary",loading:U.value,onClick:I},{default:d(()=>[U.value?k("",!0):(r(),h("span",SF,"⌘s")),R(" "+f(U.value?A(u)("Saving"):A(u)("Save")),1)]),_:1},8,["loading"])):(r(),$(q,{key:1,type:"primary",loading:U.value,disabled:H.value,onClick:I},{default:d(()=>[R(f(A(u)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):k("",!0)],64)}}},$F={class:"fct-orders-route-wrap"},EF=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=B("router-view");return r(),h("div",$F,[n(l)])}}}),UF={class:"setting-wrap"},IF={class:"setting-wrap-inner"},QF={key:0,class:"payment-method-list fct-content-card-list"},DF={class:"flex items-start gap-3"},VF=["onClick"],TF=["src","alt"],MF={key:0,class:"fct_payment_method_tag"},LF={class:"fct-content-card-list-content"},RF={class:"fct-content-card-list-action"},OF={key:0},HF=["src"],PF={__name:"PaymentSettings",setup(e){const t=zt().ctx,a=V(!1),l=V([]),s=ze.get("app_config.isProActive"),i=K(()=>({animation:200,ghostClass:"ghost"})),c=g=>{var y;return(g==null?void 0:g.upcoming)!=!0&&(!(g!=null&&g.requires_pro)||(g==null?void 0:g.requires_pro)&&s)&&((g==null?void 0:g.is_addon)!=!0||(g==null?void 0:g.is_addon)&&((y=g==null?void 0:g.addon_status)==null?void 0:y.is_installed))},p=g=>g===!0?"active":"inactive",m=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{l.value=g.gateways}).catch(g=>{}).finally(()=>{a.value=!1})},_=()=>{const g=l.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{z.success(y.message)}).catch(y=>{})};return Qe(()=>{m()}),(g,y)=>{const v=B("el-skeleton"),C=B("el-button");return r(),h("div",UF,[n(Ea,{heading:A(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",IF,[n(Ua),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?k("",!0):(r(),h("div",QF,[n(A(Js),ga(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:d(()=>[(r(!0),h(O,null,ae(l.value,b=>(r(),h("div",{key:b.route,class:de(b!=null&&b.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",DF,[y[0]||(y[0]=o("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:"Drag to reorder"},[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})])],-1)),o("div",{onClick:()=>{var w;!((w=b==null?void 0:b.addon_status)!=null&&w.is_installed)&&(b!=null&&b.addon_source)||g.$router.push({name:b.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:de(["fct-content-card-list-head",b.route])},[o("img",{src:b.icon,alt:b.admin_title||b.title},null,8,TF),b!=null&&b.tag?(r(),h("span",MF,[n(Aa,{size:"small",status:"info",text:b.tag},null,8,["text"])])):k("",!0),c(b)?(r(),$(Aa,{key:1,size:"small",status:b.status?"active":"disabled","hide-icon":!0},{default:d(()=>[R(f(p(b.status)),1)]),_:2},1032,["status"])):k("",!0)],2),o("div",LF,[o("p",null,f(b.description),1)])],8,VF),o("div",RF,[b!=null&&b.upcoming?(r(),h("div",OF,f(A(u)("Coming Soon!")),1)):(r(),$(C,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:b.route})},{default:d(()=>{var w;return[R(f(A(u)("Manage"))+" ",1),b!=null&&b.requires_pro?(r(),h("img",{key:0,src:((w=g.appVars)==null?void 0:w.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,HF)):k("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},NF={class:"role-form"},KF={class:"select-use-option"},GF={class:"select-label"},jF={key:0,class:"select-desc"},zF={class:"dialog-footer"},qF={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=V(!1),s=a,i=V(!1),c=V(null),p=V(null),m=V(!1),_=V(null),g=V(null),y=V({}),v=V(!1),C=S=>{if(!S){_.value=[];return}ce.get("roles/user-list",{search:S}).then(M=>{_.value=M.users.data}).finally(()=>{})},b=()=>{ce.get("roles").then(S=>{g.value=S.roles}).catch(S=>{if(S.message){z.error(S.message);return}}).finally(()=>{})},w=()=>{y.value={},i.value=!0,ce.post("roles",{user_id:c.value,role_key:p.value}).then((S,M)=>{l.value=!1,z.success(S.message),s("fetchRoles")}).catch(S=>{var M;(M=S.data)!=null&&M.message?z.error(S.data.message):y.value=S.data}).finally(()=>{i.value=!1})},x=()=>{c.value=null,p.value=null,m.value=!1,y.value={},l.value=!1},F=V(""),L=K(()=>m.value?u("Edit %1$s's Role",F.value):u("Add Role"));return t({openModal:(S,M,I,T=!1)=>{c.value=S,p.value=M,F.value=I,l.value=!0,m.value=T,b()}}),(S,M)=>{const I=B("el-option"),T=B("el-select"),Q=B("el-form-item"),E=B("el-form"),D=B("el-button"),H=B("el-dialog");return r(),$(H,{title:L.value,modelValue:l.value,"onUpdate:modelValue":M[4]||(M[4]=P=>l.value=P),onClosed:x,"append-to-body":!0},{footer:d(()=>[o("span",zF,[n(D,{onClick:x},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:w,loading:i.value,disabled:i.value},{default:d(()=>[R(f(m.value?A(u)("Update Role"):A(u)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[o("div",NF,[n(E,{"label-position":"top"},{default:d(()=>[m.value?k("",!0):(r(),$(Q,{key:0,label:A(u)("Select User")},{default:d(()=>[n(T,{modelValue:c.value,"onUpdate:modelValue":M[0]||(M[0]=P=>c.value=P),remote:!0,"remote-method":C,loading:v.value,filterable:"",clearable:"",placeholder:A(u)("Type to search user"),class:"w-full",onChange:M[1]||(M[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(O,null,ae(_.value,P=>(r(),$(I,{key:P.ID,label:P.name,value:P.ID},{default:d(()=>[o("div",KF,[o("span",null,f(P.name),1),o("span",null,f(P.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),$(la,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):k("",!0)]),_:1},8,["label"])),n(Q,{label:A(u)("Select Role")},{default:d(()=>[n(T,{onChange:M[2]||(M[2]=P=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":M[3]||(M[3]=P=>p.value=P),placeholder:A(u)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:d(()=>[(r(!0),h(O,null,ae(g.value,(P,G)=>(r(),$(I,{key:G,label:P.title,value:G},{default:d(()=>[o("div",GF,f(P.title),1),P.description?(r(),h("div",jF,f(P.description),1)):k("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),$(la,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):k("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},YF=lt(qF,[["__scopeId","data-v-b3e8599d"]]),WF={class:"setting-wrap"},XF={class:"setting-wrap-inner"},JF={key:0,class:"fct-setting-header-action"},ZF={class:"fct-role-settings"},e$={class:"fct-customer-card"},t$={class:"fct-customer-details"},a$={class:"fct-customer-name"},l$={class:"fct-customer-id"},s$={class:"fct-customer-email"},n$={class:"role-title flex items-center gap-1 capitalize"},o$={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},i$={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},r$={__name:"RoleSettings",setup(e){const t=V(!1),a=V([]),l=V(),s=V(!1),i=ze.get("app_config.isProActive"),c=()=>{t.value=!0,ce.get("roles/managers").then(m=>{a.value=m.managers}).finally(()=>{t.value=!1})},p=m=>{s.value=!0,ce.delete("roles/"+m.shop_role,{user_id:m.id}).then(_=>{a.value=a.value.filter(g=>g.id!==m.id),z.success(_.message)}).catch(_=>{if(_.message)return z.error(_.message)}).finally(()=>{s.value=!1})};return Qe(()=>{i&&c()}),(m,_)=>{const g=B("el-button"),y=B("el-table-column"),v=B("el-popconfirm"),C=B("el-table"),b=Va("loading");return r(),h("div",WF,[n(Ea,{heading:A(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",XF,[n(Ua),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Existing Roles & Permissions")},{action:d(()=>[A(i)?(r(),h("div",JF,[n(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var w;(w=l.value)==null||w.openModal()})},{default:d(()=>[R(f(A(u)("Add Role")),1)]),_:1})])):k("",!0)]),_:1},8,["title"]),A(i)?(r(),$(ke,{key:0,class:"px-0 pb-0"},{default:d(()=>[o("div",ZF,[jt((r(),$(C,{data:a.value},{empty:d(()=>[n(_t,{icon:"Empty/RoleAndPermission","has-dark":!0,text:A(u)("No roles found!")},null,8,["text"])]),default:d(()=>[n(y,{label:A(u)("User"),width:150},{default:d(w=>{var x,F,L;return[o("div",e$,[o("div",t$,[o("div",a$,[R(f(((x=w.row)==null?void 0:x.display_name)||A(u)("No Name"))+" ",1),o("span",l$,"#"+f((F=w.row)==null?void 0:F.id),1)]),o("div",s$,f((L=w.row)==null?void 0:L.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:A(u)("Role Title"),width:100},{default:d(w=>[o("span",n$,f(A(oa).headline(w.row.shop_role)),1)]),_:1},8,["label"]),n(y,{prop:"description",label:A(u)("Roles"),width:100},{default:d(w=>[o("span",o$,f(w.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:d(w=>[o("div",i$,[n(Xe,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var x;(x=l.value)==null||x.openModal(w.row.id,w.row.shop_role,w.row.display_name,!0)}},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(v,{width:235,"confirm-button-text":A(u)("Confirm"),"cancel-button-text":A(u)("No, Thanks"),"icon-color":"red",title:A(u)("Are you sure to delete this user?"),onConfirm:x=>p(w.row)},{reference:d(()=>[n(Xe,{tag:"a",size:"x-small",hover:"danger"},{default:d(()=>[n(ee,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[b,t.value||s.value]])])]),_:1})):(r(),$(ke,{key:1,class:"px-0 pb-0"},{default:d(()=>[n(Vn,{class:"py-7.5",title:A(u)("Upgrade to Pro for Roles & Permission"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),n(YF,{ref_key:"roleModal",ref:l,onFetchRoles:c},null,512)])])}}},d$={class:"fct-settings-nav-wrap"},u$={class:"fct-settings-nav-collapse-button-wrapper"},c$={class:"fct-menu-collapse-button-text"},A$={class:"fct-settings-nav-link-text"},p$={class:"fct-settings-nav-child-list"},f$={class:"fct-settings-nav-content"},m$={class:"fct-settings-nav-content-inner"},h$=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=al(),a=tl(),l=V(window.innerWidth>=1024),s=V(!1),i=V(!1),c=V(null),p=V(null),m=V(null);Sn.has("store/settings");const _=V([{name:u("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:u("Store Setup"),url:"/settings/store-settings/"},{name:u("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:u("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:u("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:u("Subscriptions"),url:"/settings/store-settings/subscriptions"},{name:u("Checkout Fields"),url:"/settings/store-settings/checkout_fields"}]},{name:u("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:u("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:u("Invoice & Packing"),url:"/settings/invoice-packing"},{name:u("PDF Templates"),url:"/settings/pdf-template"},{name:u("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:u("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:u("Configuration"),url:"/settings/tax_settings"},{name:u("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:u("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:u("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:u("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:u("Notifications"),url:"/settings/email_notifications"},{name:u("Store Digest"),url:"/settings/email_digest_settings"}]},{name:u("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:u("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&_.value.push({name:u("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:u("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:u("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:u("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),_.value.push({name:u("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),ze.get("app_config.isProActive")&&_.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),ze.get("addon_settings_sidebar",[]).forEach(U=>_.value.push(U));const y=()=>{if(!l.value){c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open");return}s.value=!s.value,i.value=!1},v=()=>{l.value||(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open"))},C=U=>U.child?(!w.value||x.value)&&F(U):!1,b=()=>{const U=window.innerWidth,S=l.value;l.value=U>=1024,!S&&l.value&&(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),S&&!l.value&&(s.value=!1)};Qe(()=>{m.value=document.getElementById("fluent_cart_plugin_app"),m.value&&m.value.classList.add("fct_settings_page_plugin_app_wrap"),b(),window.addEventListener("resize",b)}),Ct(()=>{m.value&&m.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",b)});const w=K(()=>s.value),x=K(()=>l.value&&s.value&&i.value),F=U=>{const S=t.path;return!!(U.child&&U.child.length&&U.child.some(I=>S===I.url||S.includes(I.url))||S===U.url||S.includes(U.url))},L=(U,S,M)=>{const I=t.path;return!!(I===U.url||U.activeFor&&U.activeFor.some(T=>I.startsWith(T))||I===M.url&&S===0)};return(U,S)=>{const M=B("el-button"),I=B("el-tooltip"),T=B("router-link"),Q=B("router-view");return r(),h("div",{class:de(["fct-setting-container setting-container",{"is-collapsed":w.value,"is-expanded":x.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",d$,[o("div",{ref_key:"sidebarRef",ref:c,class:de(["fct-settings-nav-container",{"is-collapsed":w.value,"is-expanded":x.value}])},[o("div",u$,[n(I,{content:A(u)("Toggle settings"),placement:"right"},{default:d(()=>[n(M,{onClick:y,"aria-label":A(u)("Toggle settings navigation"),"aria-expanded":!w.value},{default:d(()=>[n(ee,{name:"Window"}),o("span",c$,f(A(u)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:S[0]||(S[0]=E=>l.value&&s.value&&(i.value=!0)),onMouseleave:S[1]||(S[1]=E=>i.value=!1)},[(r(!0),h(O,null,ae(_.value,(E,D)=>(r(),h("li",{key:D,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":F(E)}])},[A(Sn).hasAny(E.permission)?(r(),$(T,{key:0,to:E.url,class:"fct-settings-nav-link"},{default:d(()=>[n(ee,{name:E.icon},null,8,["name"]),o("span",A$,[R(f(E.name)+" ",1),n(ee,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):k("",!0),n(_a,{visible:C(E),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",p$,[(r(!0),h(O,null,ae(E.child,(H,P)=>(r(),h("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":L(H,P,E)}])},[n(T,{to:H.url,class:"fct-settings-nav-link"},{default:d(()=>[R(f(H.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",f$,[o("div",m$,[n(Q)])])])],2)}}}),_$={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},v$={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=l=>t.columns.includes(l);return(l,s)=>{const i=B("el-table-column"),c=B("el-skeleton-item"),p=B("el-skeleton"),m=B("el-table");return r(),$(m,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:d(()=>[a("selection")?(r(),$(i,{key:0,type:"selection",width:"45"})):k("",!0),n(i,{width:140,label:A(u)("# Date")},{default:d(()=>[o("div",_$,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1}),n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),$(i,{key:1,"min-width":200,label:A(u)("Items")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):k("",!0),n(i,{width:150,label:A(u)("Total")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:150,label:A(u)("Payment Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),$(i,{key:2,width:120,label:A(u)("Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):k("",!0),a("type")?(r(),$(i,{key:3,width:140,label:A(u)("Order Type")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):k("",!0)]),_:1})}}},g$={class:"select-use-option"},y$={class:"dialog-footer"},fp={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=V(!1),l=V([]),s=V(null),i=V({}),c=V(!1),p=()=>{i.value={},c.value=!0,ce.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,z.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return z.error(g.message);i.value=g}).finally(()=>{c.value=!1})},m=()=>{s.value=null,i.value={},a.value=!1},_=()=>{ce.get("customers/attachable-user").then(g=>{l.value=rt.get(g,"users")})};return Qe(()=>{_()}),(g,y)=>{B("el-link");const v=B("el-option"),C=B("el-select"),b=B("el-form-item"),w=B("el-form"),x=B("el-button"),F=B("el-dialog");return r(),h(O,null,[k("",!0),n(F,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=L=>a.value=L),title:A(u)("Attach User"),onClosed:m},{footer:d(()=>[o("span",y$,[n(x,{onClick:m},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(x,{type:"primary",onClick:p,loading:c.value,disabled:c.value},{default:d(()=>[R(f(A(u)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[n(w,{"label-position":"top"},{default:d(()=>[n(b,{label:g.$t("Select User")},{default:d(()=>[n(C,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=L=>s.value=L),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(O,null,ae(l.value,L=>(r(),$(v,{key:L.ID,label:L.display_name,value:L.ID},{default:d(()=>[o("div",g$,[o("span",null,f(L.display_name),1),o("span",null,f(L.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),$(la,{key:0,"validation-errors":i.value,"field-key":"user_id"},null,8,["validation-errors"])):k("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},b$={class:"more-btn"},w$={class:"fct-admin-sidebar-item"},C$={class:"fct-profile-card"},B$={class:"fct-profile-image"},k$=["src","alt"],x$={class:"fct-profile-details"},S$={class:"title"},F$={class:"text"},$$={key:0},E$={class:"text"},U$={key:0,class:"flex items-center gap-2 mt-1.5"},I$={class:"user-info"},Q$=["href"],D$={key:1},V$={class:"fct-admin-sidebar-item mt-5"},T$={class:"sidebar-title"},M$={class:"fct-contact-info-list"},L$={class:"flex items-center justify-between gap-2"},R$=["href"],O$={class:"fct-admin-sidebar-item mt-5"},H$={class:"sidebar-title"},P$={key:0,class:"fct-address-copy-wrap"},N$={class:"text"},K$={key:0,class:"pr-1"},G$=["innerHTML"],j$={key:1,class:"mt-3"},z$={class:"pr-1"},q$=["href"],Y$={key:0,class:"no-address-text"},W$={class:"fct-admin-sidebar-item mt-5"},X$={class:"sidebar-title"},J$={key:0,class:"fct-address-copy-wrap"},Z$={class:"text"},eE={key:0,class:"pr-1"},tE=["innerHTML"],aE={key:1,class:"mt-3"},lE={class:"pr-1"},sE=["href"],nE={key:0,class:"no-address-text"},oE={class:"fct-customer-address-wrap"},iE={name:"CustomerInformations",components:{CustomerPurchaseValue:xf,NewCustomerModal:jr,ManageAddressModal:Fc,AddOrEditAddressModal:Sc,DynamicIcon:ee,CopyToClipboard:Fa,UserAttchModal:fp,Back:Xr},props:["customer","customer_id"],data(){return this.localizedData=window.fluentCartAdminApp,{addOrEditAddress:!1,shippingAddress:[],billingAddress:[],showAddressModal:!1,modalAction:{type:"billing",action:"create"},address:{},address_mock:{label:"",name:"",phone:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",is_primary:"0"},customerModalInfos:{showModal:!1,action:"edit",title:"Edit Customer Information",customer:{}},detaching:!1,recalculatingLtv:!1,shouldShowSetAsAlsoCheckbox:!0,closingModal:!1}},computed:{customerDisplayName(){var e,t,a;return this.localizedData.is_full_name_required?(e=this.customer)==null?void 0:e.full_name:((t=this.customer)==null?void 0:t.first_name)+" "+((a=this.customer)==null?void 0:a.last_name)},hasPrimaryBilling(){return this.billingAddress.findIndex(e=>e.is_primary=="1")},hasPrimaryShipping(){return this.shippingAddress.findIndex(e=>e.is_primary=="1")}},mounted(){this.billingAddress=this.customer.billing_address,this.shippingAddress=this.customer.shipping_address,this.customerModalInfos.customer=this.customer,this.customerModalInfos.customer_id=this.customer.id},methods:{handleCustomerBulkCommand(e){e==="edit_customer_information"&&(this.customerModalInfos.showModal=!0),e==="manage_billing_address"&&this.manageAddress("billing"),e==="manage_shipping_address"&&this.manageAddress("shipping"),e==="recalculate_ltv"&&this.recalculateLtv()},getCustomerTotalOrders(e){return e>0?e+" "+(e.toString()==="1"?this.$t("order"):this.$t("orders")):this.$t("No orders")},refresh(){this.addOrEditAddress=!1,this.fetch()},getTitle(){return this.modalAction.action==="create"?this.modalAction.type==="billing"?this.$t("Add new billing address"):this.$t("Add new shipping Address"):this.modalAction.type==="billing"?this.$t("Edit billing address"):this.$t("Edit shipping address")},addNewAddress(e="billing",t="create",a=[]){Object.keys(a).length>0?(this.address=JSON.parse(JSON.stringify(a)),this.shouldShowSetAsAlsoCheckbox=!1):this.address=JSON.parse(JSON.stringify(this.address_mock)),this.addOrEditAddress=!0,this.modalAction.type=e,this.modalAction.action=t,this.showAddressModal=!1},manageAddress(e="billing",t="edit"){this.showAddressModal=!0,this.modalAction.type=e,this.modalAction.action=t},fetch(){this.$emit("fetch")},recalculateLtv(){this.recalculatingLtv=!0,this.$post(`customers/${this.customer_id}/recalculate-ltv`).then(e=>{e.customer&&(this.customer.ltv=e.customer.ltv,this.customer.purchase_count=e.customer.purchase_count,this.customer.aov=e.customer.aov,this.customer.first_purchase_date=e.customer.first_purchase_date,this.customer.last_purchase_date=e.customer.last_purchase_date),this.handleSuccess(e.message)}).catch(e=>{this.handleError(e.message||this.$t("Failed to recalculate lifetime value"))}).finally(()=>{this.recalculatingLtv=!1})},handleDetachUser(){this.detaching=!0,Rest.post(`customers/${this.customer_id}/detach-user`,{user_id:this.customer.user_id}).then((e,t)=>{this.customer.user_id=0,Notify.success(e.message)}).catch(e=>{if(e.message)return Notify.error(e.message)}).finally(()=>{this.detaching=!1})}}},mp=Object.assign(iE,{setup(e){return(t,a)=>{const l=B("el-dropdown-item"),s=B("el-dropdown-menu"),i=B("el-dropdown"),c=B("el-button"),p=B("el-popconfirm"),m=B("el-tag"),_=B("el-icon"),g=B("el-dialog"),y=Va("loading");return r(),h("div",null,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[n(i,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:d(()=>[n(s,null,{default:d(()=>[n(l,{command:"edit_customer_information"},{default:d(()=>[R(f(t.$t("Edit customer information")),1)]),_:1}),n(l,{command:"manage_shipping_address"},{default:d(()=>[R(f(t.$t("Manage shipping address")),1)]),_:1}),n(l,{command:"manage_billing_address"},{default:d(()=>[R(f(t.$t("Manage billing address")),1)]),_:1}),n(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:d(()=>[R(f(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:d(()=>[o("span",b$,[n(ee,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(ke,null,{default:d(()=>{var v,C,b,w;return[o("div",w$,[o("div",C$,[o("div",B$,[o("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,k$)]),o("div",x$,[o("div",S$,f(t.customerDisplayName),1),o("span",F$,[e.customer.purchase_count>0?(r(),h("span",$$,f(A(Xt)(e.customer.purchase_count)),1)):k("",!0),R(" "+f(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",E$,f(A(ha)((C=e.customer)==null?void 0:C.ltv,!0))+" "+f(A(u)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",U$,[o("div",I$,[a[6]||(a[6]=R(" WP User: ",-1)),o("a",{href:e.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[R(" #"+f(A(Xt)(e.customer.user_id))+" ",1),n(ee,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,Q$)]),k("",!0)])):(r(),h("div",D$,[n(fp,{customer:e.customer},null,8,["customer"])]))]),o("div",V$,[o("h4",T$,f(t.$t("Contact Information")),1),o("ul",M$,[o("li",null,[o("div",L$,[o("a",{class:"text",href:"mailto:"+((b=e.customer)==null?void 0:b.email)},f((w=e.customer)==null?void 0:w.email),9,R$),n(Fa,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",O$,[o("h4",H$,[R(f(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),$(m,{key:0,type:"info",round:""},{default:d(()=>[R(f(t.$t("Default")),1)]),_:1})):k("",!0)]),(r(!0),h(O,null,ae(t.shippingAddress,(x,F)=>(r(),h(O,null,[x.is_primary==="1"?(r(),h("div",P$,[o("span",N$,[x.name?(r(),h("strong",K$,f(x.name),1)):k("",!0),o("span",{innerHTML:t.getOrderAddress(x,"shipping",!0)},null,8,G$),x.phone?(r(),h("span",j$,[o("strong",z$,f(A(u)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,q$)])):k("",!0)]),n(Fa,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):k("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",Y$,f(t.$t("No default address found.")),1)):k("",!0)]),o("div",W$,[o("h4",X$,[R(f(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),$(m,{key:0,type:"info",round:""},{default:d(()=>[R(f(t.$t("Default")),1)]),_:1})):k("",!0)]),(r(!0),h(O,null,ae(t.billingAddress,(x,F)=>(r(),h(O,null,[x.is_primary==="1"?(r(),h("div",J$,[o("span",Z$,[x.name?(r(),h("strong",eE,f(x.name),1)):k("",!0),o("span",{innerHTML:t.getOrderAddress(x,"billing",!0)},null,8,tE),x.phone?(r(),h("span",aE,[o("strong",lE,f(A(u)("Phone"))+":",1),o("a",{href:"tel:"+x.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},f(x.phone),9,sE)])):k("",!0)]),n(Fa,{text:t.getOrderAddress(x),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):k("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",nE,f(t.$t("No default address found.")),1)):k("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),$(jr,{key:0,"onUpdate:customerModal":t.fetch,customerModalInfos:t.customerModalInfos,customer_id:t.customerModalInfos.customer_id,customer:t.customerModalInfos.customer,onCloseModal:a[0]||(a[0]=v=>t.customerModalInfos.showModal=!1)},null,8,["onUpdate:customerModal","customerModalInfos","customer_id","customer"])):k("",!0),n(Fc,{modalAction:t.modalAction,onRefreshAddress:t.refresh,"onUpdate:showAddressModal":a[1]||(a[1]=v=>t.showAddressModal=v),showAddressModal:t.showAddressModal,customer_id:e.customer_id,showBusinessDetailsSection:!0,onAddNewAddress:t.addNewAddress},null,8,["modalAction","onRefreshAddress","showAddressModal","customer_id","onAddNewAddress"]),n(g,{"show-close":!0,modelValue:t.addOrEditAddress,"onUpdate:modelValue":a[4]||(a[4]=v=>t.addOrEditAddress=v),"append-to-body":!0,title:t.getTitle(),onClose:a[5]||(a[5]=()=>{t.closingModal=!0})},{default:d(()=>[o("div",oE,[n(c,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:d(()=>[n(_,null,{default:d(()=>[n(A(Xr))]),_:1}),R(" "+f(t.$t("Manage address")),1)]),_:1}),n(Sc,{"onUpdate:refreshAddress":t.refresh,customer_id:e.customer_id,modalAction:t.modalAction,address:t.address,showAddressModal:t.addOrEditAddress,showSetAsAlsoCheckbox:t.shouldShowSetAsAlsoCheckbox,showBusinessDetailsSection:!0,onCloseModal:a[3]||(a[3]=v=>t.addOrEditAddress=!1),closing_modal:t.closingModal},null,8,["onUpdate:refreshAddress","customer_id","modalAction","address","showAddressModal","showSetAsAlsoCheckbox","closing_modal"])])]),_:1},8,["modelValue","title"])])}}}),rE={class:"fct-single-customer-loader-wrap fct-layout-width"},dE={class:"single-page-header fct-page-loader-header flex items-start justify-between"},uE={class:"single-page-body"},cE={class:"fct-single-order"},AE={class:"fct-single-order-main"},pE={class:"fct-single-order-aside"},fE={class:"fct-admin-sidebar"},hp={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",rE,[o("div",dE,[n(s,{animated:"",class:"flex items-start gap-2"},{template:d(()=>[(r(),h(O,null,ae(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",uE,[o("div",cE,[o("div",AE,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",pE,[o("div",fE,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},mE={key:2},hE={key:0,class:"fct-single-customer-wrapper fct-layout-width"},_E={class:"single-page-header"},vE={class:"single-page-header-title-wrap"},gE={key:0},yE={key:0,class:"single-page-body"},bE={class:"fct-admin-sidebar"},wE={key:0},CE={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:Yr,IconButton:Xe,Empty:_t,DynamicIcon:ee,Badge:Aa,SaveBar:an,CustomerInformation:mp,Labels:Jo,DynamicTemplates:nn,ArrowDown:ei,ArrowRight:rl,CardContainer:xe,CardHeader:Ve,CardBody:ke,LicenseTable:zr,OrdersTableMobile:Wr,SubscriptionsTable:Uc,SingleCustomerLoader:hp,SubscriptionsTableMobile:Ec},data(){return{changes_made:0,notFound:{show:!1,message:"",buttonText:"",route:""},loading:!1,customer:"",selection:!1,selectedOrders:[],editableOrderStatues:this.appVars.editable_order_statues,selectedLabels:[],licenses:[],subscriptions:[],customerOrders:[],paginate:{current_page:1,per_page:10,last_page:1,total:0,from:1,to:10},fetchingOrders:!1,search:"",showSearch:!1}},watch:{customer_id:{handler(e,t){this.fetch()}}},computed:{},methods:{getProductName(e){var t,a;return(t=e==null?void 0:e.product)!=null&&t.post_title?(a=e==null?void 0:e.product)==null?void 0:a.post_title:"n/a"},getProductVariationName(e){var t,a;return(t=e==null?void 0:e.product_variant)!=null&&t.variation_title?(a=e==null?void 0:e.product_variant)==null?void 0:a.variation_title:"n/a"},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},update(){this.loading=!0,ce.put("customers/"+this.customer_id+"/additional-info",{labels:this.selectedLabels}).then(e=>{z.success(e)}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},discardChanges(){return window.location.reload()},fetch(){this.notFound.show=!1,this.loading=!0,this.selectedOrders=[],ce.get("customers/"+this.customer_id,{with:["shipping_address","billing_address","labels","subscriptions"]}).then(e=>{this.changeTitle(u("Customer: %s",e.customer.full_name)),this.customer=e.customer,this.selectedLabels=e.customer.selected_labels,this.licenses=this.customer.licenses,this.subscriptions=this.customer.subscriptions}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=rt.get(e,"data.buttonText"),this.notFound.message=rt.get(e,"data.message"),this.notFound.route=rt.get(e,"data.route")):e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getCustomerOrders(){this.fetchingOrders=!0,ce.get("customers/"+this.customer_id+"/orders",{per_page:this.paginate.per_page,page:this.paginate.current_page,with:["order_items"],search:this.search,order_by:"id",order_type:"DESC"}).then(e=>{this.customerOrders=e.orders,this.paginate.total=e.orders.total,this.paginate.per_page=e.orders.per_page,this.paginate.current_page=e.orders.current_page,this.paginate.last_page=e.orders.last_page,this.paginate.from=e.orders.from,this.paginate.to=e.orders.to}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.fetchingOrders=!1})},onSelection(e){this.selection=!!e.length,this.selectedOrders=e,this.selectionCount=e.length},exportOrders(){location.href=window.ajaxurl+"?"+jQuery.param({action:"fluent_cart_admin_ajax",route:"export_orders",customer_id:this.customer_id,search:this.search,format:"csv"})}},mounted(){this.fetch(),this.getCustomerOrders()}},BE=Object.assign(CE,{setup(e){return(t,a)=>{const l=B("el-breadcrumb-item"),s=B("el-breadcrumb"),i=B("el-input"),c=B("el-col"),p=B("el-row");return r(),h(O,null,[t.loading?(r(),$(hp,{key:0})):k("",!0),t.notFound.show?(r(),$(ai,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):k("",!0),t.notFound.show===!1?(r(),h("div",mE,[t.loading?k("",!0):(r(),h("div",hE,[n(an,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",_E,[o("div",vE,[n(s,{"separator-icon":A(rl)},{default:d(()=>[n(l,{to:{name:"customers"}},{default:d(()=>[R(f(A(u)("Customers")),1)]),_:1}),n(l,null,{default:d(()=>[t.customer?(r(),h("span",gE,f(t.customer.full_name),1)):k("",!0)]),_:1}),n(l,null,{default:d(()=>[R(f(A(u)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",yE,[n(p,{gutter:30},{default:d(()=>[n(c,{lg:17,xs:24},{default:d(()=>[n(A(xe),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[n(A(Ve),{title:A(u)("Orders (%s)",A(Xt)(t.customerOrders.total||0)),title_size:"small"},{action:d(()=>[n(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=m=>t.search=m),onKeyup:a[1]||(a[1]=$a(m=>t.getCustomerOrders(),["enter"])),placeholder:A(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=m=>t.getCustomerOrders()),class:de(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),n(Xe,{tag:"button",size:"small",onClick:a[3]||(a[3]=m=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:d(()=>[t.showSearch?(r(),$(ee,{key:0,name:"Cross"})):(r(),$(ee,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[t.fetchingOrders?(r(),$(v$,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(O,{key:1},[n(Yr,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(Wr,{class:"show-on-mobile",orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["orders"])],64)),t.paginate.total>10?(r(),$(xc,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):k("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),$(A(xe),{key:0,class:"overflow-hidden"},{default:d(()=>[n(A(Ve),{title:A(u)("Subscriptions")+" ("+A(Xt)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[n(Uc,{class:"hide-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"]),n(Ec,{class:"show-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"])]),_:1})]),_:1})):k("",!0),t.customer.licenses?(r(),$(A(xe),{key:1,class:"overflow-hidden"},{default:d(()=>[n(A(Ve),{title:A(u)("Licenses")+" ("+A(Xt)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),n(A(ke),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:d(()=>[n(zr,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):k("",!0)]),_:1}),n(c,{lg:7,xs:24},{default:d(()=>[o("div",bE,[n(mp,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(Jo,{"bind-to-id":t.customer.id,"bind-to-type":"Customer",selectedLabels:t.selectedLabels,shouldEnableEditing:!0},null,8,["bind-to-id","selectedLabels"]),t.customer?(r(),h("div",wE,[n(nn,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):k("",!0)])]),_:1})]),_:1})])):k("",!0)]))])):k("",!0)],64)}}}),kE={components:{BundleProducts:So,Empty:_t,Pagination:xc,Badge:Aa,DynamicIcon:ee},props:["searchQueryParent","orderParent","order_id"],data(){return{loading:!1,searching:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],cartItems:[],paginate:{per_page:10,current_page:1,total:0,last_page:1},collapsedStates:null}},computed:{CurrencyFormatter(){return Je},Asset(){return cs},order:{get(){return this.orderParent},set(e){this.$emit("update:order",e)}},searchQuery:{get(){return this.searchQueryParent},set(e){this.$emit("update:searchQuery",e)}}},created(){this.initializeCollapsedStates()},methods:{translate:u,translateNumber:Xt,initializeCollapsedStates(){this.collapsedStates=Array.from({length:this.availableProducts.length},()=>!1)},handleToggleCollapse(e){this.collapsedStates[e]=!this.collapsedStates[e];for(let t=0;t<this.collapsedStates.length;t++)t!==e&&(this.collapsedStates[t]=!1)},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.other_info.payment_type&&l.other_info.payment_type===t)).length>0},validateShouldAddProduct(e){var i;const t=this.order.order_items.map(c=>c.object_id),a=this.selectedProducts.map(c=>c.object_id),l=((i=e==null?void 0:e.other_info)==null?void 0:i.payment_type)==="onetime"?"subscription":"onetime",s=this.order.order_items.length===0;if(s&&this.selectedProducts.length===0)return!0;if(s&&a.includes(e.object_id))return!0;if(!s&&t.includes(e.object_id))return!0;if(s&&!this.hasSubscriptionProduct(this.selectedProducts,l)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!s&&!this.hasSubscriptionProduct(this.order.order_items,l)&&!this.hasSubscriptionProduct(this.order.order_items,"subscription"))return!0;return!1},handleCheckboxChange(e,t){if(t.checked)if(this.validateShouldAddProduct(t))this.selectedProducts.push(t);else return t.checked=!1,z.error(u("You can purchase one subscription at a time."));else{const a=this.selectedProducts.findIndex(l=>l.id===t.id);if(a!==-1)return this.selectedProducts.splice(a,1)}},onCurrentPageChanged({page:e,currentPageCount:t}){this.paginate.current_page=e,this.doSearch()},onPerPageChanged(e){this.paginate.per_page=e,this.doSearch()},isAlreadyAdded(e){return this.order.order_items?this.order.order_items.some(t=>parseInt(t.object_id)===parseInt(e)):!1},isNotParentVariant(e){return!e.children||e.children.length<1},handleSelectionChanges(e){this.selectedProducts=e},processProducts(){let e={};this.order.order_items&&this.order.order_items.length&&this.order.order_items.forEach((a,l)=>{e[a.object_id]=a}),this.selectedProducts&&this.selectedProducts.forEach((a,l)=>{e[a.object_id]?e[a.object_id].quantity++:(a.tax_amount=parseInt(a.tax_amount)||0,a.shipping_charge=parseInt(a.shipping_charge)||0,a.discount_total=parseInt(a.discount_total)||0,a.quantity=parseInt(a.quantity)||1,e[a.object_id]=a),e[a.object_id].updated_stock=parseInt(a.available),e[a.object_id].total=parseInt(e[a.object_id].price)*parseInt(e[a.object_id].quantity),e[a.object_id].line_total=parseInt(e[a.object_id].total)-parseInt(e[a.object_id].discount_total)+parseInt(e[a.object_id].tax_amount)}),this.order.order_items=[];let t=0;for(const a in e)if(this.order.order_items.push(e[a]),t+=parseInt(e[a].line_total),e[a].payment_type==="subscription"&&e[a].other_info.manage_setup_fee==="yes"){let l=parseInt(e[a].other_info.signup_fee);e[a].other_info.setup_fee_per_item==="yes"&&(l=l*e[a].quantity),t+=l}return this.order.subtotal=t,this.order.total_amount=t+parseInt(this.order.tax_total)+parseInt(this.order.shipping_total)-parseInt(this.order.manual_discount_total),this.orderAddModal=!1,this.searchQuery="",this.selectedProducts=[],!0},fetchBySearch(){this.loading=!0,this.searching=!0,this.orderAddModal=!0;let e=this;Se(()=>{setTimeout(()=>{e.$refs.fc_product_search_new.ref.focus()},50)}),clearTimeout(this.timeout);const t=this;this.timeout=setTimeout(function(){t.doSearch()},700)},doSearch(){this.loading=!0;let e={active_view:"publish",per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.searchQuery,filter_type:"simple",sort_by:"ID",with:["detail.variants.media","detail.variants.bundleChildren","categories"]};ce.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=tm(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return em(e)}}},xE={class:"fluent-cart-admin-pages"},SE={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},FE={class:"px-5"},$E={class:"fc_product_search_table",ref:"fc_product_search_table"},EE={class:"fct-collapsible-list"},UE={class:"fct-collapsible-list-item-inner"},IE={class:"fct-collapsible-item"},QE={class:"fct-collapsible-content-wrapper"},DE=["onClick"],VE={key:1,class:"content-indent"},TE={class:"content-checkbox"},ME={class:"content-img"},LE=["src","alt"],RE={class:"content-title"},OE={class:"title"},HE={key:0,class:"text-gray-500 dark:text-gray-400"},PE={key:1,class:"text"},NE={key:0,class:"fct-collapsible-stock-wrapper"},KE={key:0},GE={key:1,class:"text-red-500"},jE={class:"fct-collapsible-value-wrapper"},zE={key:0},qE={key:1},YE={class:"fct-collapsible-item-child-inner"},WE={class:"fct-collapsible-item"},XE={class:"fct-collapsible-content-wrapper"},JE={class:"fct-collapsible-content-group"},ZE={class:"content-checkbox"},eU={class:"content-img"},tU=["src","alt"],aU={class:"content-title"},lU={class:"title"},sU={key:0,class:"text"},nU={key:0},oU={key:1,class:"text already-added"},iU={class:"fct-collapsible-stock-wrapper"},rU={key:0},dU={key:1,class:"text-red-500"},uU={class:"fct-collapsible-value-wrapper"},cU={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},AU={class:"dialog-footer"};function pU(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-input"),m=B("el-skeleton"),_=B("el-checkbox"),g=B("BundleProducts"),y=B("Empty"),v=B("Pagination"),C=B("el-button"),b=B("el-dialog");return r(),h("div",xE,[n(b,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=w=>i.searchQuery=""),modelValue:s.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=w=>s.orderAddModal=w),title:e.$t("Add Items")},{default:d(()=>[o("div",SE,[o("div",FE,[n(p,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=w=>i.fetchBySearch()),modelValue:i.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=w=>i.searchQuery=w),clearable:""},{prefix:d(()=>[n(c,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",$E,[n(m,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?k("",!0):(r(),h(O,{key:0},[o("ul",EE,[(r(!0),h(O,null,ae(s.availableProducts,(w,x)=>{var F,L,U,S,M,I,T,Q,E;return r(),h("li",{class:"fct-collapsible-list-item",key:x},[o("div",UE,[o("div",IE,[o("div",QE,[((F=w==null?void 0:w.children)==null?void 0:F.length)>0?(r(),h("div",{key:0,class:de(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[x]}]),onClick:D=>i.handleToggleCollapse(x)},[n(c,{name:"CaretRight"})],10,DE)):k("",!0),!((L=w==null?void 0:w.children)!=null&&L.length)>0?(r(),h("div",VE)):k("",!0),o("div",TE,[n(_,{modelValue:w.checked,"onUpdate:modelValue":D=>w.checked=D,onChange:D=>i.handleCheckboxChange(x,w),disabled:w.disable===!0||i.isAlreadyAdded(w.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",ME,[o("img",{src:w.featured_media!=null?w.featured_media:i.Asset.getUrl("images/placeholder-small.svg"),alt:w.title},null,8,LE)]),o("div",RE,[o("div",OE,f(w.post_title),1),((U=w==null?void 0:w.other_info)==null?void 0:U.payment_type)==="subscription"&&((S=w.other_info)==null?void 0:S.billing_summary)!==""?(r(),h("small",HE,f((M=w.other_info)==null?void 0:M.billing_summary),1)):k("",!0),i.isAlreadyAdded(w.object_id)?(r(),h("div",PE,f(e.$t("Item already added")),1)):k("",!0)])]),((I=w==null?void 0:w.children)==null?void 0:I.length)==0?(r(),h("div",NE,[w.stockStatus=="in-stock"?(r(),h("span",KE,f(w.available!==1/0?w.available+i.translate(" Available"):i.translate("Unlimited")),1)):k("",!0),w.stockStatus==="out-of-stock"?(r(),h("span",GE,f(i.formatCapitalized(w.stockStatus)),1)):k("",!0)])):k("",!0),o("div",jE,[((T=w==null?void 0:w.children)==null?void 0:T.length)>0?(r(),h("span",zE,f(w.min_price!=w.max_price?e.formatNumber(w.min_price)+" - "+e.formatNumber(w.max_price):e.formatNumber(w.min_price)),1)):(r(),h("span",qE,f(e.formatNumber(w.price)),1))])]),((Q=w==null?void 0:w.children)==null?void 0:Q.length)>0?(r(),h("div",{key:0,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},null,2)):k("",!0),((E=w==null?void 0:w.children)==null?void 0:E.length)>0?(r(),h("div",{key:1,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[x]}])},[o("ul",YE,[(r(!0),h(O,null,ae(w.children,(D,H)=>{var P,G,J,oe,Z;return r(),h("li",{key:H},[o("div",WE,[o("div",XE,[o("div",JE,[o("div",ZE,[n(_,{modelValue:D.checked,"onUpdate:modelValue":W=>D.checked=W,onChange:W=>i.handleCheckboxChange(H,D),disabled:D.disable===!0||i.isAlreadyAdded(D.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",eU,[o("img",{src:D.featured_media!=null?D.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:D.title},null,8,tU)])]),o("div",aU,[o("div",lU,f(D.title),1),((P=D==null?void 0:D.other_info)==null?void 0:P.payment_type)==="subscription"&&((G=D.other_info)==null?void 0:G.billing_summary)!==""?(r(),h("small",sU,[R(f(i.CurrencyFormatter.currencySign)+" "+f((J=D.other_info)==null?void 0:J.billing_summary)+" ",1),((oe=D.other_info)==null?void 0:oe.trial_days)>0?(r(),h("span",nU,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+f(i.translate("Trial Days"))+": "+f((Z=D.other_info)==null?void 0:Z.trial_days),1)])):k("",!0)])):k("",!0),i.isAlreadyAdded(D.object_id)?(r(),h("div",oU,f(i.translate("Item already added")),1)):k("",!0),D.bundle_items.length>0?(r(),$(g,{key:2,product:D,"title-key":"variation_title"},null,8,["product"])):k("",!0)])]),o("div",iU,[D.stockStatus=="in-stock"?(r(),h("span",rU,f(D.available!==1/0?i.translateNumber(D.available)+i.translate(" Available"):i.translate("Unlimited")),1)):k("",!0),D.stockStatus=="out-of-stock"?(r(),h("span",dU,f(i.formatCapitalized(D.stockStatus)),1)):k("",!0)]),o("div",uU,f(e.formatNumber(D.price)),1)])])}),128))])],2)):k("",!0)])])}),128))]),s.availableProducts.length===0?(r(),$(y,{key:0,icon:"Empty/ListView",text:i.translate("We could't find any products matching your search.")},null,8,["text"])):k("",!0)],64))],512),o("div",cU,[n(v,{pagerSizes:!1,hide_on_single:!1,pagination:s.paginate,onFetch:i.doSearch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),o("div",AU,[n(C,{onClick:t[2]||(t[2]=w=>s.orderAddModal=!1)},{default:d(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(C,{disabled:!s.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:d(()=>[R(f(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const _p=lt(kE,[["render",pU]]),Qn=(e,t=null)=>{if(!e)return"";const a=Array.isArray(e.attr_map)?e.attr_map:[];if(a.length){const l=Array.isArray(t)?t.map(p=>parseInt(p,10)):null,s=p=>{const m=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(m);return _===-1?Number.MAX_SAFE_INTEGER:_}return m||0},c=[...a].sort((p,m)=>s(p)-s(m)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(c.length)return c.join(" / ")}return e.variation_title||""},Oo=e=>{var a,l;const t=(l=(a=e==null?void 0:e.detail)==null?void 0:a.other_info)==null?void 0:l.attribute_config;return Array.isArray(t)?t.map(s=>parseInt(s&&s.group_id,10)).filter(s=>!Number.isNaN(s)):null},fU={key:0,class:"fct-downloadable-variation-selector"},mU={class:"price-info"},hU={key:0},Ho={__name:"VariationSelector",props:{variant:{type:Object,required:!0},groupOrder:{type:Array,default:null}},setup(e){return(t,a)=>{var l;return e.variant?(r(),h("div",fU,[o("span",null,f(A(Qn)(e.variant,e.groupOrder)),1),o("span",mU,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",hU,f(A(oa).capitalize(e.variant.other_info.repeat_interval)),1)):k("",!0),o("span",null,f(A(ha)(e.variant.item_price*100,!0)),1)])])):k("",!0)}}},_U={name:"Refund",components:{Badge:Aa,VariationSelector:Ho,DynamicIcon:ee},props:["order_id","order","is_subscription","subscription_status","showRefundModal"],data(){return{transactions:{},maxRefundAmount:"",refundProcessing:!1,refundableTransactions:[],isShippingRefundable:!1,refund:{item_ids:[],transaction_id:"",amount:0,cancelSubscription:!0,reason:"",availableAmount:"",paymentMethod:"",manageStock:!1},totalPaid:0,refundNote:""}},computed:{CurrencyFormatter(){return Je},orderCurrencySign(){const e=ze.get("currency_signs",{}),t=ze.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},isAnyProductManageStock(){var e;for(const t of this.order.order_items)if(t!=null&&t.variants&&((e=t==null?void 0:t.variants)==null?void 0:e.manage_stock)==="1")return!0;return!1},isSubscriptionCancelable(){return this.is_subscription&&this.subscription_status!=="canceled"&&this.subscription_status!=="expired"},checkMaxRefundAmount(){this.refund.amount>this.maxRefundAmount&&(this.refund.amount=this.maxRefundAmount)},refundTableItems(){let e=[];return!this.refund.item_ids||this.refund.item_ids.length===0?e=this.order.order_items.filter(t=>t.payment_type!=="signup_fee"):e=this.order.order_items.filter(t=>this.refund.item_ids.includes(t.id)&&t.payment_type!=="signup_fee"),e.map(t=>({...t,restore_quantity:t.restore_quantity||0,refund_quantity:Number(t.refund_total)||0}))}},watch:{showRefundModal(e){this.refundNote=""},"order.order_items":{immediate:!0,handler(e){const t=e.filter(a=>Number(a.line_total)-Number(a.refund_total)>0);t.length===1?this.refund.item_ids=[t[0].id]:this.refund.item_ids=[]}}},mounted(){var e,t,a;this.refund.availableAmount=parseInt((e=this==null?void 0:this.order)==null?void 0:e.total_paid)-parseInt((t=this==null?void 0:this.order)==null?void 0:t.total_refund),this.transactions=(a=this.order)==null?void 0:a.transactions,this.transactions.length&&this.updateRefundable()},methods:{translate:u,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},updateMaxRefund(){const e=this.refund.transaction_id;let t=this.refundableTransactions.find(s=>s.id===e);this.refund.amount=t.refundable?parseFloat(t.refundable/100):0,this.refund.paymentMethod=t.payment_method;const a=rt.whereIn(this.order.order_items,"id",this.refund.item_ids),l=a.reduce((s,i)=>s+(i.line_total-i.refund_total)/100,0);this.refund.amount>l&&a.length>0&&(this.refund.amount=l),this.maxRefundAmount=this.refund.amount},updateRefundable(){this.refundableTransactions=this.transactions.filter(e=>e.status==="succeeded").map(e=>{var t;return{...e,refundable:e.total-(parseInt((t=e.meta)==null?void 0:t.refunded_total)||0)}}),this.refundableTransactions.length!==0&&(this.refund.transaction_id=this.refundableTransactions[0].id,this.refund.payment_method=this.refundableTransactions[0].payment_method,this.updateMaxRefund(this.refund.transaction_id))},processRefund(){if(this.refundProcessing=!0,!this.refund.amount)return this.refundProcessing=!1,this.handleMessage("Please add refund amount.","error");if(this.refund.amount>this.refund.availableAmount)return this.refundProcessing=!1,this.handleMessage(`Refund amount should not exceed: ${this.appVars.shop.currency_sign}${this.refund.availableAmount}`,"error");const e=this.refundTableItems.filter(t=>t.restore_quantity>0).map(t=>({id:t.id,variation_id:t.object_id,quantity:t.quantity,restore_quantity:t.restore_quantity}));this.refund.refunded_items=e,this.$post("orders/"+this.order_id+"/refund",{refund_info:this.refund,refunded_items:e}).then(t=>{this.refundNote=t}).catch(t=>{this.handleError(t)}).finally(()=>{this.updateRefundable(),this.refundProcessing=!1})}}},vU={key:0,class:"fct-refund-note-list"},gU={class:"message"},yU={key:1},bU={class:"refund-item-info"},wU={class:"right"},CU={class:"price"},BU={class:"price light"},kU={class:"form-note"},xU={style:{color:"#F04438","font-weight":"500"}},SU={class:"form-note form-note-tooltip"},FU={class:"dialog-footer is-border"},$U={key:0};function EU(e,t,a,l,s,i){const c=B("Badge"),p=B("el-option"),m=B("el-select"),_=B("el-form-item"),g=B("el-input"),y=B("el-checkbox"),v=B("el-col"),C=B("el-table-column"),b=B("el-input-number"),w=B("el-table"),x=B("DynamicIcon"),F=B("el-tooltip"),L=B("el-row"),U=B("el-form"),S=B("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",vU,[(r(!0),h(O,null,ae(s.refundNote,(M,I)=>(r(),h("div",{key:I,class:"fct-refund-note-item"},[o("span",gU,f(M.message),1),n(c,{status:M.status},null,8,["status"])]))),128))])):(r(),h("div",yU,[n(U,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(L,{gutter:10},{default:d(()=>[n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund with transaction"),required:""},{default:d(()=>[n(m,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=M=>s.refund.transaction_id=M),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(O,null,ae(s.refundableTransactions,M=>(r(),$(p,{key:M.id,label:i.translate("#%1$s - Paid %2$s",M.id,i.formatNumber(M.refundable,!0)),value:M.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:d(()=>[n(m,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=M=>s.refund.item_ids=M),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(O,null,ae(a.order.order_items,M=>(r(),$(p,{key:M.id,value:M.id,label:M.post_title+" - "+(M.variation_display_title||M.title)+" "+i.formatNumber(M.line_total-M.refund_total),class:"refund-item",disabled:Number(M.line_total)-Number(M.refund_total)<=0},{default:d(()=>[o("div",bU,[o("p",null,[R(f(M.post_title)+" ",1),o("span",null,"-"+f(M.variation_display_title||M.title),1)]),o("div",wU,[o("span",CU,f(i.translate("Refundable: %1$s",i.formatNumber(M.line_total-M.refund_total))),1),o("span",BU,f(i.translate("Item price: %1$s",i.formatNumber(M.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund amount"),required:""},{default:d(()=>[n(g,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=M=>s.refund.amount=M),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:d(()=>[R(f(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",kU,[o("p",null,[R(f(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",xU,f(i.formatNumber(s.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),i.isSubscriptionCancelable?(r(),$(v,{key:0,lg:24},{default:d(()=>[n(_,{label:e.$t("Subscription")},{default:d(()=>[n(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=M=>s.refund.cancelSubscription=M)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):k("",!0),i.isAnyProductManageStock?(r(),$(v,{key:1,lg:24},{default:d(()=>[n(_,null,{default:d(()=>[n(y,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=M=>s.refund.manageStock=M)},{default:d(()=>[R(f(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):k("",!0),s.refund.manageStock?(r(),$(v,{key:2,lg:24},{default:d(()=>[n(w,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:d(()=>[n(C,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:M})=>[o("span",null,f(M.post_title)+" - "+f(M.title),1)]),_:1},8,["label"]),n(C,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:M})=>[o("span",null,f(M.quantity),1)]),_:1},8,["label"]),n(C,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:M})=>[n(b,{modelValue:M.restore_quantity,"onUpdate:modelValue":I=>M.restore_quantity=I,min:0,max:M.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):k("",!0),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Reason of refund")},{default:d(()=>[n(g,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=M=>s.refund.reason=M)},null,8,["modelValue"]),o("div",SU,[o("p",null,[R(f(i.translate("Your customers can see this reason"))+" ",1),o("span",null,[n(F,{"popper-class":"fct-tooltip",placement:"top",content:i.translate("If set, possible values are duplicate fraudulent, and requested_by_customer If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists")},{default:d(()=>[n(x,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",FU,[n(S,{type:"primary",onClick:Ne(i.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:d(()=>[R(f(s.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),s.refund.amount?(r(),h("span",$U)):k("",!0),R(f(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const UU=lt(_U,[["render",EU]]),IU={class:"fct-number-input"},QU=["disabled","min","max"],DU={class:"fct-number-input-buttons"},VU=["disabled"],TU=["disabled"],MU={style:{color:"red"}},vp={__name:"NumberInput",props:{min:{type:Number,default:1},max:{type:Number,default:999999},item:{type:Object,default:()=>({})},isDisabled:{type:Boolean,default:!1}},setup(e,{emit:t}){var F,L,U,S,M;const a=t,l=e,s=V(""),i=()=>{var I,T,Q,E;return(((I=l.item)==null?void 0:I.manage_stock)||((E=(Q=(T=l.item)==null?void 0:T.variants)==null?void 0:Q.product_detail)==null?void 0:E.manage_stock))==1},c=V(((F=l.item)==null?void 0:F.quantity)||l.min),p=V(c.value),m=V(i()?((L=l.item)==null?void 0:L.available)||((S=(U=l.item)==null?void 0:U.variants)==null?void 0:S.available):l.max),_=V(i()?(M=l.item)==null?void 0:M.updated_stock:l.max);zt().ctx;const g=K(()=>p.value<=l.min),y=K(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(c.value++,p.value=c.value,a("update:value",c.value,_.value,l.item))},C=()=>{s.value="",p.value>l.min&&(c.value--,p.value=c.value,a("update:value",c.value,_.value,l.item))},b=(I,T)=>{s.value="",p.value=parseInt(p.value),(isNaN(p.value)||p.value==="")&&(c.value=1),p.value<l.min?(c.value=l.min,p.value=c.value):p.value>l.max?(c.value=l.min,p.value=c.value,s.value=u("Unable to adjust quantity")):p.value>_.value?(c.value=_.value,p.value=c.value,s.value=u("Available: %s in stock",_.value)):p.value>=l.min&&(p.value===_.value||p.value<_.value)&&(c.value=p.value,p.value=c.value),a("update:value",c.value,_.value,l.item)},w=I=>{I.key==="ArrowDown"&&p.value<=l.min&&I.preventDefault()},x=()=>{var I,T,Q,E,D;s.value="",c.value=((I=l.item)==null?void 0:I.quantity)||l.min,p.value=c.value,m.value=i()?((T=l.item)==null?void 0:T.available)||((E=(Q=l.item)==null?void 0:Q.variants)==null?void 0:E.available):l.max,_.value=i()?(D=l.item)==null?void 0:D.updated_stock:l.max};return Ss(()=>{x()}),Ce(()=>l.item,I=>{x()},{deep:!0}),(I,T)=>(r(),h(O,null,[o("div",IU,[jt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":T[0]||(T[0]=Q=>p.value=Q),type:"number",onInput:T[1]||(T[1]=Q=>{b()}),min:e.min,max:e.max,onKeydown:w},null,40,QU),[[hf,p.value,void 0,{number:!0}]]),o("div",DU,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(ee,{name:"ChevronUp"})],8,VU),o("button",{onClick:C,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(ee,{name:"ChevronDown"})],8,TU)])]),o("span",MU,f(s.value),1)],64))}},LU={name:"PaymentLink",components:{IconButton:Xe,DynamicIcon:ee,CopyToClipboard:Fa,InfoFilled:nl},props:["order","order_id"],data(){return{fetchLink:!1,selectedMethod:"stripe",business_email:"",buyer_email:"",selectedTransaction:"0",use_vendor_checkout:!1,vendor_url:null,transactionIds:[],actionName:"copy",paymentUrl:"",paymentMethods:[{value:"stripe",label:"Stripe"},{value:"paypal",label:"PayPal"}]}},computed:{DynamicIcon(){return ee},adminUrl(){return ze.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:u,updatePaymentLink(e){e?this.searchOldUrl():this.paymentUrl=this.order.custom_checkout_url},getPaymentLink(){this.fetchLink=!0,this.$get("orders/"+this.order_id+"/transactions/get_payment_link",{data:{method:this.selectedMethod,transaction:0,use_vendor_checkout:this.use_vendor_checkout,business_email:this.business_email,buyer_email:this.buyer_email}}).then(e=>{var t,a;this.vendor_url=(t=e==null?void 0:e.data)==null?void 0:t.redirect_to,this.paymentUrl=(a=e==null?void 0:e.data)==null?void 0:a.redirect_to,this.fetchLink=!1}).catch(e=>{this.handleError(e),this.fetchLink=!1,this.$emit("reload")})},makeSelectableId(){this.transactionIds=[],this.order.transactions.forEach(e=>{e.status!=="paid"&&this.transactionIds.push({label:e.id,value:e.id})})},searchOldUrl(){var t,a;this.selectedTransaction=this.transactionIds[this.transactionIds.length-1].value;const e=this.order.transactions.filter(l=>l.id==this.selectedTransaction&&l.payment_method==this.selectedMethod);this.paymentUrl=(a=(t=e[0])==null?void 0:t.meta)==null?void 0:a.payment_link},generatePaymentUrl(){this.paymentUrl=this.order.custom_checkout_url}}},RU=["element-loading-text"],OU={class:"fct-payment-link-block"},HU={key:1,class:"fct-payment-link-block"};function PU(e,t,a,l,s,i){const c=B("CopyToClipboard"),p=B("el-button"),m=B("el-input"),_=B("el-form-item"),g=B("el-col"),y=B("el-row"),v=Va("loading");return jt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",OU,[s.paymentUrl?(r(),$(c,{key:0,text:s.paymentUrl,tooltipText:i.translate("Copy Link"),placeholder:i.translate("No payment link available,Please setup custom checkout page!")},null,8,["text","tooltipText","placeholder"])):(r(),$(p,{key:1,target:"_blank",link:"",tag:"router-link",to:{name:"pages_setup"}},{default:d(()=>[R(f(i.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),s.selectedMethod==="paypal"&&s.use_vendor_checkout?(r(),$(y,{key:0,class:"el-form--label-top",gutter:20},{default:d(()=>[n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Business/Seller Email")},{default:d(()=>[n(m,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=C=>s.business_email=C),placeholder:i.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:d(()=>[n(m,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=C=>s.buyer_email=C),placeholder:i.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):k("",!0),s.use_vendor_checkout?(r(),h("div",HU,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:d(()=>[R(f(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):k("",!0)],8,RU)),[[v,s.fetchLink]])}const NU=lt(LU,[["render",PU]]),KU={class:"fct-single-order-loader-wrap fct-layout-width"},GU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},jU={class:"single-page-body"},zU={class:"fct-single-order"},qU={class:"fct-single-order-main"},YU={class:"fct-single-order-aside"},WU={class:"fct-admin-sidebar"},XU={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",KU,[o("div",GU,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-180"},{template:d(()=>[n(l,{class:"w-1/4"}),n(l,{class:"w-3/4"})]),_:1})]),o("div",jU,[o("div",zU,[o("div",qU,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",YU,[o("div",WU,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},JU={name:"_Plans.vue",components:{Badge:Aa},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:u}},ZU={class:"fct-subscription-plan-wrap"},e5={class:"fct-subs-status-wrap float-end"},t5={class:"fct-subs-title underline"},a5=["innerHTML"],l5={key:0,class:"cursor-pointer"};function s5(e,t,a,l,s,i){var m,_,g,y;const c=B("Badge"),p=B("router-link");return r(),h("div",ZU,[o("div",e5,[n(c,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(m=a.subscription)==null?void 0:m.id}}},{default:d(()=>{var v;return[o("p",t5,f(e.$t((v=a.subscription)==null?void 0:v.item_name)),1)]}),_:1},8,["to"]),o("p",{innerHTML:(_=a.subscription)==null?void 0:_.payment_info},null,8,a5),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",l5,[R(f(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var C;return a.getOrderUrl((C=a.order)==null?void 0:C.parent_id)})},"#"+f((y=a.order)==null?void 0:y.parent_id),1)])):k("",!0)])}const gp=lt(JU,[["render",s5]]),n5={name:"SubscriptionPlanItem",components:{CardContainer:xe,CardHeader:Ve,CardBody:ke,Plans:gp,Refresh:Jr,Delete:gs,DynamicIcon:ee,CancelSubscription:Sf},props:["subscription","order","orderId","index","getOrderUrl"],emits:["reload","fetchOrder","cancelSubscription"],data(){return{loadingState:{pause:!1,resume:!1,cancel:!1,fetch:!1,reactivate:!1},cancelSubscriptionModal:!1,cancelReason:""}},computed:{permissions(){var a,l;const e=(((a=this.subscription)==null?void 0:a.status)||"").toLowerCase();return{canFetch:!0,canPause:!1,canResume:!1,canCancel:((l=this.subscription)==null?void 0:l.vendor_subscription_id)&&!["canceled"].includes(e)}},paymentMethod(){var e;return((e=this.order)==null?void 0:e.payment_method)||""}},methods:{handleSubscriptionAction(e){e==="fetch_subscription"?this.confirmFetch():e==="pause_subscription"?this.confirmPause():e==="resume_subscription"?this.confirmResume():e==="cancel_subscription"&&this.confirmCancel()},confirmFetch(){var e;!this.subscription.vendor_subscription_id&&((e=this.order)==null?void 0:e.payment_method)!=="offline_payment"||Ja.confirm("Fetch from remote and update the subscription?","Warning",{type:"warning",icon:Gs(gs),cancelButtonText:"Back",confirmButtonText:"Fetch subscription!",beforeClose:async(t,a,l)=>{var s,i;if(t==="confirm")try{a.confirmButtonLoading=!0,this.loadingState.fetch=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/fetch`,{data:{vendor_charge_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription fetched successfully"}),this.$emit("reload")}catch(c){this.$notify({type:"error",title:"Error",message:u(((i=(s=c.response)==null?void 0:s.data)==null?void 0:i.message)||"Failed to fetch subscription")})}finally{a.confirmButtonLoading=!1,this.loadingState.fetch=!1,l()}else l()}})},confirmPause(){this.subscription.vendor_subscription_id&&Ja.prompt("Pause the active subscription?","Warning",{type:"warning",icon:Gs(gs),inputPlaceholder:"Enter reason for pausing",inputPattern:/.+/,inputErrorMessage:"Reason is required",cancelButtonText:"Back",confirmButtonText:"Pause Subscription!",beforeClose:async(e,t,a)=>{var l,s;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.pause=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/pause`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription paused successfully"}),this.$emit("reload")}catch(i){this.$notify({type:"error",title:"Error",message:u(((s=(l=i.response)==null?void 0:l.data)==null?void 0:s.message)||"Failed to pause subscription")})}finally{t.confirmButtonLoading=!1,this.loadingState.pause=!1,a()}else a()}})},confirmResume(){this.subscription.vendor_subscription_id&&Ja.prompt(u("Resume the paused subscription?"),u("Warning"),{type:"warning",icon:Gs(gs),inputPlaceholder:u("Enter reason for resuming"),inputPattern:/.+/,inputErrorMessage:u("Reason is required"),cancelButtonText:u("Back"),confirmButtonText:u("Resume Subscription!"),beforeClose:async(e,t,a)=>{if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.resume=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/resume`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id,reason:t.inputValue}}),this.$notify({type:"success",title:"Success",message:"Subscription resumed successfully"}),this.$emit("reload")}catch{this.$notify({type:"error",title:"Error",message:"Failed to resume subscription"})}finally{t.confirmButtonLoading=!1,this.loadingState.resume=!1,a()}else a()}})},confirmCancel(){this.subscription.vendor_subscription_id&&(this.cancelSubscriptionModal=!0)},confirmReactivate(){this.subscription.vendor_subscription_id&&Ja.confirm("Reactivate the canceled subscription?","Warning",{type:"warning",icon:Gs(gs),cancelButtonText:"Back",confirmButtonText:u("Reactivate Subscription!"),beforeClose:async(e,t,a)=>{var l,s;if(e==="confirm")try{t.confirmButtonLoading=!0,this.loadingState.reactivate=!0,await this.$put(`orders/${this.orderId}/subscriptions/${this.subscription.id}/reactivate`,{data:{vendor_subscription_id:this.subscription.vendor_subscription_id}}),this.$notify({type:"success",title:"Success",message:"Subscription reactivated successfully"}),this.$emit("reload")}catch(i){this.$notify({type:"error",title:"Error",message:u(((s=(l=i.response)==null?void 0:l.data)==null?void 0:s.message)||"Failed to reactivate subscription")})}finally{t.confirmButtonLoading=!1,this.loadingState.reactivate=!1,a()}else a()}})}}},o5={class:"more-btn"},i5={class:"text-red-600"};function r5(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("Refresh"),m=B("el-icon"),_=B("el-dropdown-item"),g=B("Delete"),y=B("el-dropdown-menu"),v=B("el-dropdown"),C=B("CardHeader"),b=B("Plans"),w=B("CardBody"),x=B("CardContainer"),F=B("CancelSubscription");return r(),h(O,null,[n(x,null,{default:d(()=>[n(C,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},{default:d(()=>[i.permissions.canFetch||i.permissions.canPause||i.permissions.canResume||i.permissions.canCancel?(r(),$(v,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t[0]||(t[0]=L=>i.handleSubscriptionAction(L))},{dropdown:d(()=>[n(y,null,{default:d(()=>[i.permissions.canFetch?(r(),$(_,{key:0,command:"fetch_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),R(" "+f(e.$t("Fetch subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):k("",!0),i.permissions.canPause?(r(),$(_,{key:1,command:"pause_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),R(" "+f(e.$t("Pause subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):k("",!0),i.permissions.canResume?(r(),$(_,{key:2,command:"resume_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(p)]),_:1}),R(" "+f(e.$t("Resume subscription -"))+" "+f(i.paymentMethod),1)]),_:1})):k("",!0),i.permissions.canCancel?(r(),$(_,{key:3,command:"cancel_subscription"},{default:d(()=>[n(m,null,{default:d(()=>[n(g)]),_:1}),o("span",i5,f(e.$t("Cancel subscription")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[o("span",o5,[n(c,{name:"More"})])]),_:1})):k("",!0)]),_:1},8,["title"]),n(w,null,{default:d(()=>[n(b,{onReload:t[1]||(t[1]=L=>e.$emit("reload")),getOrderUrl:a.getOrderUrl,subscription:a.subscription,order:a.order,header:e.$t("Subscription Plans #")+(a.index+1)},null,8,["getOrderUrl","subscription","order","header"])]),_:1})]),_:1}),n(F,{subscription:a.subscription,orderId:a.orderId,onClose:t[2]||(t[2]=L=>s.cancelSubscriptionModal=!1),modelValue:s.cancelSubscriptionModal,"onUpdate:modelValue":t[3]||(t[3]=L=>s.cancelSubscriptionModal=L),onReload:t[4]||(t[4]=L=>e.$emit("reload")),onCancelSubscription:i.confirmCancel},null,8,["subscription","orderId","modelValue","onCancelSubscription"])],64)}const d5=lt(n5,[["render",r5]]),u5={name:"OrderBulkActions",components:{DynamicIcon:ee},props:["order","trigger_action","isEditingItem","mode","triggerMode","shouldShowRefund","warningMessage"],emits:["reload","addItem","addProduct","enableItemEditing","disableItemEditing","handlePaymentActions"],data(){return{selected_action:"",showModal:!1,status_data:{order_status:this.order.status,shipping_status:this.order.shipping_status,payment_status:this.order.payment_status},doing_actions:!1,manage_stock:!0,shouldDisableEditing:["completed","archived","canceled"].includes(this.order.status),isCancelled:["canceled"].includes(this.order.status),isCompleted:["completed"].includes(this.order.status),isUnshippable:["unshippable"].includes(this.order.shipping_status)}},methods:{translate:u,handleCommandAction(e){if(this.selected_action=e,e==="shipping_status")this.changeShipping();else if(e==="delete_order")this.confirmDeleteOrder();else if(e==="order_complete")this.selected_action="order_status",this.completeOrder();else if(e==="order_cancel")this.selected_action="order_status",this.cancelOrder();else if(e==="order_processing")this.selected_action="order_status",this.backToProcessing();else if(e==="order_receipt")this.showModal=!1;else if(e==="generate_missing_licenses")this.generateMissingLicenses();else if(e==="refund_order")this.$emit("handlePaymentActions","refund");else if(e==="sync_order_statuses")this.syncOrderStatuses();else if(e.action==="order_edit")if(e.isEditingItem)this.$emit("disableItemEditing");else{if(this.shouldDisableEditing)return;this.$emit("enableItemEditing")}else this.showModal=!0},confirmDeleteOrder(){this.$confirm(u("Are you sure you want to delete this order? This action can not be undone!"),u("Confirm Deleting"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{Xs(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?z.validationErrors(e):z.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(u("Are you sure you want to complete this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as complete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(u("Are you sure you want to generate missing licenses!"),u("Please confirm"),{confirmButtonText:u("Yes, Generate all missing licenses!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{z.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(u("Are you sure you want to revert back processing this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as processing!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(u("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),u("Please confirm"),{confirmButtonText:u("Yes, Changed status to Cancel"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.manage_stock=!0,this.updateOrderStatuses({order_status:"canceled"})})},changeShippingStatus(){let e={};this.manage_stock=!0,e[this.selected_action]=this.status_data[this.selected_action],this.updateOrderStatuses(e)},updateOrderStatuses(e){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/statuses",{action:"change_"+this.selected_action,statuses:e,manage_stock:this.manage_stock}).then(t=>{z.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},syncOrderStatuses(){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/sync-statuses").then(e=>{z.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},c5={class:"fct-order-bulk-action-modal"},A5={key:1,class:"more-btn"},p5={key:0},f5=["href"],m5={class:"dialog-footer"};function h5(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-button"),m=B("el-dropdown-item"),_=B("el-tooltip"),g=B("el-dropdown-menu"),y=B("el-dropdown"),v=B("el-option"),C=B("el-select"),b=B("el-form-item"),w=B("el-form"),x=B("el-dialog");return r(),h("div",c5,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:d(()=>[n(g,null,{default:d(()=>{var F,L;return[a.trigger_action!=="add"?(r(),h("div",p5,[!s.isCancelled&&((F=a.order)==null?void 0:F.fulfillment_type)==="physical"?(r(),$(m,{key:0,command:"shipping_status"},{default:d(()=>[n(c,{name:"ShipmentStatus"}),R(" "+f(i.translate("Change Shipping Status")),1)]),_:1})):k("",!0),a.order.mode==="test"||s.isCancelled?(r(),$(m,{key:1,command:"delete_order",class:"item-destructive"},{default:d(()=>[n(c,{name:"Delete"}),R(" "+f(i.translate("Delete order")),1)]),_:1})):k("",!0),a.order.status==="processing"?(r(),$(m,{key:2,command:"order_complete"},{default:d(()=>[n(c,{name:"Check"}),R(" "+f(i.translate("Mark As Complete")),1)]),_:1})):k("",!0),s.isCancelled?k("",!0):(r(),$(m,{key:3,command:"order_cancel"},{default:d(()=>[n(c,{name:"Cross"}),R(" "+f(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),$(m,{key:4,command:"order_processing"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+f(i.translate("Back to processing")),1)]),_:1})):k("",!0),!s.isCompleted&&!s.isCancelled?(r(),$(m,{key:5,command:"sync_order_statuses"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+f(i.translate("Sync Order Statuses")),1)]),_:1})):k("",!0),n(m,{command:"order_receipt",class:"item-link"},{default:d(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[n(c,{name:"External"}),R(" "+f(i.translate("Receipt")),1)],8,f5)]),_:1}),(L=a.order)!=null&&L.has_missing_licenses?(r(),$(m,{key:6,command:"generate_missing_licenses"},{default:d(()=>[n(c,{name:"Files"}),R(" "+f(i.translate("Generate missing licenses")),1)]),_:1})):k("",!0),a.shouldShowRefund?(r(),$(m,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:d(()=>[n(c,{name:"Money"}),R(" "+f(i.translate("Refund")),1)]),_:1})):k("",!0),n(m,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:d(()=>[n(c,{name:"Edit"}),a.isEditingItem?(r(),h(O,{key:1},[R(f(i.translate("Disable Editing")),1)],64)):(r(),h(O,{key:0},[s.shouldDisableEditing?(r(),$(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(f(a.warningMessage),1)]),default:d(()=>[R(" "+f(i.translate("Edit")),1)]),_:1})):(r(),h(O,{key:1},[R(f(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):k("",!0)]}),_:1})]),default:d(()=>[a.triggerMode==="button"?(r(),$(p,{key:0},{default:d(()=>[R(f(i.translate("More Action"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})):(r(),h("span",A5,[n(c,{name:"More"})]))]),_:1},8,["onCommand"]),n(x,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.showModal=F),title:i.translate("Update Shipping Status")},{default:d(()=>[n(w,{data:s.status_data,"label-position":"top"},{default:d(()=>[s.selected_action==="shipping_status"||s.selected_action==="all"?(r(),$(b,{key:0,label:i.translate("Shipping Status")},{default:d(()=>[n(C,{modelValue:s.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=F=>s.status_data.shipping_status=F),placeholder:i.translate("Select Shipping Status")},{default:d(()=>[(r(!0),h(O,null,ae(e.appVars.shipping_statuses,(F,L)=>(r(),$(v,{key:L,label:F,value:L},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"]),o("span",m5,[n(p,{onClick:t[1]||(t[1]=F=>i.changeShippingStatus()),type:"primary"},{default:d(()=>[R(f(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const gd=lt(u5,[["render",h5]]),_5={name:"Transaction",computed:{Str(){return oa}},components:{ConvertedTime:Pa,ArrowDown:Gs(ei),Check:Tc,Badge:Aa,DynamicIcon:ee},props:["transactions","transaction","header","transaction_data","order_id","orderCurrency"],emits:["reload"],data(){return{visible:!1,doing_action:!1,disputeHandleModal:!1,disputeForm:{dispute_note:""},disputeTransaction:null,loadingDisputeAction:!1}},methods:{translate:u,getCardBrand:Dc,translateNumber:Xt,handleDispute(e){this.disputeHandleModal=!0,this.disputeTransaction=e},handleDisputeSubmit(e){this.loadingDisputeAction=!0,this.$post("orders/"+this.order_id+"/transactions/"+this.disputeTransaction.id+"/accept-dispute",{dispute_note:this.disputeForm.dispute_note}).then(t=>{this.$notify.success(t.message),this.$emit("reload"),this.disputeHandleModal=!1}).catch(t=>{this.$notify.error(t.message)}).finally(()=>{this.disputeHandleModal=!1,this.loadingDisputeAction=!1})},hasDisputedTransaction(e){return e.some(t=>t.transaction_type=="dispute"&&t.status=="succeeded")}}},v5={key:0,class:"fct-transaction-details -mt-[1px]"},g5={class:"fct-table-wrap"},y5={class:"p-0 m-0 text-xs text-gray-500"},b5={key:0},w5=["href"],C5={class:"flex items-center gap-2.5"},B5={key:0,class:"w-7"},k5=["title","src","alt"],x5={key:1,class:"capitalize"},S5={key:2},F5={class:"text-sm"},$5={class:"text-sm text-gray-700"},E5={class:"text-sm flex gap-2"},U5=["href"];function I5(e,t,a,l,s,i){var F,L;const c=B("ConvertedTime"),p=B("el-table-column"),m=B("Badge"),_=B("el-tooltip"),g=B("el-button"),y=B("el-table"),v=B("el-form-item"),C=B("el-input"),b=B("el-form"),w=B("DynamicIcon"),x=B("el-dialog");return a.transactions.length>0?(r(),h("div",v5,[o("div",g5,[n(y,{data:a.transactions,class:"w-full"},{default:d(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:d(U=>[o("div",null,[o("p",y5,"#"+f(i.translateNumber(U.row.id)),1),n(c,{"date-time":U.row.created_at},null,8,["date-time"])])]),_:1},8,["label"]),n(p,{label:i.translate("Gateway ID"),width:"160"},{default:d(U=>[U.row.vendor_charge_id==""?(r(),h("span",b5,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:U.row.url},f(U.row.vendor_charge_id),9,w5))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:d(U=>[o("div",C5,[i.getCardBrand(U.row.card_brand,U.row.payment_method_type)?(r(),h("div",B5,[o("img",{class:"w-full",title:U.row.payment_method,src:i.getCardBrand(U.row.card_brand,U.row.payment_method_type),alt:U.row.card_brand},null,8,k5)])):(r(),h("span",x5,f(U.row.payment_method_type),1)),U.row.card_last_4&&U.row.card_last_4!="0"?(r(),h("span",S5,f("..."+U.row.card_last_4),1)):k("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:d(U=>[o("span",null,f(e.formatNumberForOrder(U.row.total,a.orderCurrency)),1)]),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:d(U=>{var S,M,I,T,Q,E;return[U.row.transaction_type=="dispute"?(r(),$(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((M=(S=U.row)==null?void 0:S.meta)==null?void 0:M.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>[n(m,{class:"m-2 b-red",status:"dispute"},{default:d(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):k("",!0),(T=(I=U.row)==null?void 0:I.meta)!=null&&T.reason?(r(),$(_,{key:1,effect:"dark",placement:"top",content:i.translate((E=(Q=U.row)==null?void 0:Q.meta)==null?void 0:E.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var D,H,P,G;return[((H=(D=U.row)==null?void 0:D.meta)==null?void 0:H.disputed)=="yes"&&((G=(P=U.row)==null?void 0:P.meta)==null?void 0:G.dispute_resolved)=="no"?(r(),$(m,{key:0,status:U.row.status},{default:d(()=>{var J;return[R(f(U.row.status)+" "+f((J=U==null?void 0:U.row)==null?void 0:J.transaction_type),1)]}),_:2},1032,["status"])):(r(),$(m,{key:1,status:U.row.status},{default:d(()=>[R(f(U.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),$(m,{key:2,status:U.row.status},{default:d(()=>[R(f(U.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),i.hasDisputedTransaction(a.transactions)?(r(),$(p,{key:0,label:i.translate("Actions"),width:"140"},{default:d(U=>[U.row.transaction_type=="dispute"&&U.row.status=="succeeded"?(r(),$(g,{key:0,type:"warning",size:"small",onClick:S=>i.handleDispute(U.row)},{default:d(()=>[R(f(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):k("",!0)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]),n(x,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=U=>s.disputeHandleModal=U),title:"Handle Dispute #"+((L=(F=s.disputeTransaction)==null?void 0:F.meta)==null?void 0:L.dispute_id),width:"800px"},{footer:d(()=>{var U,S,M,I,T,Q;return[o("a",{href:(U=s.disputeTransaction)==null?void 0:U.url,target:"_blank",class:"el-button el-button--warning is-link"},f(i.translate("See dispute on ")+((S=s.disputeTransaction)==null?void 0:S.payment_method)),9,U5),(I=(M=s.disputeTransaction)==null?void 0:M.meta)!=null&&I.is_charge_refundable?(r(),$(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:d(()=>[R(f(i.translate("Refund customer")),1)]),_:1},8,["loading"])):k("",!0),(Q=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&Q.is_dispute_actionable?(r(),$(g,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:d(()=>[R(f(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):k("",!0)]}),default:d(()=>{var U,S,M,I,T,Q;return[(S=(U=s.disputeTransaction)==null?void 0:U.meta)!=null&&S.dispute_reason?(r(),$(v,{key:0},{default:d(()=>{var E,D;return[o("div",F5," Dispute Reason: "+f((D=(E=s.disputeTransaction)==null?void 0:E.meta)==null?void 0:D.dispute_reason),1)]}),_:1})):k("",!0),n(v,null,{default:d(()=>[o("div",$5,f(i.translate("You may either counter the dispute by providing evidence to prove that the cardholder is the legitimate purchaser, or you can accept this dispute immediately to refund the cardholder and close the dispute.")),1)]),_:1}),(I=(M=s.disputeTransaction)==null?void 0:M.meta)!=null&&I.is_dispute_actionable?(r(),$(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:d(()=>[n(v,{label:i.translate("Note"),prop:"dispute_note"},{default:d(()=>[n(C,{modelValue:s.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=E=>s.disputeForm.dispute_note=E),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):k("",!0),(Q=(T=s.disputeTransaction)==null?void 0:T.meta)!=null&&Q.is_charge_refundable?(r(),$(v,{key:2},{default:d(()=>[o("div",E5,[n(w,{class:"w-6 h-6",name:"Information"}),R(" "+f(i.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):k("",!0)]}),_:1},8,["modelValue","title"])])):k("",!0)}const yd=lt(_5,[["render",I5]]),bd=(e,t,a=0)=>{let l=0,s=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((i,c)=>{let p=i.updateStock||0;i.quantity<1?i.quantity=1:p!=0&&parseInt(i.quantity)>p&&(i.quantity=p),i.total=i.unit_price*i.quantity;let m=i.unit_price*i.quantity;if(i.subtotal=m-i.cost,e.manual_discount_total>0?i.discount_total=i.discount_total:t===!0?s+=i.discount_total:(!e.manual_discount_total===0?e.manual_discount_total-=i.discount_total:e.manual_discount_total=0,i.discount_total=0),i.line_total=m-i.discount_total,l+=m,i.payment_type=="subscription"&&i.other_info.manage_setup_fee=="yes"){let _=parseInt(i.other_info.signup_fee);i.other_info.setup_fee_per_item=="yes"&&(_=_*i.quantity),l+=_}}),e.subtotal=l,e.coupon_discount_total=s,(e.subtotal<=0||e.subtotal<=e.manual_discount_total)&&(e.manual_discount_total=e.coupon_discount_total=e.shipping_tax=e.shipping_total=e.tax_total=0),Q5(e),e},Gu=(e,t)=>{if(t.value<0)return e;let a=t.value?t.value*100:0;t.label="",t.type==="percentage"&&(a=e.subtotal*t.value/100),yp(t),a=parseInt(a),a>=0&&a<=parseInt(e.subtotal)&&(e.manual_discount_total=a);let l=e.subtotal*1+e.tax_total*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total;return l>=0&&(e.total_amount=l),e},Q5=e=>(e.total_amount=e.subtotal*1+e.tax_total*1+e.shipping_tax*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total,e),yp=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),D5={name:"NoteModal",props:["note"],data(){return{notes:this.note}},watch:{note:{handler:function(e,t){this.notes=e},deep:!0}},mounted(){},methods:{saveNote(){this.$emit("whenNoteEditIsDone",this.notes,!1)},closeModal(){this.$emit("closeModal")}}},V5={class:"fct-note-modal"},T5={class:"dialog-footer"};function M5(e,t,a,l,s,i){const c=B("el-input"),p=B("el-form-item"),m=B("el-form"),_=B("el-button");return r(),h("div",V5,[n(m,{"label-position":"top"},{default:d(()=>[n(p,null,{default:d(()=>[n(c,{modelValue:s.notes,"onUpdate:modelValue":t[0]||(t[0]=g=>s.notes=g),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),o("div",T5,[n(_,{type:"info",soft:"",onClick:i.closeModal},{default:d(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(_,{type:"primary",onClick:i.saveNote},{default:d(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const bp=lt(D5,[["render",M5]]),L5={class:"fct-admin-sidebar-item"},R5={key:0},O5={name:"Notes",components:{IconButton:Xe,NoteModal:bp,DynamicIcon:ee},props:{note:{type:String,default:""},shouldEnableEditing:{type:Boolean,default:!0},orderId:{type:[String,Number]}},data(){return{noteModalIsOpen:!1,isNoteExpanded:!1,noteCopy:this.note,loading:!1}},computed:{noteNeedsCollapse(){var e;return((e=this.noteCopy)==null?void 0:e.length)>355},noteTextToDisplay(){return this.isNoteExpanded||!this.noteNeedsCollapse?this.noteCopy:this.noteCopy.substring(0,355)+"..."}},watch:{note:{handler(e,t){this.noteCopy=e},deep:!0,immediate:!0}},mounted(){},methods:{saveNoteModal(e,t){this.loading=!0,this.noteModalIsOpen=t,this.$emit("whenNoteEditIsDone",e),this.orderId&&this.$post("notes/attach",{order_id:this.orderId,note:e}).then(a=>{z.success(a.message),this.noteCopy=e}).catch(a=>{z.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},gi=Object.assign(O5,{setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton"),i=B("el-button"),c=B("el-dialog");return r(),h("div",null,[e.orderId?(r(),$(xe,{key:0},{default:d(()=>[n(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(r(),$(Xe,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:d(()=>[n(ee,{name:"Edit"})]),_:1})):k("",!0)]),_:1},8,["title"]),n(ke,{class:de(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[o("div",L5,[t.loading?(r(),$(s,{key:0,animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(O,{key:1},[o("span",null,f(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(r(),$(i,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:d(()=>[t.isNoteExpanded?(r(),h(O,{key:0},[R(f(t.$t("Show less"))+" ",1),n(ee,{name:"ChevronUp"})],64)):(r(),h(O,{key:1},[R(f(t.$t("Show more"))+" ",1),n(ee,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):k("",!0)],64))])]),_:1},8,["class"])]),_:1})):k("",!0),n(c,{"append-to-body":!0,width:"45%",modelValue:t.noteModalIsOpen,"onUpdate:modelValue":a[2]||(a[2]=p=>t.noteModalIsOpen=p),title:t.noteCopy?t.$t("Edit Note"):t.$t("Add Note")},{default:d(()=>[t.noteModalIsOpen?(r(),h("div",R5,[n(bp,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=p=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):k("",!0)]),_:1},8,["modelValue","title"])])}}}),H5={name:"Coupon",components:{IconButton:Xe,DynamicIcon:ee},props:{order:{type:Object,default:()=>({})},appliedCouponsAttributes:{type:Array,default:()=>[]},hasCouponAttributes:{type:Boolean,default:!1},couponsAttributes:{type:Array,default:()=>[]},action:{type:String,default:""},shouldManageCoupon:{type:Boolean,default:!0}},data(){return{appliedCoupons:[...this.appliedCouponsAttributes],hasCoupon:this.hasCouponAttributes,availableCoupons:[],newCoupon:"",coupons:[...this.couponsAttributes]}},mounted(){},methods:{translate:u,searchCoupon(e,t){this.fetchCoupon(e,t)},fetchCoupon(e="",t=()=>{}){this.$get("coupons",{search:e,select:"code",scopes:["active"]}).then(a=>{var i;const l=(i=a.coupons)==null?void 0:i.data;this.availableCoupons=l.map(c=>c.code);const s=this.availableCoupons.filter(c=>c.toLowerCase().includes(e.toLowerCase())).map(c=>({value:c}));t(s)}).catch(a=>{var l;a.status_code=="422"?z.validationErrors(a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){z.error(this.translate("Coupon already applied"));return}this.$post("coupons/apply",{coupon_code:this.newCoupon,order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e),this.newCoupon=""}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)})},cancelCoupon(e,t){this.$post("coupons/cancel",{id:t.id,coupon_code:t.code,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons,order_items:this.order.order_items}).then(a=>{this.processCoupon(a)}).catch(a=>{var l;a.status_code=="422"?z.validationErrors(a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},reApplyCoupon(){this.$post("coupons/re-apply",{order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e)}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},processCoupon(e){this.coupons=[],this.appliedCoupons=[];for(let s in e.applied_coupons)this.coupons.push({id:e.applied_coupons[s].id,code:s,amount:e.applied_coupons[s].discount}),this.appliedCoupons.push(e.applied_coupons[s].id);let t=0,a=0;const l=Object.values(e.calculated_items);this.order.order_items.forEach((s,i)=>{const c=l.find(p=>p.id==s.object_id||p.id==s.id);c!=null&&(this.order.order_items[i].price=c.price,this.order.order_items[i].unit_price=c.unit_price,this.order.order_items[i].line_total=c.unit_price*c.quantity-c.discount_total,t+=this.order.order_items[i].line_total,a+=c.discount_total,this.order.order_items[i].line_total_formatted=c.line_total_formatted,this.order.order_items[i].discount_total=c.discount_total,this.order.order_items[i].coupon_discount=c.coupon_discount||0,this.order.order_items[i].line_meta&&(this.order.order_items[i].line_meta.coupon_discount=c.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,bd(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},P5={colspan:"3"},N5={class:"fct-add-coupon-wrap"},K5={key:0,class:"fct-add-coupon-input-label"},G5={key:1,class:"fct-add-coupon-input-label"},j5={key:2,class:"fct-add-coupon-input-wrap"},z5={class:"flex gap-0.5 items-center"};function q5(e,t,a,l,s,i){const c=B("el-autocomplete"),p=B("el-button"),m=B("el-alert"),_=B("DynamicIcon"),g=B("IconButton"),y=B("el-popconfirm");return r(),h(O,null,[o("tr",null,[o("td",P5,[o("div",N5,[a.action==="create_order"?(r(),h("div",K5,f(e.$t("Have a Coupon?")),1)):(r(),h("div",G5,f(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",j5,[n(c,{modelValue:s.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>s.newCoupon=v),"fetch-suggestions":i.searchCoupon,"trigger-on-focus":!1,clearable:"",class:"w-full",placeholder:e.$t("Enter coupon code")},null,8,["modelValue","fetch-suggestions","placeholder"]),n(p,{onClick:i.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick"])])):k("",!0),!s.hasCoupon&&a.shouldManageCoupon?(r(),$(m,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):k("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),h(O,null,ae(s.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",z5,[o("span",null,f(v.code),1),a.action==="create_order"?(r(),$(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(C=>i.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick"])):k("",!0),a.action==="edit_order"?(r(),$(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:i.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:C=>i.cancelCoupon(v.id,v),width:"250"},{reference:d(()=>[a.shouldManageCoupon?(r(),$(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:1})):k("",!0)]),_:2},1032,["title","onConfirm"])):k("",!0)])]),t[2]||(t[2]=o("td",null,null,-1)),o("td",null,"- "+f(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const yi=lt(H5,[["render",q5]]),Y5={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=gn({...e.discount}),l=V([{label:u("Amount"),value:"amount"}]),s=V("");return{discountOptions:l,applyDiscount:()=>{const m=parseInt(a.value);isNaN(m)||m<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const m=parseInt(a.value);let _=m||0;const g=e.totalAmount/100;return a.type=="percentage"?(_=g*m/100,(m>100||_>g)&&(s.value=u("Discount should not exceed the full product price (100%).")),isNaN(m)||m<1||m>100):(_>g&&(s.value=u("Discount should not exceed the full product price (%s).",am(g))),isNaN(m)||m<1||_>g)},error:s}}},W5={class:"fct-discount-modal"},X5=["innerHTML"],J5={key:1},Z5={style:{color:"red"}},e6={class:"form-note"},t6={class:"dialog-footer"};function a6(e,t,a,l,s,i){const c=B("el-option"),p=B("el-select"),m=B("el-form-item"),_=B("el-col"),g=B("el-input"),y=B("el-row"),v=B("el-form"),C=B("el-button");return r(),h("div",W5,[n(v,{"label-position":"top"},{default:d(()=>[n(y,{gutter:20},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(m,{label:e.$t("Discount type")},{default:d(()=>[n(p,{modelValue:l.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=b=>l.initialDiscount.type=b),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=b=>{l.error=""})},{default:d(()=>[(r(!0),h(O,null,ae(l.discountOptions,b=>(r(),$(c,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(m,{label:e.$t("Discount value")},{default:d(()=>[n(g,{type:"number",min:1,modelValue:l.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=b=>l.initialDiscount.value=b),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[l.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,X5)):(r(),h("span",J5,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",Z5,f(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(y,null,{default:d(()=>[n(_,{md:24,sm:12,xs:24},{default:d(()=>[n(m,{label:e.$t("Reason for discount")},{default:d(()=>[n(g,{modelValue:l.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=b=>l.initialDiscount.reason=b),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",e6,[o("p",null,f(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",t6,[n(C,{type:"info",onClick:l.cancelDiscount,soft:""},{default:d(()=>[R(f(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(C,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:d(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const l6=lt(Y5,[["render",a6]]),s6={name:"CustomDiscount",components:{IconButton:Xe,DynamicIcon:ee,DiscountModal:l6},props:{order:{type:Object,default:()=>({})},discountAttributes:{type:Object,default:()=>({type:"amount",label:"",reason:""})},hasCoupon:{type:Boolean,default:!1},shouldEnableEditing:{type:Boolean,default:!0}},data(){return{discountModalIsOpen:!1,discount:this.discountAttributes}},mounted(){},methods:{translate:u,isOnlyProrateCredit(){const e=this.order.config&&this.order.config.prorate_credit||0;return e>0&&this.order.manual_discount_total-e<=0},getDiscountButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?this.isOnlyProrateCredit()?u("Prorate Credit"):u("Discount"):this.order.manual_discount_total!==0?u("Edit Discount"):u("Add Discount")},manageDiscount(){this.discount.action=parseInt(this.order.manual_discount_total)>0?"edit":"add",this.shouldEnableEditing&&!this.hasCoupon&&this.order.order_items.length>0&&(this.discountModalIsOpen=!0)},removeDiscount(){this.discount={},Gu(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,Gu(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},n6={key:0},o6={key:1},i6={key:2},r6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},d6={style:{"padding-left":"16px"}},u6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},c6={style:{"padding-left":"16px"}},A6={key:0};function p6(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("DiscountModal"),m=B("el-dialog");return r(),h(O,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",n6,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ne(_=>i.manageDiscount(),["prevent"]))},[R(f(i.getDiscountButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",o6,f(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",i6,f(s.discount.label),1)):k("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(O,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ne(_=>i.removeDiscount(),["prevent"]))},f(i.translate("Remove Discount")),1)],64)):k("",!0)]),o("td",null,f(s.discount.reason?s.discount.reason:"__"),1),o("td",null,[o("span",null,"- "+f(e.formatNumberForOrder(a.order.manual_discount_total,a.order)),1)])])):k("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(r(),h(O,{key:1},[o("tr",r6,[o("td",d6,f(i.translate("Upgrade Discount")),1),t[5]||(t[5]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),o("tr",u6,[o("td",c6,f(i.translate("Prorate Credit")),1),t[6]||(t[6]=o("td",null,null,-1)),o("td",null,f(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):k("",!0),n(m,{"append-to-body":!0,width:"50%",modelValue:s.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=_=>s.discountModalIsOpen=_),title:a.order.manual_discount_total===0?i.translate("Add discount"):i.translate("Edit discount")},{default:d(()=>[s.discountModalIsOpen?(r(),h("div",A6,[n(p,{discount:s.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:i.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=_=>s.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):k("",!0)]),_:1},8,["modelValue","title"])],64)}const bi=lt(s6,[["render",p6]]),f6={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=V(e.shipping_type);return{availableOptions:V([{label:"Custom",value:"custom"}]),updatingIsDone:()=>parseInt(e.shipping.custom_price)<0?e.shipping.custom_price=0:(parseInt(e.shipping.custom_price)==0&&(e.shipping.custom_price=0),e.shipping.rate_name=e.shipping.rate_name==""||e.shipping.rate_name==null?"Custom":e.shipping.rate_name,e.shipping.type=a.value,t("whenShippingEditIsDone",!1)),removeShipping:()=>{e.shipping.type="",e.shipping.custom_price="",e.shipping.rate_name="",t("whenShippingEditIsDone",!1)},isDisabledApplyButton:()=>{const p=parseInt(e.shipping.custom_price);return isNaN(p)||p<0},shippingType:a}}},m6={class:"fct-shipping-modal"},h6=["innerHTML"],_6={class:"dialog-footer"};function v6(e,t,a,l,s,i){const c=B("el-radio"),p=B("el-radio-group"),m=B("el-form-item"),_=B("el-col"),g=B("el-row"),y=B("el-input"),v=B("el-form"),C=B("el-button");return r(),h("div",m6,[n(v,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(g,{gutter:20},{default:d(()=>[n(_,{md:24,sm:24,xs:24},{default:d(()=>[n(m,{label:e.$t(""),required:""},{default:d(()=>[n(p,{modelValue:l.shippingType,"onUpdate:modelValue":t[0]||(t[0]=b=>l.shippingType=b)},{default:d(()=>[(r(!0),h(O,null,ae(l.availableOptions,(b,w)=>(r(),$(c,{label:b.value,key:w},{default:d(()=>[R(f(b.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),l.shippingType==="custom"?(r(),$(g,{key:0,gutter:15},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(m,{label:e.$t("Name")},{default:d(()=>[n(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=b=>a.shipping.rate_name=b)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(m,{label:e.$t("Price")},{default:d(()=>[n(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=b=>a.shipping.custom_price=b),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,h6)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):k("",!0)]),_:1}),o("div",_6,[a.shipping.type?(r(),$(C,{key:0,type:"danger",onClick:l.removeShipping},{default:d(()=>[R(f(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):k("",!0),n(C,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:d(()=>[R(f(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const g6=lt(f6,[["render",v6]]),y6={name:"Shipping",components:{IconButton:Xe,DynamicIcon:ee,ShippingModal:g6},props:{order:{type:Object,default:()=>({})},shippingAttributes:{type:Object,default:()=>({id:""})},shouldEnableEditing:{type:Boolean,default:!0},shippingMethodsProps:{type:Array,default:()=>[]},otherShippingMethodsProps:{type:Array,default:()=>[]}},data(){return{shippingModalIsOpen:!1,shipping:this.shippingAttributes,shippingMethods:this.shippingMethodsProps,otherShippingMethods:this.otherShippingMethodsProps,total_shipping:this.order.shipping_total/100}},computed:{currency(){const e=ze.get("currency_signs",{}),t=ze.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},shippingTitle(){return this.getShippingTitle()}},watch:{shippingMethodsProps:{handler:function(e,t){this.shippingMethods=e},deep:!0},otherShippingMethodsProps:{handler:function(e,t){this.otherShippingMethods=e},deep:!0},order:{handler:function(e,t){this.total_shipping=e.shipping_total/100},deep:!0}},mounted(){},methods:{translate:u,showShippingModal(){this.shippingModalIsOpen=!0},hasFreeShipping(){return Object.keys(this.shipping).length>0&&parseInt(this.shipping.custom_price)==0},getShippingButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?u("Shipping"):this.shipping.id!==0?u("Edit Shipping"):u("Add Shipping")},getShippingTitle(){const e=this.order&&this.order.checkout_shipping&&this.order.checkout_shipping.method_title?this.order.checkout_shipping.method_title:"";if(!this.shipping.id)return e;const t=this.shipping.id,l=this.shippingMethods.concat(this.otherShippingMethods).find(function(s){return s.id==t});return l?l.title:e},updateShipping(){this.shippingModalIsOpen=!1;const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.post("orders/calculate-shipping",{shipping_id:this.shipping.id,order_items:e}).then(t=>{this.order.shipping_total=t.shipping_charge;const a={order_items:t.order_items,shipping_total:t.shipping_charge};this.total_shipping=this.order.shipping_total/100,this.$emit("update:shipping",a.order_items,a.shipping_total,this.shipping)}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return u("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},b6={key:1},w6={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},C6={key:0},B6={key:1,class:"max-w-[120px] block ml-auto text-right"},k6={key:2},x6={key:0},S6={key:0,class:"fct-shipping-methods-list-wrap"},F6={key:0,class:"charge"},$6={key:1,class:"fct-other-shipping-methods-list-wrap"},E6={key:0,class:"charge"},U6={key:1,class:"fct-no-shipping-methods-found"},I6=["innerHTML"];function Q6(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-input"),m=B("el-radio"),_=B("el-radio-group"),g=B("el-button"),y=B("el-dialog");return r(),h(O,null,[o("tr",null,[o("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ne(v=>i.showShippingModal(),["prevent"]))},[R(f(i.getShippingButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",b6,f(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",w6,f(i.shippingTitle),1)):k("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",C6,[o("del",null,f(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+f(i.translate("Free")),1)])):k("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),h("span",B6,[n(p,{modelValue:s.total_shipping,"onUpdate:modelValue":t[1]||(t[1]=v=>s.total_shipping=v),onChange:t[2]||(t[2]=v=>{a.order.shipping_total=v*100}),type:"number"},{prefix:d(()=>[R(f(i.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",k6,f(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0))),1))])]),n(y,{"append-to-body":!0,width:"50%",modelValue:s.shippingModalIsOpen,"onUpdate:modelValue":t[6]||(t[6]=v=>s.shippingModalIsOpen=v),title:e.$t("Shipping and delivery options")},ta({default:d(()=>[s.shippingModalIsOpen?(r(),h("div",x6,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(O,{key:0},[s.shippingMethods.length?(r(),h("div",S6,[o("h3",null,f(i.translate("Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(O,null,ae(s.shippingMethods,(v,C)=>(r(),$(m,{label:v.id,key:C},{default:d(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",F6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):k("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):k("",!0),s.otherShippingMethods.length?(r(),h("div",$6,[o("h3",null,f(i.translate("Other Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(O,null,ae(s.otherShippingMethods,(v,C)=>(r(),$(m,{label:v.id,key:C},{default:d(()=>[R(f(v.title)+" ",1),v.shipping_charge?(r(),h("span",E6,f(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):k("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):k("",!0)],64)):(r(),h("div",U6,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,I6)]))])):k("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:d(()=>[n(g,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:d(()=>[R(f(i.translate("Cancel")),1)]),_:1}),n(g,{type:"primary",onClick:i.updateShipping},{default:d(()=>[R(f(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const wd=lt(y6,[["render",Q6]]),D6={key:0},V6={class:"fct-admin-sidebar-item"},T6={class:"fct-admin-summary-item-list"},M6={class:"fct-admin-summary-item"},L6={class:"font-medium"},R6={key:0,class:"fct-admin-summary-item"},O6={class:"font-medium"},H6={key:1,class:"fct-admin-summary-item"},P6={class:"font-medium"},N6={key:2,class:"fct-admin-summary-item"},K6={class:"font-medium"},G6={key:3,class:"fct-admin-summary-item"},j6={class:"font-medium"},z6={key:4,class:"fct-admin-summary-item"},q6={class:"font-medium"},Y6={key:5,class:"fct-admin-summary-item"},W6={class:"font-medium"},X6={class:"fct-admin-summary-item"},J6={class:"font-medium"},Z6={name:"UtmDetails",props:{order_operation:{type:Object}}},wp=Object.assign(Z6,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",D6,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",V6,[o("ul",T6,[o("li",M6,[o("span",L6,f(t.$t("UTM Campaign")),1),o("span",null,f(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",R6,[o("span",O6,f(t.$t("UTM Medium")),1),o("span",null,f(e.order_operation.utm_medium||"--"),1)])):k("",!0),e.order_operation.utm_source?(r(),h("li",H6,[o("span",P6,f(t.$t("UTM Source")),1),o("span",null,f(e.order_operation.utm_source||"--"),1)])):k("",!0),e.order_operation.utm_content?(r(),h("li",N6,[o("span",K6,f(t.$t("UTM Content")),1),o("span",null,f(e.order_operation.utm_content||"--"),1)])):k("",!0),e.order_operation.utm_id?(r(),h("li",G6,[o("span",j6,f(t.$t("UTM ID")),1),o("span",null,f(e.order_operation.utm_id||"--"),1)])):k("",!0),e.order_operation.utm_term?(r(),h("li",z6,[o("span",q6,f(t.$t("UTM Term")),1),o("span",null,f(e.order_operation.utm_term||"--"),1)])):k("",!0),e.order_operation.refer_url?(r(),h("li",Y6,[o("span",W6,f(t.$t("Refer Url")),1),o("span",null,f(e.order_operation.refer_url||"--"),1)])):k("",!0),Array.isArray(e.order_operation.meta)?(r(!0),h(O,{key:6},ae(e.order_operation.meta,(l,s)=>(r(),h("li",X6,[o("span",J6,f(s),1),o("span",null,f(l||"--"),1)]))),256)):k("",!0)])])]),_:1})]),_:1})])):k("",!0)}}),eI={name:"Transaction",components:{ConvertedTime:Pa,Badge:Aa},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0},orderCurrency:{type:String,default:null}},emits:["reload"],computed:{Str(){return oa}},methods:{translate:u,getCardBrand:Dc}},tI={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},aI={class:"fct-table-mobile-header"},lI={class:"fct-table-mobile-header-left"},sI={class:"fct-table-status-col"},nI={class:"fct-table-date-col"},oI={class:"id"},iI={class:"fct-table-price-col"},rI={class:"fct-table-mobile-body"},dI={class:"fct-table-mobile-body-list"},uI={class:"fct-table-mobile-method-col"},cI={class:"label"},AI={class:"value"},pI={class:"flex items-center gap-2.5"},fI={key:0,class:"w-7"},mI=["title","src","alt"],hI={key:1,class:"capitalize"},_I={key:2},vI={class:"fct-table-mobile-gateway-col"},gI={class:"label"},yI={class:"value"},bI={key:0},wI=["href"];function CI(e,t,a,l,s,i){const c=B("Badge"),p=B("el-tooltip"),m=B("ConvertedTime");return r(),h("div",tI,[(r(!0),h(O,null,ae(a.transactions,(_,g)=>{var y,v;return r(),h("div",{class:"fct-table-mobile-row",key:g},[o("div",aI,[o("div",lI,[o("div",sI,[(y=_==null?void 0:_.meta)!=null&&y.reason?(r(),$(p,{key:0,effect:"dark",placement:"top",content:i.translate((v=_==null?void 0:_.meta)==null?void 0:v.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var C,b;return[((C=_==null?void 0:_.meta)==null?void 0:C.disputed)==="yes"&&((b=_==null?void 0:_.meta)==null?void 0:b.dispute_resolved)==="no"?(r(),$(c,{key:0,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"])):(r(),$(c,{key:1,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),$(c,{key:1,status:_.status},{default:d(()=>[R(f(_.status==="paid"?"Completed":_.status),1)]),_:2},1032,["status"]))]),o("div",nI,[o("span",oI,"#"+f(_.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(m,{"date-time":_.created_at},null,8,["date-time"])])]),o("div",iI,f(e.formatNumberForOrder(_.total,a.orderCurrency)),1)]),o("div",rI,[o("ul",dI,[o("li",uI,[o("div",cI,f(i.translate("Payment Method:")),1),o("div",AI,[o("div",pI,[i.getCardBrand(_.card_brand,_.payment_method_type)?(r(),h("div",fI,[o("img",{class:"w-full",title:_.payment_method,src:i.getCardBrand(_.card_brand,_.payment_method_type),alt:_.card_brand},null,8,mI)])):(r(),h("span",hI,f(_.payment_method_type),1)),_.card_last_4&&_.card_last_4!="0"?(r(),h("span",_I,f("..."+_.card_last_4),1)):k("",!0)])])]),o("li",vI,[o("div",gI,f(i.translate("Gateway ID:")),1),o("div",yI,[_.vendor_charge_id===""?(r(),h("span",bI,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:_.url},f(_.vendor_charge_id),9,wI))])])])])])}),128))])}const Cp=lt(eI,[["render",CI]]),BI={key:1,class:"fct-single-order-page"},kI={key:1,class:"fct-single-order-wrapper fct-layout-width"},xI={class:"single-page-header flex items-start justify-between"},SI={class:"single-page-header-title-wrap"},FI={class:"single-page-header-status-wrap"},$I={class:"single-page-header-text"},EI={class:"capitalize"},UI={class:"fct-btn-group sm"},II={class:"single-page-body"},QI={class:"fct-single-order"},DI={class:"fct-single-order-main"},VI={class:"fct-card-header-title is-small"},TI={key:0,class:"fct-browse-product-form-group pb-5"},MI={class:"fct-ordered-product-list-container"},LI={key:0,class:"fct-ordered-product-list-wrapper"},RI={class:"fct-media-content-list -mt-4 w-full"},OI={class:"align-top"},HI=["rowspan"],PI={class:"product-thumbnail w-[46px] flex-shrink-0"},NI=["href"],KI=["src","alt"],GI=["src","alt"],jI={class:""},zI={class:"product-details-content-row"},qI={class:"product-details-content-first flex flex-col"},YI={class:"product-title m-0"},WI=["href"],XI={key:0,class:"product-variation-title m-0"},JI={key:2,class:"product-subscription-info"},ZI=["innerHTML"],eQ=["innerHTML"],tQ={key:0,class:"product-details-quantity"},aQ={key:1,class:"product-details-price-mobile"},lQ={class:"product-details-quantity"},sQ={key:0,class:"del"},nQ={class:"product-details-price-mobile"},oQ={key:0,class:"del"},iQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},rQ={key:0,class:"del"},dQ={class:"fct-order-item-qty-col text-right whitespace-nowrap"},uQ={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},cQ={class:"product-details-quantity"},AQ={key:0,class:"del"},pQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},fQ={class:"fct-order-item-price-col text-right whitespace-nowrap"},mQ={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},hQ={key:0,class:"flex items-center"},_Q={class:"del line-through text-xs font-normal opacity-60 leading-tight"},vQ={colspan:"2",class:""},gQ={class:"fct-tax-badge"},yQ={class:"text-right"},bQ={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},wQ={class:"pb-2"},CQ={key:2},BQ={colspan:"2",class:""},kQ={class:"text-xs text-system-mid dark:text-gray-300"},xQ={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},SQ={colspan:"2",class:"pb-2"},FQ={class:"fct-tax-badge"},$Q={class:"text-right pb-2"},EQ={key:4,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},UQ={class:"pb-2"},IQ={key:5},QQ={colspan:"3"},DQ={class:"product-details-action-row"},VQ=["onClick"],TQ=["onClick"],MQ={key:1,class:"m-0 text-center"},LQ={class:"fct-card-header-title is-small"},RQ={class:"fct-table-border fct-table-order-details"},OQ={key:0},HQ={key:3},PQ={key:4},NQ={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},KQ={key:5},GQ={colspan:"3",class:"px-0"},jQ={class:"fct-tax-sum-box"},zQ={class:"fct-tax-sum-heading flex items-center justify-between"},qQ={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},YQ={key:1,class:"fct-tax-sum-row"},WQ={key:4,class:"fct-tax-sum-row total-pay total-payable-tax-row"},XQ={key:5,class:"fct-tax-sum-row"},JQ={class:"fct-tax-amount fct-tax-amount--reversed"},ZQ={key:6,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},e9={key:7,class:"fct-tax-sum-row fct-tax-sum-row--muted"},t9={class:"total-amount-tr"},a9={class:"payment-tr"},l9={key:6,class:"payment-tr"},s9={key:7,class:"payment-tr"},n9={class:"font-semibold"},o9={key:8,class:"payment-tr"},i9={class:"font-semibold"},r9={key:9,class:"payment-tr total-refund-owed-tr"},d9={class:"flex flex-end m-0 items-center"},u9={class:"font-semibold"},c9={class:"fct-single-order-aside"},A9={class:"fct-admin-sidebar"},p9={key:0},f9={class:"fct-adjust-quantity-modal-content"},m9={class:"title"},h9={class:"fct-form-group"},_9={class:"dialog-footer"},v9={key:0},g9={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:gd,Alert:Za,Transaction:yd,Plans:gp,Badge:Aa,Refresh:Jr,ElMessageBox:Ja,CopyToClipboard:Fa,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,ShippingComponent:wd,UtmDetails:wp,OrderUpDownIndicator:$c,TransactionMobile:Cp,BundleProducts:So,Promotion:$d},provide(){return{triggerChange:this.triggerChange}},data(){return{notFound:{show:!1,message:"",buttonText:"",route:""},warningMessage:"",loading:!1,calculating:!1,customModal:!1,canceling_subscription:!1,reactivate_subscription:!1,fetching_subscription:!1,pausing_subscription:!1,resuming_subscription:!1,processing_refund:!1,nextInvoiceModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{item_name:"",item_price:0,quantity:1,is_physical:"yes"},transactionMedium:!1,otherData:{payment_method:"offline_payment",mark_paid_note:"",vendor_charge_id:""},paymentMethodOption:[{name:"Others",value:"others"}],timeout:"",widgets:[],order:!1,searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",actionableActivities:[],isSubscription:!1,subscriptionStatus:"",showManageActivity:!1,change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,showRefundModal:!1,isEditingItem:!1,shouldDisableEditing:!1,adjustQuantityModal:!1,adjustItem:[],selectedLabels:[],tmpAdjustedItem:{},coupons:[],appliedCoupons:[],hasCoupon:!1,shippingMethods:[],otherShippingMethods:[],uniqueItemsCount:0,markingOrderAsPaid:!1,sendingPaymentReminder:!1,canSendPaymentReminderFlag:!1,isMobile:window.innerWidth<768}},watch:{order:{handler(e,t){this.changes_made++},deep:!0},order_id:{handler(e,t){this.changeTitle("Order #"+e),this.changes_made=0,this.fetch()}}},computed:{parentOrderId(){return!this.order||!this.order.parent_id?null:this.order.parent_id!=="0"?this.order.parent_id:null},transactionType(){return"charge"},placeholderImage(){return`${ze.get("asset_url")}images/empty-image.svg`},canSendPaymentReminder(){return this.canSendPaymentReminderFlag},feeItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>e.payment_type==="fee")},taxSummary(){const e=this.order.tax_summary||{};return{inclusiveTax:e.inclusiveTax||0,exclusiveTax:e.exclusiveTax||0,feeTaxLines:e.feeTaxLines||[],feeTaxLineRows:e.feeTaxLineRows||[],inclusiveFeeTax:e.inclusiveFeeTax||0,shippingTax:e.shippingTax||0,shippingTaxLines:e.shippingTaxLines||[],payableTax:e.payableTax||0,totalOrderTax:e.totalOrderTax||0,isShippingInclusive:e.isShippingInclusive||!1,reversedTaxTotal:e.reversedTaxTotal||0,reversedShippingTax:e.reversedShippingTax||0,rcShippingAdjustment:e.rcShippingAdjustment||0,rcTotalAdjustment:e.rcTotalAdjustment||0,showRcShippingRow:e.showRcShippingRow||!1}},taxBreakdownShouldShow(){const e=this.taxSummary;let t=0;return e.inclusiveTax>0&&t++,e.exclusiveTax>0&&t++,t+=e.feeTaxLineRows.filter(function(a){return a.tax_amount>0}).length,e.shippingTax>0&&t++,t>=2?!0:t===0?!1:!(e.payableTax>0||e.inclusiveTax>0||e.inclusiveFeeTax>0)},setupFeeSiblingMap(){if(!this.order||!Array.isArray(this.order.order_items))return{};var e={};return this.order.order_items.forEach(function(t){t.payment_type==="signup_fee"&&(t.line_meta&&t.line_meta.parent_item_id&&(e[t.line_meta.parent_item_id]=t),t.object_id&&!e["obj_"+t.object_id]&&(e["obj_"+t.object_id]=t))}),e}},methods:{confirmSendPaymentReminder(){Ja.confirm(u("Are you sure you want to send a payment reminder email for this order?"),u("Send Payment Reminder"),{type:"info",icon:Gs($d),cancelButtonText:u("Cancel"),confirmButtonText:u("Send Now"),beforeClose:async(e,t,a)=>{var l;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const s=await this.$post("email-notification/send-manual-reminder",{event:"invoice_reminder_overdue",entity_id:this.order.id});z.success(s.message||u("Payment reminder sent successfully"))}catch(s){z.error(((l=s.data)==null?void 0:l.message)||u("Failed to send payment reminder"))}finally{t.confirmButtonLoading=!1,this.sendingPaymentReminder=!1,a()}else a()}})},triggerChange(){this.changes_made=1},handleResize(){this.isMobile=window.innerWidth<768},formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},getDueRefund(){var e;return this.formatNumber(Math.abs(parseFloat(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid))+parseFloat(this.order.total_refund)))},triggerRefundModal(){this.showRefundModal=!0},getNetPayment(){var e;return this.formatNumber(this.order.total_paid-((e=this.order)==null?void 0:e.total_refund))},getTotalDue(){var e;return this.formatNumber(Math.abs(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid)))},markOrderAsPaid(){this.markingOrderAsPaid||(this.markingOrderAsPaid=!0,ce.post("orders/"+this.order_id+"/mark-as-paid",{...this.otherData,transaction_type:this.transactionType}).then(e=>{this.markingOrderAsPaid=!1,this.transactionMedium=!1,z.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}))},handleCommand(e){e==="custom-payment-link"?this.nextInvoiceModal=!0:e==="send-payment-reminder"?this.confirmSendPaymentReminder():this.transactionMedium=!0},shouldSkipAdjustmentItem(e){return!(this.order.order_items.some(a=>a.payment_type==="subscription")&&e.payment_type==="adjustment")},handleAdjustQuantityModal(e){this.adjustItem={},this.adjustQuantityModal=!0,this.adjustItem=e},getImageUrl(e){var l,s,i,c;const t=(l=e==null?void 0:e.variants)==null?void 0:l.media;if(t&&Array.isArray(t.meta_value)&&((s=t.meta_value[0])!=null&&s.url))return t.meta_value[0].url;const a=(c=(i=e==null?void 0:e.variants)==null?void 0:i.product_detail)==null?void 0:c.featured_media;return!t&&a&&typeof a=="object"&&a!==null?a.url:this.placeholderImage},getClass(e){let t=null;return e.featured_media!=null&&(t=this.getImageUrl(e)),{"w-full":!0,"border border-solid border-gray-divider rounded":t&&t!==null&&t!==void 0}},shouldShowRefund(){var t;if(!this.order||(t=this.order.config)!=null&&t.upgraded_to)return!1;const e=parseInt(this.order.total_paid/100);return this.order.payment_status!=="refunded"&&e>0&&e>=parseInt(this.order.total_refund/100)},enableItemEditing(){this.isEditingItem=!0,this.fetchShippingMethods()},disableItemEditing(){this.isEditingItem=!1},handlePaymentActions(e){this.changes_made=0,e==="refund"?this.showRefundModal=!0:e==="create_next_invoice"&&(this.nextInvoiceModal=!0)},getOrderUrl(e){const t=ze.get("dashboard_url")+"/orders/"+e+"/view";window.location=t},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){this.tmpAdjustedItem={quantity:e,updatedStock:t,item:a}},saveAdjustedProductQuantity(e){this.adjustQuantityModal=!1,Object.keys(e).length>0&&(parseInt(e.updatedStock)<0?z.error(u("You have exceeded the stock limit! Current stock is : %s",e.updatedStock)):e.item.quantity=e.quantity,e.item.updated_stock=e.updatedStock,this.calculateLine())},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():bd(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){var a;this.loading=!0;const e={...this.order};delete e.customer,delete e.note,e.metaValue=((a=this.$refs.dynamicTemplates)==null?void 0:a.getFormStates())||{};const t={...e,deletedItems:this.deletedItems,discount:this.discount,shipping:this.shippingSettings};ce.post("orders/"+this.order_id,t).then(l=>{z.success(l.message),this.fetch()}).catch(l=>{var s;l.status_code=="422"?z.validationErrors(l):z.error((s=l.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,ce.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,l,s,i;this.coupons=e.order.applied_coupons||[],this.hasCoupon=this.coupons.length>0,this.appliedCoupons=this.coupons.map(c=>c.coupon_id),this.order=e.order,this.order.order_items=this.formatOrderItems(e.order.order_items),e.checkout_shipping&&(this.order.checkout_shipping=e.checkout_shipping),this.canSendPaymentReminderFlag=!!e.can_send_payment_reminder,this.isSubscription=((t=this.order)==null?void 0:t.subscriptions)&&this.order.subscriptions.length>0,this.isSubscription&&(this.subscriptionStatus=(a=this.order.subscriptions[0])==null?void 0:a.status),this.shouldDisableEditing=["completed","archived","canceled"].includes(this.order.status)||this.isSubscription||this.order.payment_status==="paid",["completed","archived","canceled"].includes(this.order.status)&&(this.warningMessage=u("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=u("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=u("Subscription Order cannot be edited.")),this.orderSettings=e.order_settings,this.widgets=e.widgets,this.selectedProducts=this.availableProducts=[],this.discount.value=((l=e.discount_meta)==null?void 0:l.value)||0,this.discount.reason=((s=e.discount_meta)==null?void 0:s.reason)||"",this.discount.type=((i=e.discount_meta)==null?void 0:i.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=lm(e.order),e.shipping_meta&&e.shipping_meta.type?this.shippingSettings=e.shipping_meta:e.checkout_shipping&&e.checkout_shipping.method_id&&(this.shippingSettings={id:e.checkout_shipping.method_id}),yp(this.discount),this.order.order_items.find(c=>c.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(c=>{var p;return{...c,quantity:Number(c.quantity),updated_stock:parseInt((c==null?void 0:c.available)||((p=c==null?void 0:c.variants)==null?void 0:p.available))+parseInt(c.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),Se(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(z.error(rt.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,(["completed","archived","canceled"].includes(this.order.status)||["unshippable"].includes(this.order.shipping_status))&&this.disableItemEditing()})},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t,a){a&&a.id&&(this.shippingSettings=a),this.changes_made++},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},clearActivityAction(e){ce.put("activity/"+e.id+"/mark-read",{id:e.id,status:"read"}).then(t=>{this.actionableActivities=this.actionableActivities.filter(a=>a.id!==e.id),this.handleSuccess(t==null?void 0:t.message)}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)})},renderActionables(){var a;let e=(a=this==null?void 0:this.order)==null?void 0:a.activities;const t=["warning","error"];this.actionableActivities=e==null?void 0:e.filter(l=>(l==null?void 0:l.read_status)==="unread"&&t.includes(l==null?void 0:l.status))},getCustomerTotalOrders(e){return e>0?e+" "+(e==1?this.$t("order"):this.$t("orders")):this.$t("No orders")},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},saveNoteModal(e){this.order.note=e},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.payment_type&&l.payment_type===t)).length>0},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.get("orders/shipping_methods",{country_code:this.order.customer.country,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})},formatOrderItems:$f,getProductRowSpan(e){var t=1,a=this.getItemTaxRates(e);a.length>0?t+=a.length:e.tax_amount>0&&(t+=1),e.other_info&&e.other_info.manage_setup_fee==="yes"&&(t+=1);var l=this.getSubscriptionSetupFeeTaxRates(e);return l.length>0?t+=l.length:e.other_info&&e.other_info.signup_fee_tax>0&&e.other_info.manage_setup_fee==="yes"&&(t+=1),this.isEditingItem&&(t+=1),t},getItemTaxRates(e){var t=e.line_meta&&e.line_meta.tax_config?e.line_meta.tax_config.rates:null;return Array.isArray(t)?t.filter(function(a){return a.tax_amount>0}):[]},getSetupFeeSibling(e){return this.setupFeeSiblingMap[e.id]||this.setupFeeSiblingMap["obj_"+e.object_id]||null},getSubscriptionSetupFeeTaxRates(e){var t=this.getSetupFeeSibling(e);if(!t)return[];var a=t.line_meta&&t.line_meta.tax_config&&Array.isArray(t.line_meta.tax_config.rates)?t.line_meta.tax_config.rates:t.line_meta&&Array.isArray(t.line_meta.rates)?t.line_meta.rates:null;return Array.isArray(a)?a.filter(function(l){return l.tax_amount>0}):[]},isSubscriptionSetupFeeInclusive(e){var t=this.getSetupFeeSibling(e);if(!t||!t.line_meta)return!1;var a=t.line_meta.tax_config&&typeof t.line_meta.tax_config=="object"?t.line_meta.tax_config:t.line_meta;return!!a.inclusive},getItemDisplayLineTotal(e){return Math.max(0,parseInt(e.line_total||0))},shouldShowUnitPriceRoundingTooltip(e){var t=parseInt(e.quantity||1),a=parseInt(e.unit_price||0),l=parseInt(e.line_total||0);if(t<2||a<=0||l<=0)return!1;var s=Math.abs(a*t-l);return s>0&&s<=t},formatTaxRateBadge(e){return(e.label||u("Tax"))+" ("+e.rate_percent+"%)"},onBusinessInfoOrderUpdated(e){if(!e)return;const t={business_info:e.business_info,is_reverse_charge_tax_order:e.is_reverse_charge_tax_order,customer_tax_number:e.customer_tax_number,is_b2b_order:e.is_b2b_order,tax_total:e.tax_total,shipping_tax:e.shipping_tax,tax_behavior:e.tax_behavior,total_amount:e.total_amount,total_paid:e.total_paid,payment_status:e.payment_status,tax_summary:e.tax_summary,display_tax_lines:e.display_tax_lines,display_shipping_tax_lines:e.display_shipping_tax_lines};Object.keys(t).forEach(a=>{t[a]===void 0&&delete t[a]}),this.order=Object.assign({},this.order,t)}},mounted(){this.changeTitle("Order #"+this.order_id),this.fetch(),window.onbeforeunload=()=>{if(this.changes_made>1)return!0},(ze.get("payment_routes")??[]).filter(t=>!(t!=null&&t.upcoming)).forEach(t=>{var a;this.paymentMethodOption.unshift({name:(a=t==null?void 0:t.meta)==null?void 0:a.title,value:t==null?void 0:t.path})}),window.addEventListener("resize",this.handleResize)},beforeUnmount(){window.removeEventListener("resize",this.handleResize)}},y9=Object.assign(g9,{setup(e){const t=V(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var Q,E;const c=B("el-breadcrumb-item"),p=B("el-breadcrumb"),m=B("el-button"),_=B("el-tooltip"),g=B("el-input"),y=B("router-link"),v=B("el-icon"),C=B("el-dropdown-item"),b=B("el-dropdown-menu"),w=B("el-dropdown"),x=B("el-option"),F=B("el-select"),L=B("el-form-item"),U=B("el-form"),S=B("el-dialog"),M=B("el-skeleton-item"),I=B("el-skeleton"),T=Va("loading");return r(),h(O,null,[s.notFound.show?(r(),$(ai,{key:0,"button-text":s.notFound.buttonText,message:s.notFound.message,route:s.notFound.route},null,8,["button-text","message","route"])):k("",!0),s.notFound.show===!1?(r(),h("div",BI,[n(an,{isActive:s.changes_made>=1&&!s.showRefundModal?"is-active":"",onDiscard:s.reloadOrder,onSave:s.update,loading:s.loading,saveButtonText:A(u)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),s.loading?(r(),$(XU,{key:0})):k("",!0),s.order?(r(),h("div",kI,[!s.loading&&s.order?(r(),h(O,{key:0},[o("div",xI,[o("div",null,[o("div",SI,[n(p,{"separator-icon":A(rl)},{default:d(()=>[n(c,{to:{name:"orders"}},{default:d(()=>[R(f(A(u)("Orders")),1)]),_:1}),s.parentOrderId?(r(),$(c,{key:0,to:{name:"view_order",params:{}}},{default:d(()=>[o("a",{onClick:i[0]||(i[0]=D=>s.getOrderUrl(s.parentOrderId))}," #"+f(s.parentOrderId),1)]),_:1})):k("",!0),n(c,null,{default:d(()=>[R(" #"+f(A(Xt)(e.order_id)),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",FI,[n(Aa,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(r(),$(Aa,{key:0,type:"blue",text:A(u)("B2B")},null,8,["text"])):k("",!0),n($c,{order:s.order},null,8,["order"])])]),o("div",$I,[n(Pa,{"date-time":s.order.created_at,"with-time":""},null,8,["date-time"]),i[23]||(i[23]=o("span",{class:"fct_separator"},null,-1)),s.order.invoice_no?(r(),h(O,{key:0},[o("span",null,f(s.order.invoice_no),1),i[22]||(i[22]=o("span",{class:"fct_separator"},null,-1))],64)):k("",!0),o("span",EI,f(s.order.type),1)])]),o("div",UI,[s.shouldShowRefund()?(r(),$(m,{key:0,onClick:i[1]||(i[1]=D=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(f(A(u)("Refund")),1)]),_:1})):k("",!0),s.isEditingItem?(r(),$(m,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(f(A(u)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),$(m,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[s.shouldDisableEditing?(r(),$(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(f(s.warningMessage),1)]),default:d(()=>[R(" "+f(A(u)("Edit")),1)]),_:1})):(r(),h(O,{key:1},[R(f(A(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(gd,{onReload:i[2]||(i[2]=D=>s.reloadOrder()),onAddItem:a,onAddProduct:s.addProduct,onEnableItemEditing:s.enableItemEditing,onDisableItemEditing:s.disableItemEditing,onHandlePaymentActions:s.handlePaymentActions,"is-editing-item":s.isEditingItem,order:s.order,triggerMode:s.isMobile?"":"button",shouldShowRefund:s.shouldShowRefund(),warningMessage:s.warningMessage},null,8,["onAddProduct","onEnableItemEditing","onDisableItemEditing","onHandlePaymentActions","is-editing-item","order","triggerMode","shouldShowRefund","warningMessage"])])]),o("div",II,[(r(!0),h(O,null,ae(s.actionableActivities,D=>(r(),$(Za,{class:"mb-5",type:"error",key:D.id,content:D==null?void 0:D.content,closable:"",onClose:H=>s.clearActivityAction(D)},null,8,["content","onClose"]))),128)),o("div",QI,[o("div",DI,[n(xe,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>{var D,H;return[o("h2",VI,[R(f(A(u)("Order items"))+" ",1),((D=s.order)==null?void 0:D.fulfillment_type)==="physical"?(r(),$(Aa,{key:0,status:(H=s.order)==null?void 0:H.shipping_status},{default:d(()=>{var P;return[R(f((P=s.order)==null?void 0:P.shipping_status),1)]}),_:1},8,["status"])):k("",!0)])]}),_:1}),n(ke,null,{default:d(()=>[s.isEditingItem?(r(),h("div",TI,[n(g,{placeholder:A(u)("Search products..."),onKeyup:i[3]||(i[3]=D=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=D=>s.searchQuery=D)},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(m,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(f(A(u)("Browse")),1)]),_:1})])):k("",!0),o("div",MI,[s.order.order_items.length>0?(r(),h("div",LI,[o("table",RI,[o("tbody",null,[(r(!0),h(O,null,ae(s.order.order_items,(D,H)=>{var P,G,J,oe,Z,W,pe,N,j,q,X,ie,ge,fe;return r(),h(O,{key:H},[D.payment_type!=="signup_fee"&&D.payment_type!=="fee"&&((P=D==null?void 0:D.other_info)==null?void 0:P.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(D)?(r(),h(O,{key:0},[o("tr",OI,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(D)},[o("div",PI,[D!=null&&D.is_custom?(r(),h("a",{key:0,href:(G=D==null?void 0:D.other_info)==null?void 0:G.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:D.featured_media!=null?D.featured_media:s.getImageUrl(D),alt:D.title,class:de([s.getClass(D),"h-full object-contain rounded"])},null,10,KI)],8,NI)):(r(),$(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:D==null?void 0:D.post_id}}},{default:d(()=>[o("img",{src:D.featured_media!=null?D.featured_media:s.getImageUrl(D),alt:D.title,class:de([s.getClass(D),"h-full object-contain rounded"])},null,10,GI)]),_:2},1032,["to"]))])],8,HI),o("td",jI,[o("div",zI,[o("div",qI,[o("div",YI,[D!=null&&D.is_custom?(r(),h("a",{key:0,href:(J=D==null?void 0:D.other_info)==null?void 0:J.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},f(D==null?void 0:D.post_title),9,WI)):(r(),$(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:D==null?void 0:D.post_id}}},{default:d(()=>[R(f(D==null?void 0:D.post_title),1)]),_:2},1032,["to"]))]),(D!=null&&D.variation_display_title||D!=null&&D.title)&&(D==null?void 0:D.title)!==(D==null?void 0:D.post_title)?(r(),h("div",XI," – "+f((D==null?void 0:D.variation_display_title)||(D==null?void 0:D.title)),1)):k("",!0),D.bundle_items.length>0?(r(),$(So,{key:1,product:D},null,8,["product"])):k("",!0),(D==null?void 0:D.payment_type)==="subscription"?(r(),h("div",JI,[o("div",{innerHTML:D==null?void 0:D.payment_info},null,8,ZI),((oe=D==null?void 0:D.other_info)==null?void 0:oe.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:D==null?void 0:D.setup_info},null,8,eQ)):k("",!0)])):k("",!0)]),s.isEditingItem?(r(),h("div",tQ,[o("span",null,f(s.formatNumber(D.unit_price)),1),i[24]||(i[24]=o("span",null,"x",-1)),o("span",null,f(A(Xt)(D.quantity)),1)])):k("",!0),s.isEditingItem?k("",!0):(r(),h("div",aQ,[o("div",lQ,[((Z=D==null?void 0:D.variants)==null?void 0:Z.length)>0?(r(),h("span",sQ,f(s.formatNumber(D.variants.compare_price)),1)):k("",!0),o("span",null,f(s.formatNumber(D.unit_price)),1),i[25]||(i[25]=o("span",null,"x",-1)),o("span",null,f(A(Xt)(D.quantity)),1)])])),D.bundle_items.length>0?(r(),$(So,{key:2,product:D},null,8,["product"])):k("",!0)]),o("div",nQ,[((W=D==null?void 0:D.variants)==null?void 0:W.length)>0?(r(),h("span",oQ,f(s.formatNumber(D.variants.compare_price)),1)):k("",!0),D.line_meta&&D.line_meta.original_unit_price?(r(),h("span",iQ,f(s.formatNumber(D.line_meta.original_unit_price)),1)):k("",!0),o("span",null,f(s.formatNumber(D.unit_price)),1),i[27]||(i[27]=o("span",null,"×",-1)),o("span",null,f(A(Xt)(D.quantity)),1),((pe=D==null?void 0:D.other_info)==null?void 0:pe.item_status)!=="adjusted"?(r(),h(O,{key:2},[i[26]||(i[26]=o("span",{class:"text-system-mid"},"·",-1)),D.coupon_discount>0?(r(),h("span",rQ,f(s.formatNumber(D.subtotal)),1)):k("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(D))),1)],64)):k("",!0)])]),o("td",dQ,[s.isEditingItem?k("",!0):(r(),h("div",uQ,[o("div",cQ,[((N=D==null?void 0:D.variants)==null?void 0:N.length)>0?(r(),h("span",AQ,f(s.formatNumber(D.variants.compare_price)),1)):k("",!0),D.line_meta&&D.line_meta.original_unit_price?(r(),h("span",pQ,f(s.formatNumber(D.line_meta.original_unit_price)),1)):k("",!0),o("span",null,f(s.formatNumber(D.unit_price)),1),i[28]||(i[28]=o("span",null,"x",-1)),o("span",null,f(A(Xt)(D.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(D)?(r(),$(_,{key:2,effect:"dark",content:A(u)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,{class:"fct-unit-price-rounding-icon"},{default:d(()=>[n(A(nl))]),_:1})]),_:1},8,["content"])):k("",!0)])]))]),o("td",fQ,[o("div",mQ,[((j=D==null?void 0:D.other_info)==null?void 0:j.item_status)!=="adjusted"?(r(),h(O,{key:0},[D.coupon_discount>0?(r(),h("div",hQ,[o("span",_Q,f(s.formatNumber(D.subtotal)),1)])):k("",!0),o("span",null,f(s.formatNumber(s.getItemDisplayLineTotal(D))),1)],64)):k("",!0)])])]),s.getItemTaxRates(D).length?(r(!0),h(O,{key:0},ae(s.getItemTaxRates(D),(he,le)=>{var me,Ue,et;return r(),h("tr",{key:"tax-rate-"+le,class:de(D.line_meta&&D.line_meta.tax_config&&D.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",vQ,[o("span",gQ,f(s.formatTaxRateBadge(he)),1)]),o("td",yQ,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((Ue=(me=D.line_meta)==null?void 0:me.tax_config)!=null&&Ue.inclusive)||((et=s.orderSettings)==null?void 0:et.reverse_charge_price_mode)==="dynamic")}])},[D.line_meta&&D.line_meta.tax_config&&D.line_meta.tax_config.inclusive?(r(),h(O,{key:0},[R(f(A(u)("incl.")),1)],64)):(r(),h(O,{key:1},[R("+")],64)),R(" "+f(s.formatNumber(he.tax_amount)),1)],2)])],2)}),128)):D.tax_amount>0?(r(),h("tr",bQ,[o("td",wQ,f(A(u)("Tax"))+": "+f(s.formatNumber(D.tax_amount)),1)])):k("",!0),((q=D==null?void 0:D.other_info)==null?void 0:q.manage_setup_fee)==="yes"?(r(),h("tr",CQ,[o("td",BQ,[o("span",kQ,f(D==null?void 0:D.other_info.signup_fee_name),1)]),o("td",xQ," + "+f(s.formatNumber(((X=D==null?void 0:D.other_info)==null?void 0:X.setup_fee_per_item)==="yes"?D.other_info.signup_fee*D.quantity:D.other_info.signup_fee)),1)])):k("",!0),s.getSubscriptionSetupFeeTaxRates(D).length?(r(!0),h(O,{key:3},ae(s.getSubscriptionSetupFeeTaxRates(D),(he,le)=>{var me;return r(),h("tr",{key:"setup-tax-rate-"+le,class:de(s.isSubscriptionSetupFeeInclusive(D)?"is-inclusive":"is-exclusive")},[o("td",SQ,[o("span",FQ,f(A(u)("Setup fee"))+": "+f(s.formatTaxRateBadge(he)),1)]),o("td",$Q,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(D)||((me=s.orderSettings)==null?void 0:me.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(D)?(r(),h(O,{key:0},[R(f(A(u)("incl.")),1)],64)):k("",!0),R(f(s.formatNumber(he.tax_amount)),1)],2)])],2)}),128)):((ie=D==null?void 0:D.other_info)==null?void 0:ie.signup_fee_tax)>0&&((ge=D==null?void 0:D.other_info)==null?void 0:ge.manage_setup_fee)==="yes"?(r(),h("tr",EQ,[o("td",UQ,[R(f(A(u)("Setup fee tax"))+": ",1),o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(D)||((fe=s.orderSettings)==null?void 0:fe.reverse_charge_price_mode)==="dynamic")}])},f(s.formatNumber(D.other_info.signup_fee_tax)),3)])])):k("",!0),s.isEditingItem?(r(),h("tr",IQ,[o("td",QQ,[o("div",DQ,[o("a",{href:"#",onClick:Ne(he=>s.handleAdjustQuantityModal(D),["prevent"])},f(A(u)("Adjust Quantity")),9,VQ),o("a",{href:"#",onClick:Ne(he=>s.deleteProduct(H,D),["prevent"])},f(A(u)("Remove Item")),9,TQ)])])])):k("",!0),i[29]||(i[29]=o("tr",{class:"last:hidden"},[o("td",{colspan:"4",class:"pt-1"},[o("div",{class:"bg-gray-divider dark:bg-dark-400 h-[1px] w-full mb-1"})])],-1))],64)):k("",!0)],64)}),128))])])])):k("",!0),s.order.order_items.length==0?(r(),h("p",MQ,f(A(u)("No items found.")),1)):k("",!0)])]),_:1})]),_:1}),n(xe,{class:"fct-order-payment-card"},{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h2",LQ,[o("span",null,f(A(u)("Payment")),1),n(Aa,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(ke,null,{default:d(()=>{var D,H,P,G,J,oe,Z;return[o("table",RQ,[o("tbody",null,[o("tr",null,[o("td",null,f(A(u)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),h("span",OQ,f(A(Xt)(s.uniqueItemsCount))+" "+f(A(Bo)("item","items",s.uniqueItemsCount)),1)):k("",!0)]),o("td",null,f(s.formatNumber(s.order.subtotal)),1)]),n(wd,{order:s.order,shippingAttributes:s.shippingSettings,shouldEnableEditing:s.isEditingItem,"onUpdate:shipping":s.updateShipping,shippingMethodsProps:s.shippingMethods,otherShippingMethodsProps:s.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),s.order.fee_total>0?(r(!0),h(O,{key:0},ae(s.feeItems,W=>(r(),h("tr",{key:"fee-"+W.id},[o("td",null,f(W.title),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(W.subtotal)),1)]))),128)):k("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),$(yi,{key:1,order:s.order,couponsAttributes:s.coupons,hasCouponAttributes:s.hasCoupon,appliedCouponsAttributes:s.appliedCoupons,action:"edit_order",shouldManageCoupon:s.isEditingItem,"onUpdate:coupons":s.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","couponsAttributes","hasCouponAttributes","appliedCouponsAttributes","shouldManageCoupon","onUpdate:coupons"])):k("",!0),s.hasCoupon?k("",!0):(r(),$(bi,{key:2,order:s.order,discountAttributes:s.discount,hasCoupon:s.hasCoupon,shouldEnableEditing:s.isEditingItem,"onUpdate:customDiscount":s.updateCustomDiscount},null,8,["order","discountAttributes","hasCoupon","shouldEnableEditing","onUpdate:customDiscount"])),!s.hasCoupon&&s.order.coupon_discount_total>0?(r(),h("tr",HQ,[o("td",null,f(A(u)("Coupon Discount")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber(s.order.coupon_discount_total)),1)])):k("",!0),s.isEditingItem?(r(),h("tr",PQ,[o("td",NQ,f(A(u)("Tax will be recalculated on save")),1)])):s.taxSummary.payableTax>0||s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedShippingTax>0?(r(),h("tr",KQ,[o("td",GQ,[o("div",jQ,[o("div",zQ,[o("span",null,f(A(u)("tax summary")),1)]),s.taxSummary.inclusiveTax>0&&s.taxBreakdownShouldShow?(r(),h("div",qQ,[o("span",null,f(A(u)("Included in item prices")),1),o("span",null,f(s.formatNumber(s.taxSummary.inclusiveTax)),1)])):k("",!0),s.taxSummary.exclusiveTax>0&&s.taxBreakdownShouldShow?(r(),h("div",YQ,[o("span",null,f(A(u)("Added on products")),1),o("span",null,f(s.formatNumber(s.taxSummary.exclusiveTax)),1)])):k("",!0),s.taxSummary.feeTaxLineRows&&s.taxSummary.feeTaxLineRows.length&&s.taxBreakdownShouldShow?(r(!0),h(O,{key:2},ae(s.taxSummary.feeTaxLineRows,(W,pe)=>(r(),h("div",{key:pe,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":W.inclusive}])},[o("span",null,f(W.display_label),1),o("span",null,f(s.formatNumber(W.tax_amount)),1)],2))),128)):k("",!0),s.taxSummary.shippingTax>0&&s.taxBreakdownShouldShow?(r(),h(O,{key:3},[s.taxSummary.shippingTaxLines&&s.taxSummary.shippingTaxLines.length?(r(!0),h(O,{key:0},ae(s.taxSummary.shippingTaxLines,W=>(r(),h("div",{key:W.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":s.taxSummary.isShippingInclusive}])},[o("span",null,f(W.label),1),o("span",null,f(s.formatNumber(W.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":s.taxSummary.isShippingInclusive}])},[o("span",null,f(s.taxSummary.isShippingInclusive?A(u)("Included in shipping prices"):A(u)("Added on shipping")),1),o("span",null,f(s.formatNumber(s.taxSummary.shippingTax)),1)],2))],64)):k("",!0),s.taxSummary.payableTax>0?(r(),h("div",WQ,[o("span",null,f(A(u)("Total payable tax")),1),o("span",null,f(s.formatNumber(s.taxSummary.payableTax)),1)])):k("",!0),s.order.is_reverse_charge_tax_order&&s.taxSummary.showRcShippingRow&&s.taxSummary.reversedShippingTax>0?(r(),h("div",XQ,[o("span",null,f(A(u)("Added on shipping")),1),o("span",JQ,f(s.formatNumber(s.taxSummary.reversedShippingTax)),1)])):k("",!0),s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0?(r(),h("div",ZQ,[o("span",null,f(A(u)("Tax reversed")),1),o("span",null,f(s.formatNumber(s.taxSummary.reversedTaxTotal)),1)])):k("",!0),s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0?(r(),h("div",e9,[o("span",null,f(A(u)("Total tax in this order")),1),o("span",null,f(s.formatNumber(s.taxSummary.totalOrderTax)),1)])):k("",!0)])])])):k("",!0),o("tr",t9,[o("td",null,f(A(u)("Total")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,f(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",a9,[o("td",null,f(A(u)("Total Paid")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",null,f(s.formatNumber((D=s.order)==null?void 0:D.total_paid)),1)]),((H=s.order)==null?void 0:H.total_refund)>0?(r(),h("tr",l9,[o("td",null,f(A(u)("Total Refund")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",null,"- "+f(s.formatNumber((P=s.order)==null?void 0:P.total_refund)),1)])):k("",!0),s.order.total_paid-((G=s.order)==null?void 0:G.total_refund)!=0?(r(),h("tr",s9,[o("td",null,f(A(u)("Net Payment")),1),i[35]||(i[35]=o("td",null,null,-1)),o("td",n9,f(s.getNetPayment()),1)])):k("",!0),s.order.total_amount-((J=s.order)==null?void 0:J.total_paid)>0?(r(),h("tr",o9,[o("td",null,f(A(u)("Total Due")),1),i[36]||(i[36]=o("td",null,null,-1)),o("td",i9,f(s.getTotalDue()),1)])):k("",!0),s.order.total_amount-(((oe=s.order)==null?void 0:oe.total_paid)-((Z=s.order)==null?void 0:Z.total_refund))<0?(r(),h("tr",r9,[o("td",null,[o("p",d9,[n(A(Df),{class:"w-6 text-amber-500 mr-2"}),R(" "+f(A(u)("Total Refund Owed")),1)])]),i[37]||(i[37]=o("td",null,null,-1)),o("td",u9,f(s.getDueRefund()),1)])):k("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?jt((r(),$(xe,{key:0,"element-loading-text":"Cancelling in progress...",class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Transaction Details"),border_bottom:"",title_size:"small"},{action:d(()=>{var D;return[s.order.total_amount-((D=s.order)==null?void 0:D.total_paid)>0&&s.order.status!=="canceled"&&s.markingOrderAsPaid===!1?(r(),$(w,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:d(()=>[n(b,null,{default:d(()=>[n(C,{command:"custom-payment-link"},{default:d(()=>[R(f(A(u)("Custom Payment Link"))+" ",1),n(_,{effect:"dark",content:A(u)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,null,{default:d(()=>[n(A(nl))]),_:1})]),_:1},8,["content"])]),_:1}),n(C,{command:"mark-order-paid"},{default:d(()=>[R(f(A(u)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),$(C,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:d(()=>[R(f(A(u)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):k("",!0)]),_:1})]),default:d(()=>[n(m,{size:"small"},{default:d(()=>[R(f(A(u)("Collect Payments"))+" ",1),n(ee,{name:"ChevronDown"})]),_:1}),n(ee,{name:"More"})]),_:1},8,["onCommand"])):k("",!0)]}),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[n(yd,{onReload:i[5]||(i[5]=D=>s.reloadOrder()),onTriggerRefundModal:s.triggerRefundModal,transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["onTriggerRefundModal","transactions","order_id","order-currency"]),n(Cp,{onReload:i[6]||(i[6]=D=>s.reloadOrder()),transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["transactions","order_id","order-currency"])]),_:1})]),_:1})),[[T,s.canceling_subscription]]):k("",!0),n(S,{title:A(u)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=D=>s.transactionMedium=D)},{footer:d(()=>[jt((r(),$(m,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:d(()=>[R(f(A(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[T,s.markingOrderAsPaid]])]),default:d(()=>[o("div",null,[n(U,{"label-position":"top"},{default:d(()=>[n(L,{"label-position":"top",label:A(u)("Payment method")},{default:d(()=>[n(F,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=D=>s.otherData.payment_method=D)},{default:d(()=>[(r(!0),h(O,null,ae(s.paymentMethodOption,D=>(r(),$(x,{key:D.value,label:D.name,value:D.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(L,{"label-position":"top",label:A(u)("Vendor charge id")},{default:d(()=>[n(g,{modelValue:s.otherData.vendor_charge_id,"onUpdate:modelValue":i[8]||(i[8]=D=>s.otherData.vendor_charge_id=D)},null,8,["modelValue"])]),_:1},8,["label"]),n(L,{"label-position":"top",label:A(u)("Notes")},{default:d(()=>[n(g,{rows:2,type:"textarea",placeholder:A(u)("Please enter the payment note..."),modelValue:s.otherData.mark_paid_note,"onUpdate:modelValue":i[9]||(i[9]=D=>s.otherData.mark_paid_note=D)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(r(),$(xe,{key:1,class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Licenses"),title_size:"small"},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(zr,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):k("",!0),n(xe,{class:"overflow-hidden mb-0"},{default:d(()=>[n(Ve,{title:A(u)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(Ic,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",c9,[o("div",A9,[(r(!0),h(O,null,ae(s.order.subscriptions,(D,H)=>(r(),$(d5,{key:D.id,subscription:D,order:s.order,orderId:e.order_id,index:H,onFetchOrder:i[11]||(i[11]=P=>s.$emit("fetch")),onReload:i[12]||(i[12]=P=>s.reloadOrder()),getOrderUrl:s.getOrderUrl},null,8,["subscription","order","orderId","index","getOrderUrl"]))),128)),s.order.customer?(r(),$(Zo,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):k("",!0),n(gi,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(Jo,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(Q=s.order)!=null&&Q.order_operation?(r(),$(wp,{key:1,order_operation:(E=s.order)==null?void 0:E.order_operation},null,8,["order_operation"])):k("",!0)]),s.order?(r(),h("div",p9,[n(nn,{ref:"dynamicTemplates",filter:"single_order_page","widgets-query":{order_uuid:s.order.uuid,order_id:s.order.id},data:{order:s.order}},null,8,["widgets-query","data"])])):k("",!0)])]),n(S,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[15]||(i[15]=D=>s.adjustQuantityModal=D),title:A(u)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:i[16]||(i[16]=()=>{s.adjustQuantityModal=!1,s.adjustItem={},s.tmpAdjustedItem={}})},{footer:d(()=>[o("div",_9,[n(m,{onClick:i[13]||(i[13]=D=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(m,{type:"primary",onClick:i[14]||(i[14]=D=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:d(()=>[R(f(A(u)("Done")),1)]),_:1})])]),default:d(()=>[o("div",f9,[o("div",m9,[i[38]||(i[38]=R(" Adjust the quantity for ",-1)),o("strong",null,f(s.adjustItem.title),1)]),o("div",h9,[o("label",null,f(A(u)("Quantity")),1),s.isEditingItem?(r(),$(vp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):k("",!0)])])]),_:1},8,["modelValue","title"]),n(_p,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:s.searchQuery,orderParent:s.order,"onUpdate:searchQuery":s.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),n(S,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[17]||(i[17]=D=>s.createProductModal=D),title:A(u)("Add New Product")},{default:d(()=>[s.createProductModal?(r(),h("div",v9,[n(fi,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):k("",!0)]),_:1},8,["modelValue","title"]),n(S,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[19]||(i[19]=D=>s.showRefundModal=D),title:A(u)("Refund Transaction"),onClose:i[20]||(i[20]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:d(()=>[jt(n(UU,{"element-loading-text":A(u)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:i[18]||(i[18]=D=>s.processing_refund=D),subscription:s.subscription,is_subscription:s.isSubscription,subscription_status:s.subscriptionStatus},null,8,["element-loading-text","order_id","order","showRefundModal","subscription","is_subscription","subscription_status"]),[[T,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),$(I,{key:0,animated:""},{default:d(()=>[n(M),n(M),n(M)]),_:1})):k("",!0),n(S,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[21]||(i[21]=D=>s.nextInvoiceModal=D),title:A(u)("Custom payment link")},{default:d(()=>[n(NU,{order_id:e.order_id,order:s.order,onReload:s.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):k("",!0)])):k("",!0)])):k("",!0)],64)}}}),b9={class:"fct-create-order-wrapper fct-layout-width"},w9={class:"single-page-header"},C9={class:"single-page-header-title-wrap"},B9={class:"single-page-body"},k9={class:"fct-create-order"},x9={class:"fct-create-order-main"},S9={class:"fct-browse-product-form-group pb-5 mx-5"},F9={key:0,class:"fct-table-wrap fct-table-transparent-header"},$9={class:"fct-product-info-card"},E9={class:"fct-product-info-media"},U9=["src","alt"],I9={class:"fct-product-info-details"},Q9={class:"fct-product-info-name"},D9={class:"product-sub-name"},V9={class:"mt-1"},T9={key:0,class:"line-through mr-3"},M9={key:1},L9={key:0},R9={class:"fct-input-number-wrap"},O9={key:0},H9={key:0},P9={key:1},N9={class:"fct-table-border fct-table-order-details"},K9={key:0},G9={key:3},j9={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},z9={class:"fct-create-order-aside"},q9={class:"fct-admin-sidebar"},Y9={key:0},W9={name:"CreateOrder",components:{OrderBulkActions:gd,Transaction:yd,Badge:Aa,IconButton:Xe,CopyToClipboard:Fa,Notes:gi,Coupon:yi,CustomDiscount:bi,OrderCustomerInformation:Zo,Shipping:wd},data(){return{loading:!1,calculating:!1,customModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{title:"",price:0,quantity:1,is_physical:"yes"},timeout:"",widgets:[],order:{applied_coupon:[],customer_id:"",customer:{id:null,full_name:"",email:"",phone:""},status:"processing",subtotal:0,manual_discount_total:0,shipping_tax:0,shipping_total:0,tax_total:0,total_amount:0,order_items:[],payment_status:"pending",payment_method:"offline_payment",shipping_status:"unshipped"},searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,coupons:[],appliedCoupons:[],hasCoupon:!1,selectedLabels:[],selectedCustomerCountry:"",selectedCustomerAddress:null,shippingMethods:[],otherShippingMethods:[]}},watch:{order:{handler(){this.changes_made++},deep:!0}},computed:{beforeRouteLeave(e,t,a){this.redirectRouteName=e.name,this.changes_made?this.outerVisible=!0:a()}},methods:{getImageUrl(e,t){return e&&e!==null&&e!==void 0?e:t+"images/empty-image.svg"},getClass(e){return{"w-full":!0,"border border-solid border-gray-divider rounded":e&&e!==null&&e!==void 0}},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){parseInt(t)<0?this.handleError(`You have exceeded the stock limit! Current stock is : ${t}`):a.quantity=e,a.updated_stock=t,this.calculateLine()},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():bd(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){delete this.order.customer.orders,this.loading=!0;const e={...this.order};delete e.customer,ce.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:at.tz.guess(),trigger:"on_admin_create"}).then(t=>{z.success(t.message),setTimeout(()=>{this.$router.push({name:"view_order",params:{order_id:t==null?void 0:t.order_id}})},300)}).catch(t=>{var a;t.status_code=="422"?z.validationErrors(t):z.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},onChangeLabel(e){this.selectedLabels=e},saveNoteModal(e){this.order.note=e},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t){var a;(a=this.order)==null||a.order_items.forEach((l,s)=>{l.shipping_charge=rt.get(e,`${l.id}.shipping_charge`)}),this.order.shipping_total=t,this.changes_made++},isDisabled(e){var t;return((t=e==null?void 0:e.other_info)==null?void 0:t.payment_type)==="subscription"},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),ce.get("orders/shipping_methods",{country_code:this.selectedCustomerCountry,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})}},mounted(){this.fetchShippingMethods(),window.onbeforeunload=()=>{if(this.changes_made>0)return!0}}},X9=Object.assign(W9,{setup(e){const t=V(),a=V(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,c)=>{const p=B("el-breadcrumb-item"),m=B("el-breadcrumb"),_=B("el-input"),g=B("el-button"),y=B("router-link"),v=B("el-table-column"),C=B("el-table"),b=B("el-dialog"),w=Va("loading");return r(),h("div",b9,[n(an,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",w9,[o("div",C9,[n(m,{"separator-icon":A(rl)},{default:d(()=>[n(p,{to:{name:"orders"}},{default:d(()=>[R(f(i.$t("Orders")),1)]),_:1}),n(p,null,{default:d(()=>[R(f(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",B9,[o("div",k9,[o("div",x9,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",S9,[n(_,{placeholder:i.$t("Search products..."),onKeyup:c[0]||(c[0]=x=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":c[1]||(c[1]=x=>i.searchQuery=x)},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(g,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(f(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),h("div",F9,[jt((r(),$(C,{data:i.order.order_items,class:"fct-table w-full","row-key":"id","default-expand-all":"","element-loading-text":i.$t("Recalculating with product latest info...")},{default:d(()=>[n(v,{"min-width":"450",label:i.$t("Product")},{default:d(x=>{var F,L,U,S;return[o("div",$9,[o("div",E9,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:x.row.post_id}}},{default:d(()=>[o("img",{src:i.getImageUrl(x.row.featured_media,i.appVars.asset_url),alt:x.row.title,class:de(i.getClass(x.row.featured_media))},null,10,U9)]),_:2},1032,["to"])]),o("div",I9,[o("div",Q9,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:x.row.post_id}}},{default:d(()=>[R(f(x.row.post_title)+" ",1),o("span",D9,"- "+f(x.row.title),1)]),_:2},1032,["to"])]),o("div",V9,[R(f(i.formatNumber(x.row.price))+" ",1),parseInt(x.row.unit_price)>parseInt(x.row.price)?(r(),h("span",T9,f(i.formatNumber(x.row.unit_price)),1)):k("",!0),x.row.payment_type==="subscription"&&((L=(F=x.row)==null?void 0:F.other_info)==null?void 0:L.manage_setup_fee)==="yes"?(r(),h("div",M9,[o("span",null,f(x.row.other_info.signup_fee_name)+" : "+f(i.formatNumber(x.row.other_info.signup_fee)),1),((S=(U=x.row)==null?void 0:U.other_info)==null?void 0:S.setup_fee_per_item)=="yes"?(r(),h("span",L9,[c[6]||(c[6]=o("span",null,"x",-1)),o("span",null,f(x.row.quantity),1)])):k("",!0)])):k("",!0)])])])]}),_:1},8,["label"]),n(v,{width:"120",label:i.$t("Quantity")},{default:d(x=>[o("div",R9,[n(vp,{item:x.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled(x.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),n(v,{width:120,label:i.$t("Total")},{default:d(x=>{var F,L,U,S;return[o("div",null,f(i.formatNumber(x.row.line_total)),1),x.row.payment_type=="subscription"&&((L=(F=x.row)==null?void 0:F.other_info)==null?void 0:L.manage_setup_fee)=="yes"?(r(),h("div",O9,[c[7]||(c[7]=o("span",null,"+",-1)),((S=(U=x.row)==null?void 0:U.other_info)==null?void 0:S.setup_fee_per_item)=="yes"?(r(),h("span",H9,[o("span",null,f(i.formatNumber(x.row.other_info.signup_fee*x.row.quantity)),1)])):(r(),h("span",P9,f(i.formatNumber(x.row.other_info.signup_fee)),1))])):k("",!0)]}),_:1},8,["label"]),n(v,{width:50},{default:d(x=>[n(Xe,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ne(F=>i.deleteProduct(x.$index,x.row),["prevent"])},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[w,i.calculating]])])):k("",!0)]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("table",N9,[o("tbody",null,[o("tr",null,[o("td",null,f(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),h("span",K9,f(A(Xt)(i.order.order_items.length))+" "+f(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):k("",!0)]),o("td",null,f(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),$(yi,{key:0,order:i.order,couponsAttributes:[],hasCouponAttributes:!1,appliedCouponsAttributes:[],action:"create_order",shouldManageCoupon:!0,"onUpdate:coupons":i.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","onUpdate:coupons"])):k("",!0),i.hasCoupon?k("",!0):(r(),$(bi,{key:1,order:i.order,hasCoupon:i.hasCoupon,"onUpdate:customDiscount":i.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),k("",!0),i.selectedCustomerCountry&&i.order.order_items.length>0?(r(),h("tr",G9,[o("td",j9,f(i.$t("Tax will be calculated on save")),1)])):k("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,f(i.$t("Total")),1),c[8]||(c[8]=o("td",null,null,-1)),o("td",null,f(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",z9,[o("div",q9,[n(gi,{note:i.order.note,onWhenNoteEditIsDone:c[2]||(c[2]=x=>{i.saveNoteModal(x)})},null,8,["note"]),n(Zo,{order:i.order,onOnAddressSelected:c[3]||(c[3]=x=>{if(i.fetchShippingMethods(),x===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=x.country,i.selectedCustomerAddress=x,x.type==="shipping"?i.order.shipping_address_id=x.id:i.order.billing_address_id=x.id}),onOnAddressRemove:c[4]||(c[4]=()=>{i.selectedCustomerCountry="",i.selectedCustomerAddress=null,i.order.billing_address_id=null,i.order.shipping_address_id=null,i.fetchShippingMethods()})},null,8,["order"]),n(Jo,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(_p,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),n(b,{"append-to-body":!0,modelValue:i.createProductModal,"onUpdate:modelValue":c[5]||(c[5]=x=>i.createProductModal=x),title:i.$t("Add New Product")},{default:d(()=>[i.createProductModal?(r(),h("div",Y9,[n(fi,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):k("",!0)]),_:1},8,["modelValue","title"])])])}}});class J9 extends sl{constructor(){super(...arguments);Oe(this,"data",{form:ud()})}get controllerKey(){return"Customer"}}function Bp(){return J9.init()}const Z9={class:"setting-wrap"},eD={class:"setting-wrap-inner"},tD={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},aD={class:"grid gap-3 mb-6"},lD={class:"grid gap-3 mb-6"},sD={class:"grid gap-3 mb-6"},nD={class:"grid gap-3"},vs=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=Bp(),{form:a}=t.data,l=ps(),s=V([]),i=V([]),c=V(!0),p=V(!1),m=V(!0),_=V({}),g=al(),y=V(g.name),v=V(g.meta.title||"Store Settings"),C=()=>y.value==="reminders",b=()=>C()?"email-notification/reminders":"settings/store",w=()=>{var S;p.value=!0;let U=a.values;Array.isArray(U.store_logo)&&U.store_logo.length>0&&(U.store_logo=(S=U.store_logo)==null?void 0:S[0]),C()||(U.settings_name=y.value),ce.post(b(),{...U}).then(M=>{if(z.success(u("Settings saved successfully")),y.value==="store_setup"){const I=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],T={};if(I.forEach(function(H){a.values[H]!==void 0&&(T[H]=a.values[H])}),T.currency){const H=ze.get("currency_signs",{});H[T.currency]!==void 0&&(T.currency_sign=H[T.currency])}T.decimal_points!==void 0&&(T.is_zero_decimal=parseInt(T.decimal_points,10)===0);const Q=ze.get("shop",{}),D=["currency","currency_position","decimal_separator","decimal_points"].some(function(H){return T[H]!==void 0&&T[H]!==Q[H]});ze.mergeConfig({shop:Object.assign({},Q,T)}),Je.setLocale(),D&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(M=>{var I;M.status_code=="422"?z.validationErrors(M):z.error((I=M.data)==null?void 0:I.message),a.setValidationErrors(M),_.value=M}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},x=V(!1),F=()=>{c.value=!0,x.value=!1;const U=C()?{}:{settings_name:y.value};ce.get(b(),U).then(S=>{a.setSchema(S.fields).setDefaults(S.settings).initForm(),s.value=S.settings,i.value=S.fields,c.value=!1,m.value=!1,p.value=!1}).catch(S=>{x.value=!0,c.value=!1,m.value=!1,p.value=!1})},L=()=>{l.bind(["mod+s"],U=>{U.preventDefault(),w()})};return Ce(()=>g.name,(U,S)=>{var M;y.value=U,v.value=((M=g.meta)==null?void 0:M.title)||"Store Settings",l.unbind("mod+s"),L(),F()}),Qe(()=>{L(),F()}),kc(()=>{l.unbind("mod+s")}),(U,S)=>{const M=B("el-skeleton-item"),I=B("el-skeleton"),T=B("el-form");return r(),h("div",Z9,[n(Ea,{heading:v.value,loading:p.value,onOnSave:w},null,8,["heading","loading"]),o("div",eD,[n(Ua),x.value?(r(),$(xe,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[o("p",null,f(A(u)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(O,{key:0},[m.value?(r(),h("div",tD,[n(I,{loading:m.value,animated:""},{template:d(()=>[o("div",aD,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",lD,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",sD,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",nD,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})])]),_:1},8,["loading"])])):k("",!0),m.value?k("",!0):(r(),h(O,{key:1},[A(a).isReady?(r(),$(T,{key:0,class:"relative"},{default:d(()=>[c.value?(r(),$(xe,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(I,{rows:5,animated:""},{default:d(()=>[n(M),n(M,{variant:"text"}),n(M,{variant:"text"})]),_:1})]),_:1})]),_:1})):k("",!0),c.value?k("",!0):(r(),$(vi,{key:1,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:w,submitButtonText:A(u)("Save"),loading:p.value,onOnChange:S[0]||(S[0]=Q=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"]))]),_:1})):k("",!0)],64))],64))])])}}}),oD={};function iD(e,t){const a=B("router-view");return r(),h("div",null,[n(a)])}const rD=lt(oD,[["render",iD]]),dD={name:"Licensing",components:{Lock:Vf,Refresh:Jr,CircleCheck:ti,Badge:Aa,DynamicIcon:ee,CopyToClipboard:Fa,SettingsHeader:Ea,CardBody:ke,CardContainer:xe,AdminNotice:Ua},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return ze.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:ks,translate:u,getSettings(){this.errorMessage="",this.loading=!0,ce.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{z.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){z.error(u("Please provide a license key")),this.errorMessage=u("Please provide a license key");return}this.verifying=!0,this.errorMessage="",ce.post("settings/license",{license_key:this.licenseKey}).then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.data)}).finally(()=>{this.verifying=!1})},deactivateLicense(){this.verifying=!0,ce.delete("settings/license").then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{z.error(e)}).finally(()=>{this.verifying=!1})},maskLicense(e){if(!e)return"";const t=e.slice(0,4),a=e.slice(-4),l="*".repeat(e.length-8);return`${t}${l}${a}`}}},uD={class:"setting-wrap"},cD={class:"setting-wrap-inner"},AD={key:0,class:"fluent_cart_configure_integration_body"},pD={key:0,class:"fct-license-box-content"},fD=["href"],mD={class:"fct-license-box-content-details"},hD={class:"label"},_D={class:"license-key"},vD={class:"label"},gD={key:1,class:"w-full items-start"},yD={key:1,class:"fct-license-box-content"},bD={class:"fct-license-box-content-details"},wD={key:0},CD={class:"label"},BD={class:"license-key"},kD={class:"label"},xD={key:2,class:"fct-license-box-content"},SD={key:0},FD=["href"],$D=["innerHTML"];function ED(e,t,a,l,s,i){const c=B("SettingsHeader"),p=B("AdminNotice"),m=B("el-skeleton"),_=B("DynamicIcon"),g=B("CopyToClipboard"),y=B("el-input"),v=B("el-button"),C=B("CardBody"),b=B("CardContainer"),w=Va("loading");return r(),h("div",uD,[n(c,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",cD,[n(p),n(b,null,{default:d(()=>[n(C,null,{default:d(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?jt((r(),h("div",AD,[o("div",{class:de(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",pD,[s.showNewLicenseInput?(r(),h("div",gD,[o("h3",null,f(i.translate("Your License Key")),1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=x=>s.licenseKey=x),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(O,{key:0},[n(_,{name:"GradientWarningCircle"}),o("h3",null,f(i.translate("Looks like your license key has been Expired!")),1),o("p",null,[R(f(i.translate("Have a new license Key?"))+" ",1),o("a",{onClick:t[0]||(t[0]=Ne(x=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},f(i.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(r(),h(O,{key:0},[t[6]||(t[6]=R("or ",-1)),o("a",{href:s.licenseData.renew_url,target:"_blank"},f(i.translate("Purchase a new license")),9,fD)],64)):k("",!0)]),o("div",mD,[o("p",null,[o("span",hD,f(i.translate("License Key")),1),o("span",_D,[R(f(i.maskLicense(s.licenseData.license_key))+" ",1),n(g,{text:s.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),o("p",null,[o("span",vD,f(i.translate("Expired At")),1),R(" "+f(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",yD,[n(_,{name:"GradientCheckCircle"}),o("h3",null,f(i.translate("Congratulations! Your license key is valid and activated")),1),o("p",null,[R(f(i.translate("Want to deactivate this license?"))+" ",1),o("a",{onClick:t[2]||(t[2]=Ne(x=>i.deactivateLicense(),["prevent"])),href:"#"},f(i.translate("Click here")),1)]),o("div",bD,[s.licenseData.license_key?(r(),h("p",wD,[o("span",CD,f(i.translate("License Key")),1),o("span",BD,f(i.maskLicense(s.licenseData.license_key)),1)])):k("",!0),o("p",null,[o("span",kD,f(i.translate("Expires")),1),R(" "+f(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",xD,[o("h3",null,f(i.translate("Please Provide a license key of"))+" FluentCart ",1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=x=>s.licenseKey=x),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?k("",!0):(r(),h("p",SD,[R(f(i.translate("Don't have a license key?"))+" ",1),o("a",{target:"_blank",href:i.purchaseLink},[R(f(i.translate("Purchase one here"))+" ",1),n(_,{name:"External",class:"w-4 h-4"})],8,FD)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,$D),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),$(v,{key:3,type:"primary",onClick:t[4]||(t[4]=x=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+f(i.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(s.licenseData.status)?k("",!0):(r(),$(v,{key:4,type:"primary",onClick:t[5]||(t[5]=x=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+f(i.translate("Verify License")),1)]),_:1}))],2)])),[[w,s.verifying]]):k("",!0)])]),_:1})]),_:1})])])}const UD=lt(dD,[["render",ED]]),ID={class:"fct-single-order-loader-wrap fct-layout-width"},QD={class:"single-page-header fct-page-loader-header flex items-start justify-between"},DD={class:"single-page-body"},VD={class:"fct-single-order"},TD={class:"fct-single-order-main"},MD={class:"fct-single-order-aside"},LD={class:"fct-admin-sidebar"},RD={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),h("div",ID,[o("div",QD,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:d(()=>[n(l,{class:"w-2/4"}),n(l,{class:"w-2/4"})]),_:1})]),o("div",DD,[o("div",VD,[o("div",TD,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:6})]),_:1})]),_:1}),n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",MD,[o("div",LD,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),n(l,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},OD={class:"fct-product-route-wrap"},HD={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=gn({show:!1,message:"",buttonText:"",route:""}),l=V(!1),s=V(!1),i=V(!1),c=al(),p=V(!0),m=()=>{i.value=!0,a.show=!1,ce.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{l.value=v.product,l.value.variants=_(l.value.variants),s.value=v.taxonomies,l.value.post_date=at.utc(l.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),p.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var C;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=rt.get(v,"data.buttonText"),a.message=rt.get(v,"data.message"),a.route=rt.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?z.validationErrors(v):z.error((C=v.data)==null?void 0:C.message)}).finally(()=>{i.value=!1})},_=v=>{let C={};return v.forEach((b,w)=>{b.item_price=b.item_price?ha(b.item_price,!1):0,b.item_cost=b.item_cost?ha(b.item_cost,!1):0,b.compare_price=b.compare_price?ha(b.compare_price,!1):"",b.other_info&&(b.other_info.signup_fee=b.other_info.signup_fee?ha(b.other_info.signup_fee,!1):0),b.rowId=w,C[b.id]=b}),v},g=(v=!1)=>{let C=jQuery(".fct-admin-product-menu"),b=c.name;C.length&&(C.find("li").removeClass("active-menu"),C.find(`li.fct_menu_${b}`).addClass("active-menu")),v&&l.value&&(jQuery("#wp-admin-bar-root-default .fct_view_link").remove(),jQuery("#wp-admin-bar-root-default").append('<li class="fct_view_link" id="wp-admin-bar-view"><a class="ab-item" href="'+l.value.guid+'" target="_blank">View Product</a></li>'))};return Ce(()=>t.product_id,(v,C)=>{v!==C&&m()}),Qe(()=>{m(),g(),window.addEventListener("hashchange",g)}),vl(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),Nr("reload",()=>{p.value=!1,m()}),(v,C)=>{const b=B("router-view");return r(),h("div",OD,[A(c).name==="product_edit"&&i.value?(r(),$(RD,{key:0})):k("",!0),a.show?(r(),$(ai,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):k("",!0),l.value&&a.show==!1?(r(),$(b,{key:2,product:l.value,taxonomies:s.value},null,8,["product","taxonomies"])):k("",!0)])}}};class PD extends Fs{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital"),subscribable:u("Subscribable"),bundle:u("Bundle"),non_bundle:u("Non Bundle")}}getToggleableColumns(){return[{label:u("Type"),value:"product_type"},{label:u("Variation"),value:"variation_type"},{label:u("Stock"),value:"stock_availability"},{label:u("Price"),value:"item_price"},{label:u("Status"),value:"post_status"},{label:u("Date"),value:"post_date"}]}getSortableColumns(){return[{label:u("Product ID"),value:"ID"},{label:u("Title"),value:"post_title"},{label:u("Created at"),value:"post_date"}]}getSearchHint(){return u("Search by Id, product title or variation title")}getFetchUrl(){return"products"}parseResponse(t){return t.products}getTableName(){return"product_table"}with(){return["detail","variants:post_id,available"]}}function kp(e){return PD.init(e)}const ND={key:0,class:"fct-dummy-product-content"},KD={key:0,class:"title"},GD={class:"text"},jD={class:"fct-dummy-product-loading"},zD={class:"fct-loading-bars"},qD=["id"],YD={key:1,class:"fct-form-group"},WD={class:"required"},XD={class:"dialog-footer"},JD={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=zt().ctx,s=V(!1),i=V([]),c=V(null),p=V(0),m=V(!1),_=V(null),g=V(0),y=b=>{s.value=b},v=(b=0)=>{if(c.value===null){C();return}m.value=!0;const w=i.value[c.value];if(_.value=w,b>w.count-1){setTimeout(()=>{C(),s.value=!1,a("onProductCreated")},1e3);return}p.value=b,l.$post("products/create-dummy",{category:w.category,index:b}).then(x=>{g.value=parseFloat(((b+1)/w.count*100).toFixed(0)),v(b+1)}).catch(x=>{x.code===400?C():v(b+1),l.handleError(x)})},C=()=>{g.value=0,p.value=0,m.value=!1,_.value=null};return Qe(()=>{i.value=ze.get("dummy_product_info")}),(b,w)=>{const x=B("el-button"),F=B("el-progress"),L=B("el-option"),U=B("el-select"),S=B("el-dialog");return r(),h(O,null,[n(x,{onClick:w[0]||(w[0]=M=>y(!0))},{default:d(()=>[n(ee,{name:"Stars",class:"hidden lg:inline"}),R(" "+f(b.$t("Add Dummy Product")),1)]),_:1}),n(S,{modelValue:s.value,"onUpdate:modelValue":w[4]||(w[4]=M=>s.value=M),title:b.$t("Create Dummy Product"),"append-to-body":!0},ta({default:d(()=>[m.value?(r(),h("div",ND,[_.value!=null?(r(),h("div",KD,f(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):k("",!0),o("div",GD,[R(f(b.$t("Can close the window - product will continue to insert."))+" ",1),o("div",jD,[o("div",zD,[(r(),h(O,null,ae(8,M=>o("div",{key:M,class:"bar-block",id:`bar-block-${M+1}`},null,8,qD)),64))]),R(" "+f(A(u)("Uploading... %s%",g.value)),1)])]),n(F,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",YD,[o("label",WD,f(b.$t("Product Category")),1),n(U,{modelValue:c.value,"onUpdate:modelValue":w[1]||(w[1]=M=>c.value=M),clearable:"",placeholder:b.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(O,null,ae(i.value,(M,I)=>(r(),$(L,{key:I,label:M.title,value:I},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[m.value?void 0:{name:"footer",fn:d(()=>[o("div",XD,[n(x,{onClick:w[2]||(w[2]=M=>y(!1))},{default:d(()=>[R(f(b.$t("Cancel")),1)]),_:1}),n(x,{type:"primary",onClick:w[3]||(w[3]=()=>{v()}),disabled:!c.value},{default:d(()=>[R(f(b.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},ZD={class:"table-cell"},eV={class:"fct-product-info-card w-full"},tV={class:"fct-product-info-media"},aV={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},lV={class:"fct-product-info-name flex flex-col items-start gap-3"},sV={class:"table-cell"},nV={class:"table-cell"},oV={class:"table-cell"},iV={class:"table-cell"},rV={class:"table-cell"},dV={class:"table-cell"},uV={class:"table-cell"},cV={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=B("el-table-column"),c=B("el-skeleton-item"),p=B("el-table"),m=B("el-skeleton");return r(),$(m,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive fct-loader-table"},{empty:d(()=>s[0]||(s[0]=[])),default:d(()=>[n(i,{selectable:()=>!1,type:"selection",width:"45"}),n(i,{label:l.$t("Products"),width:"380"},{default:d(()=>[o("div",ZD,[o("div",eV,[o("div",tV,[n(c,{varient:"image",class:"w-10 h-10.5 flex-none"})]),o("div",aV,[o("div",lV,[n(c,{varient:"p",class:"max-w-[190px]"}),n(c,{varient:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),$(i,{key:0,label:l.$t("Type"),width:"100"},{default:d(()=>[o("div",sV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("variation_type")?(r(),$(i,{key:1,label:l.$t("Variation"),width:"150"},{default:d(()=>[o("div",nV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("item_price")?(r(),$(i,{key:2,label:l.$t("Price"),width:"130"},{default:d(()=>[o("div",oV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),$(i,{key:3,label:l.$t("Stock"),width:"100"},{default:d(()=>[o("div",iV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_status")?(r(),$(i,{key:4,label:l.$t("Status"),width:"130"},{default:d(()=>[o("div",rV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_date")?(r(),$(i,{key:5,label:l.$t("Date"),width:"120"},{default:d(()=>[o("div",dV,[n(c,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):k("",!0),n(i,{label:l.$t("Actions"),width:"80",align:"right"},{default:d(()=>[o("div",uV,[n(c,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},AV={},pV={class:"px-4 py-3"},fV={class:"flex items-center justify-between mb-3"},mV={class:"grid grid-cols-3 gap-5 mt-5"};function hV(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),$(l,{animated:""},{template:d(()=>[o("div",pV,[o("div",fV,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",mV,[(r(),h(O,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const _V=lt(AV,[["render",hV]]),vV={class:"fct-product-action show-on-mobile absolute right-0 top-1"},gV={class:"more-btn pr-3"},yV={class:"flex items-center gap-2"},bV={key:0},wV={key:1},CV={key:2},BV={key:0},kV={key:1},xV={key:0},SV={key:1},FV={key:0},$V={key:1},EV={class:"flex items-center gap-0.5"},UV={key:0},IV={key:1},QV=["innerHTML"],DV=["innerHTML"],VV={class:"fct-product-id hidden",title:"Product ID"},TV={class:"more-btn pr-3"},MV={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=a,s=V(null),i=y=>{y.action==="delete"?il(u("Are you sure you want to delete this product : %s ?",y.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{l("delete",y.product.ID)}).catch(v=>{}):y.action==="duplicate"&&l("duplicate",y.product)},c=y=>y.min_price===y.max_price?ha(y.min_price,!0):`${ha(y.min_price,!0)} - ${ha(y.max_price,!0)}`,p=y=>{switch(y){case"physical":return u("Physical");case"digital":return u("Digital");case"bundle":return u("Bundle");default:oa.headline(y)}},m=y=>{switch(y){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");case"advanced_variations":return u("Advanced Variations");default:return y?oa.headline(y):""}},_=y=>{l("selectionChange",y)};return t({clearSelection:()=>{var y,v;(v=(y=s.value)==null?void 0:y.clearSelection)==null||v.call(y)}}),(y,v)=>{const C=B("el-table-column"),b=B("router-link"),w=B("el-dropdown-item"),x=B("el-dropdown-menu"),F=B("el-dropdown"),L=B("el-tooltip"),U=B("el-table");return r(),$(U,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:d(()=>[n(C,{type:"selection",width:"45"}),n(C,{label:A(u)("Products"),width:"380"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(qr,{product:S.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",vV,[n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(x,null,{default:d(()=>[S.row.ID?(r(),$(w,{key:0,class:"item-link"},{default:d(()=>[n(b,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(w,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(ee,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(w,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",gV,[n(ee,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),$(C,{key:0,label:A(u)("Type"),width:"170"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>{var M,I;return[o("div",yV,[((I=(M=S.row.detail)==null?void 0:M.other_info)==null?void 0:I.is_bundle_product)==="yes"?(r(),h("span",bV,f(A(u)("Bundle"))+" - ",1)):k("",!0),S.row.detail?(r(),h("span",wV,f(p(S.row.detail.fulfillment_type)),1)):(r(),h("span",CV,f(A(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("variation_type")?(r(),$(C,{key:1,label:A(u)("Variation"),width:"150"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",BV,f(m(S.row.detail.variation_type)),1)):(r(),h("span",kV,f("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("item_price")?(r(),$(C,{key:2,label:A(u)("Price"),width:"130"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",xV,f(c(S.row.detail)),1)):(r(),h("span",SV,f(A(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),$(C,{key:3,label:A(u)("Stock"),width:"100"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[S.row.detail?(r(),h("span",FV,[S.row.detail.manage_stock.toString()==="0"?(r(),h(O,{key:0},[R(f(A(u)("Unlimited")),1)],64)):(r(),h(O,{key:1},[R(f(A(Xt)(A(rt).sum(S.row.variants,"available"))),1)],64))])):(r(),h("span",$V,f("")))]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_status")?(r(),$(C,{key:4,label:A(u)("Status"),width:"130"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[o("div",EV,[(r(),$(Aa,{key:S.row.ID,status:S.row.post_status==="future"?"scheduled":S.row.post_status},null,8,["status"])),S.row.post_status==="future"?(r(),$(L,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(f(A(u)("Publishes On: %s",A(ks)(S.row.post_date,!0))),1)]),default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):k("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),e.productTable.isColumnVisible("post_date")?(r(),$(C,{key:5,label:A(u)("Date"),width:"120"},{default:d(S=>[n(wa,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(Pa,{"date-time":S.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),(r(!0),h(O,null,ae(e.productTable.getCustomColumns(),S=>(r(),$(C,{label:S.label},{default:d(M=>[S.render_template?(r(),h("div",UV,[(r(),$(Cl(Qc),{templateContent:S.template,data:{column:S,product:M.row,index:M.$index}},null,8,["templateContent","data"]))])):(r(),h("div",IV,[S.as_link!==!1?(r(),$(wa,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:M.row.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(M.row,S.accessor)},null,8,QV)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(M.row,S.accessor)},null,8,DV))]))]),_:2},1032,["label"]))),256)),n(C,{label:A(u)("Actions"),width:"80",align:"right"},{default:d(S=>[o("span",VV,"ID: "+f(S.row.ID),1),n(F,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(x,null,{default:d(()=>[S.row.ID?(r(),$(w,{key:0,class:"item-link"},{default:d(()=>[n(b,{to:{name:"product_edit",params:{product_id:S.row.ID}}},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(w,{command:{action:"duplicate",product:S.row}},{default:d(()=>[n(ee,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(w,{command:{action:"delete",product:S.row},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",TV,[n(ee,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},LV={class:"fct-product-table-mobile-wrap"},RV={class:"fct-product-table-mobile-header"},OV={key:0,class:"fct-product-table-post-status-col"},HV={class:"flex items-center gap-1.5"},PV={class:"fct-product-action"},NV={class:"more-btn"},KV=["onClick"],GV={class:"fct-product-table-mobile-body-header"},jV={class:"fct-product-table-date-col"},zV={class:"invoice-no",title:"Product ID"},qV={key:0,class:"fct-product-table-price-col"},YV={key:0},WV={key:1},XV={class:"fct-product-table-product-col"},JV=["onClick"],ZV={key:0,class:"fct-product-table-product-type"},eT={class:"title"},tT={key:0,class:"value"},aT={key:1,class:"value"},lT={key:1,class:"fct-product-table-variation-col"},sT={class:"title"},nT={key:0,class:"value"},oT={key:1,class:"value"},iT={key:2,class:"fct-product-table-stock-col"},rT={class:"title"},dT={key:0,class:"value"},uT={key:1},cT={key:0,class:"fct-product-table-mobile-footer"},AT={class:"fct-product-table-stock-col"},pT={key:0,class:"title"},fT=["innerHTML"],mT=["innerHTML"],hT={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&il(u("Are you sure you want to delete this product : %s ?",p.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{a("delete",p.product.ID)}).catch(m=>{})},s=p=>p.min_price===p.max_price?ha(p.min_price,!0):`${ha(p.min_price,!0)} - ${ha(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return u("Physical");case"digital":return u("Digital");default:oa.headline(p)}},c=p=>{switch(p){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:oa.headline(p)}};return(p,m)=>{const _=B("el-tooltip"),g=B("router-link"),y=B("el-dropdown-item"),v=B("el-dropdown-menu"),C=B("el-dropdown");return r(),h("div",LV,[(r(!0),h(O,null,ae(e.productTable.getTableData(),(b,w)=>(r(),h("div",{key:b.id,class:"fct-product-table-mobile-row"},[o("div",RV,[e.productTable.isColumnVisible("post_status")?(r(),h("div",OV,[o("div",HV,[(r(),$(Aa,{key:b.ID,status:b.post_status,onClick:x=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},null,8,["status","onClick"])),b.post_status==="future"?(r(),$(_,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(f(A(u)("Publishes On: %s",A(ks)(b.post_date,!0))),1)]),default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):k("",!0)])])):k("",!0),o("div",PV,[n(C,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(v,null,{default:d(()=>[b.ID?(r(),$(y,{key:0,class:"item-link"},{default:d(()=>[n(g,{to:{name:"product_edit",params:{product_id:b.ID}}},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(y,{command:{action:"delete",product:b},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",NV,[n(ee,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},[o("div",GV,[o("div",jV,[e.productTable.isColumnVisible("post_date")?(r(),h(O,{key:0},[n(Pa,{class:"date","date-time":b.post_date,"with-time":!1},null,8,["date-time"]),m[0]||(m[0]=o("span",{class:"bullet"},"•",-1))],64)):k("",!0),o("span",zV,"#"+f(b.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",qV,[b.detail?(r(),h("span",YV,f(s(b.detail)),1)):(r(),h("span",WV,f(A(u)("Set Price")),1))])):k("",!0)]),o("div",XV,[n(qr,{product:b},null,8,["product"])])],8,KV),o("div",{class:"fct-product-table-mobile-footer",onClick:x=>p.$router.push({name:"product_edit",params:{product_id:b.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",ZV,[o("div",eT,f(A(u)("Type")),1),b.detail?(r(),h("span",tT,f(i(b.detail.fulfillment_type)),1)):(r(),h("span",aT,f("N/A")))])):k("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",lT,[o("div",sT,f(A(u)("Variation")),1),b.detail?(r(),h("span",nT,f(c(b.detail.variation_type)),1)):(r(),h("span",oT,f("N/A")))])):k("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",iT,[o("div",rT,f(A(u)("Stock")),1),b.detail?(r(),h("span",dT,[b.detail.manage_stock.toString()==="0"?(r(),h(O,{key:0},[R(f(A(u)("Unlimited")),1)],64)):(r(),h(O,{key:1},[R(f(A(Xt)(A(rt).sum(b.variants,"available"))),1)],64))])):(r(),h("span",uT,f("")))])):k("",!0)],8,JV),e.productTable.getCustomColumns()?(r(),h("div",cT,[(r(!0),h(O,null,ae(e.productTable.getCustomColumns(),x=>(r(),h("div",AT,[x.label?(r(),h("div",pT,f(x.label),1)):k("",!0),x.render_template?(r(),$(Cl(Qc),{key:1,templateContent:x.template,data:x,column:x,row:b},null,8,["templateContent","data","column","row"])):(r(),h(O,{key:2},[x.as_link!==!1?(r(),$(wa,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:b.ID}}},{default:d(()=>[o("div",{innerHTML:A(rt).get(b,x.accessor)},null,8,fT)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(rt).get(b,x.accessor)},null,8,mT))],64))]))),256))])):k("",!0)]))),128))])}}},_T={class:"product-action-modal"},vT={class:"fct-alert-content"},gT={class:"fct-alert-title"},yT={class:"fct-alert-text"},bT={class:"fct-alert-subtext"},wT={key:1,class:"product-info"},CT={class:"info-text"},BT={key:0},kT={key:1},xT={key:2},ST={key:2,class:"options-wrapper"},FT={key:4,class:"products-preview"},$T={class:"preview-title"},ET={class:"product-list"},UT={class:"product-name"},IT={key:0,class:"remaining-count"},QT={key:5,class:"progress-section"},DT={class:"progress-text"},VT={key:6,class:"results-section"},TT={class:"dialog-footer"},MT={key:0,class:"el-icon-delete"},LT={__name:"ProductActionModal",props:{modelValue:{type:Boolean,default:!1},action:{type:String,required:!0,validator:e=>["duplicate","delete"].includes(e)},productId:{type:[Number,String],default:null},productName:{type:String,default:""},products:{type:Array,default:()=>[]},productIds:{type:Array,default:()=>[]}},emits:["update:modelValue","completed"],setup(e,{emit:t}){const a=e,l=t,s=V(a.modelValue),i=V(!1),c=V(!1),p=V(!1),m=V(0),_=V(0),g=V(0),y=V({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=ze.get("app_config.isProActive"),C=ze.get("modules_settings.stock_management.active"),b=K(()=>a.action==="duplicate"),w=K(()=>a.action==="delete"),x=K(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),F=K(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),L=K(()=>x.value?u(b.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(b.value?"Duplicate Product":"Delete Product")),U=K(()=>w.value?u(x.value?"Delete Products":"Delete Product"):u(x.value?"Duplicate Products":"Duplicate Product")),S=K(()=>a.products.slice(0,5)),M=K(()=>{const W=F.value-5;return W>0?W:0}),I=K(()=>F.value===0?0:Math.round(m.value/F.value*100)),T=K(()=>{if(g.value>0&&m.value===F.value)return"exception";if(m.value===F.value)return"success"});Ce(()=>a.modelValue,W=>{s.value=W,W&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},c.value=!1,p.value=!1,m.value=0,_.value=0,g.value=0,i.value=!1)}),Ce(s,W=>{l("update:modelValue",W)});const Q=()=>{!c.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!x.value&&!p.value)&&l("completed"))},E=()=>{x.value?G():D()},D=()=>{i.value=!0,b.value?H():P()},H=()=>{ce.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(W=>{z.success(W.message||u("Product duplicated successfully")),l("completed"),Q()}).catch(W=>{var pe,N;((pe=W.status_code)==null?void 0:pe.toString())==="422"?z.validationErrors(W):z.error(((N=W.data)==null?void 0:N.message)||u("Failed to duplicate product"))}).finally(()=>{i.value=!1})},P=()=>{ce.delete(`products/${a.productId}`).then(W=>{z.success(W.message||u("Product deleted successfully")),l("completed"),Q()}).catch(W=>{var pe,N;((pe=W.status_code)==null?void 0:pe.toString())==="422"?z.validationErrors(W):z.error(((N=W.data)==null?void 0:N.message)||u("Failed to delete product"))}).finally(()=>{i.value=!1})},G=async()=>{c.value=!0,m.value=0,_.value=0,g.value=0,b.value?await J():await oe(),c.value=!1,p.value=!0,Z()},J=async()=>{const W={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},pe=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(N=>N.ID);for(const N of pe){try{await ce.post(`products/${N}/duplicate`,W),_.value++}catch{g.value++}m.value++}},oe=async()=>{const W=a.products&&a.products.length>0?a.products:[];for(const pe of W){try{await ce.delete(`products/${pe.ID}`),_.value++}catch{g.value++}m.value++}},Z=()=>{const W=b.value?"duplicated":"deleted";_.value>0&&g.value===0?z.success({message:u(`All products ${W} successfully`)}):_.value>0&&g.value>0?z.warning({message:u(`Some products were ${W} successfully`)}):z.error({message:u(`Failed to ${W.replace("ed","")} products`)})};return(W,pe)=>{const N=B("el-checkbox"),j=B("el-progress"),q=B("el-alert"),X=B("el-button"),ie=B("el-dialog");return r(),$(ie,{modelValue:s.value,"onUpdate:modelValue":pe[3]||(pe[3]=ge=>s.value=ge),title:L.value,"append-to-body":!0,width:"500px",onClose:Q,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[o("div",TT,[n(X,{onClick:Q,disabled:c.value},{default:d(()=>[R(f(c.value||p.value?A(u)("Close"):A(u)("Cancel")),1)]),_:1},8,["disabled"]),p.value?k("",!0):(r(),$(X,{key:0,type:w.value?"danger":"primary",loading:i.value||c.value,disabled:i.value||c.value,onClick:E},{default:d(()=>[w.value?(r(),h("i",MT)):k("",!0),R(" "+f(U.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[o("div",_T,[w.value?(r(),$(Za,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[o("div",vT,[o("h3",gT,f(A(u)("Are you sure?")),1),o("p",yT,[R(f(A(u)("You are about to permanently delete"))+" ",1),o("strong",null,f(F.value),1),R(" "+f(A(u)(F.value===1?"product":"products"))+". ",1)]),o("p",bT,f(A(u)("This action cannot be undone.")),1)])]),_:1})):k("",!0),b.value?(r(),h("div",wT,[o("div",CT,[R(f(A(u)(x.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),x.value?(r(),h("strong",BT,f(F.value),1)):(r(),h("strong",kT,f(e.productName),1)),x.value?(r(),h("span",xT,f(A(u)(F.value===1?"product":"products")),1)):k("",!0)])])):k("",!0),b.value?(r(),h("div",ST,[n(N,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":pe[0]||(pe[0]=ge=>y.value.importDownloadableFiles=ge),label:A(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(N,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":pe[1]||(pe[1]=ge=>y.value.importLicenseSettings=ge),label:A(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),A(C)==="yes"?(r(),h(O,{key:0},[A(v)?(r(),$(N,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":pe[2]||(pe[2]=ge=>y.value.importStockManagement=ge),label:A(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),$(N,{key:1,disabled:!0,size:"large"},{default:d(()=>[R(f(A(u)("Import Stock Management"))+" ",1),n(ee,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):k("",!0)])):k("",!0),b.value?(r(),$(Za,{key:3,type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",null,f(A(u)(x.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):k("",!0),w.value&&x.value&&!c.value&&!p.value?(r(),h("div",FT,[o("p",$T,f(A(u)("Products to be deleted:")),1),o("ul",ET,[(r(!0),h(O,null,ae(S.value,ge=>(r(),h("li",{key:ge.ID,class:"product-item"},[o("span",UT,f(ge.post_title),1)]))),128)),M.value>0?(r(),h("li",IT,f(A(u)("... and %s more",M.value)),1)):k("",!0)])])):k("",!0),x.value&&c.value?(r(),h("div",QT,[n(j,{percentage:I.value,status:T.value},null,8,["percentage","status"]),o("p",DT,f(A(u)(w.value?"Deleting":"Duplicating"))+" "+f(m.value)+" / "+f(F.value),1)])):k("",!0),x.value&&p.value?(r(),h("div",VT,[_.value>0?(r(),$(q,{key:0,title:A(u)(w.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",_.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):k("",!0),g.value>0?(r(),$(q,{key:1,title:A(u)(w.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",g.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):k("",!0)])):k("",!0)])]),_:1},8,["modelValue","title"])}}},RT={class:"fct-all-products-page fct-layout-width"},OT={class:"fct-all-products-wrap"},HT={key:0,class:"bulk-actions-bar"},PT={class:"bulk-left flex items-center gap-2"},NT={class:"bulk-right"},KT={key:1,class:"fct-products-table-wrap"},GT={__name:"AllProducts",setup(e){const t=kp({instance:zt()}),a=V(!1),l=V(!1),s=V("duplicate"),i=V(null),c=V([]),p=V(""),m=V(!1),_=()=>{m.value=window.innerWidth<768},g=I=>{ce.delete(`products/${I}`).then(T=>{z.success(T),t.fetch()}).catch(T=>{var Q;T.status_code.toString()==="422"?z.validationErrors(T):z.error((Q=T.data)==null?void 0:Q.message)})},y=I=>{i.value=I,c.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,c.value=[]},C=()=>{var I,T;t.fetch(),c.value=[],p.value="",(T=(I=M.value)==null?void 0:I.clearSelection)==null||T.call(I)},b=I=>{c.value=I},w=()=>{if(c.value.length===0){z.warning({message:u("Please select at least one product to duplicate")});return}i.value=null,s.value="duplicate",l.value=!0},x=()=>{if(c.value.length===0){z.warning({message:u("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},F=()=>{if(!p.value){z.warning({message:u("Please select a bulk action")});return}p.value==="duplicate"?w():p.value==="delete"&&x()},L=K(()=>c.value.map(I=>I.ID)),U=K(()=>c.value.length>0),S=K(()=>c.value.length>0),M=V(null);return Qe(()=>{_(),window.addEventListener("resize",_)}),Ct(()=>{window.removeEventListener("resize",_)}),(I,T)=>{const Q=B("el-icon"),E=B("el-button"),D=B("el-dropdown-item"),H=B("el-dropdown-menu"),P=B("el-dropdown"),G=B("el-option"),J=B("el-select"),oe=B("el-dialog");return r(),h("div",RT,[n(ll,{title:A(u)("Products")},{action:d(()=>[n(Pt,{permission:"products/create"},{default:d(()=>[n(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:T[3]||(T[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[n(H,null,{default:d(()=>[n(D,{class:"item-link"},{default:d(()=>[n(JD,{onOnProductCreated:T[0]||(T[0]=Z=>A(t).fetch()),products:A(t).getTableData()},null,8,["products"])]),_:1}),n(D,{onClick:T[1]||(T[1]=Z=>I.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[n(ee,{name:"Insert"}),R(" "+f(A(u)("Bulk Product Insert")),1)]),_:1}),n(D,{onClick:T[2]||(T[2]=Z=>I.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),default:d(()=>[n(E,null,{default:d(()=>[R(f(A(u)("More actions"))+" ",1),n(Q,null,{default:d(()=>[n(A(ei))]),_:1})]),_:1})]),_:1}),n(E,{type:"primary",onClick:T[4]||(T[4]=()=>{a.value=!0})},{default:d(()=>[R(f(A(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Pt,{permission:"products/view"},{default:d(()=>[o("div",OT,[n($s,{table:A(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),$(_V,{key:0})):k("",!0),n(hT,{"product-table":A(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[n(Gl,{name:"slide-fade"},{default:d(()=>[U.value?(r(),h("div",HT,[o("div",PT,[n(J,{size:"small",class:"bulk-select min-w-[180px]",placeholder:A(u)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":T[5]||(T[5]=Z=>p.value=Z)},{default:d(()=>[n(G,{label:A(u)("Duplicate"),value:"duplicate"},null,8,["label"]),n(G,{label:A(u)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),n(E,{size:"small",type:p.value==="delete"?"danger":"primary",onClick:F},{default:d(()=>[p.value==="delete"?(r(),$(ee,{key:0,name:"Delete",class:"w-4 h-4"})):(r(),$(ee,{key:1,name:"Copy",class:"w-4 h-4"})),R(" "+f(A(u)("Confirm")),1)]),_:1},8,["type"])]),o("div",NT,f(c.value.length)+" "+f(A(u)("item(s) selected")),1)])):k("",!0)]),_:1}),A(t).isLoading()?(r(),$(cV,{key:0,productTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",KT,[n(MV,{ref_key:"productTableRef",ref:M,"product-table":A(t),onDelete:g,onDuplicate:y,onSelectionChange:b},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Pt,{permission:"products/create"},{default:d(()=>{var Z,W;return[n(oe,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":T[6]||(T[6]=pe=>a.value=pe),title:A(u)("Add New Product")},{default:d(()=>[a.value?(r(),$(fi,{key:0})):k("",!0)]),_:1},8,["modelValue","title"]),n(LT,{modelValue:l.value,"onUpdate:modelValue":T[7]||(T[7]=pe=>l.value=pe),action:s.value,"product-id":(Z=i.value)==null?void 0:Z.ID,"product-name":(W=i.value)==null?void 0:W.post_title,products:S.value?c.value:[],"product-ids":S.value?L.value:[],onCompleted:T[8]||(T[8]=pe=>S.value?C():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},jT=lt(GT,[["__scopeId","data-v-cd57428c"]]);let zT=0;function Al(){return"_cid_"+ ++zT}const es={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Cd extends sl{constructor(){super(...arguments);Oe(this,"data",{visibleColumns:[],options:{status:[{title:"Published",value:"published"},{title:"Draft",value:"draft"}],fulfilment:[{title:"Physical",value:"physical"},{title:"Digital",value:"digital"}],variation:[{title:"Simple",value:"simple"},{title:"Simple Variations",value:"simple_variations"}]},dummies:{productDetail:{variation_type:"simple",manage_stock:1,fulfillment_type:"physical",stock_availability:es.IN_STOCK},variation:{variation_title:"",sku:"",item_price:0,compare_price:0,serial_index:1,fulfillment_type:"",manage_stock:1,total_stock:100,available:100,committed:0,on_hold:0,stock_status:es.IN_STOCK},variationDetail:{description:"",payment_type:"onetime",installment:"no",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},variationImage:{id:"",url:"",title:""},gallery:{id:"",url:"",title:""},downloadableFile:{title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:"",serial:1}}});Oe(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var i;const l=a==null?void 0:a.variants,s={...this.data.dummies.variation};return s.serial_index=Array.isArray(l)?l.length+1:1,s.fulfillment_type=(i=a==null?void 0:a.detail)==null?void 0:i.fulfillment_type,s.other_info={...this.data.dummies.variationDetail},s.media=[],s._cid=Al(),s}addVariationToProduct(a){this.ensureProductVariantIsArray(a),a.variants.push(this.getDummyVariation(a))}handleVariationChanged(a,l){l==="simple_variations"?this.addVariationToProduct(a):a.variants=[]}getColumnWidthStorageKey(){return""}saveColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s={};a.forEach(i=>{i.key&&(s[i.key]=i.width)}),Lt.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Lt.get(l);s&&typeof s=="object"&&a.forEach(i=>{i.key&&s[i.key]!==void 0&&(i.width=s[i.key])})}getColumnStorageKey(){return""}getToggleableColumns(){return[]}setupColumnVisibility(){const a=this.getColumnStorageKey();if(!a)return;const l=Lt.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Lt.set(a,this.data.visibleColumns)}isColumnVisible(a){return this.data.visibleColumns.includes(a)}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}syncStockStatus(a){var i;if(!Array.isArray(a.variants))return;if(!((i=a.detail)==null?void 0:i.manage_stock)){for(const c of a.variants)c.stock_status=es.IN_STOCK;a.detail&&(a.detail.stock_availability=es.IN_STOCK);return}let s=!0;for(const c of a.variants){const p=parseInt(c.available,10)||0;c.stock_status=p>0?es.IN_STOCK:es.OUT_OF_STOCK,p>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?es.OUT_OF_STOCK:es.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}class qT extends Cd{constructor(){super(...arguments);Oe(this,"data",{product:{},original_product:{},product_changes:{},validationErrors:{},excerptWordCount:0,maxExcerptWordCount:0,hasChange:!1,saving:!1,product_snapshot:{},discardKey:0,savedVariationLength:0,productDownloadableModel:null,metaValue:null,hasChangeLongDescEditor:!1,reloader:()=>{},onProductUpdatedListener:{}});Oe(this,"router",tl());Oe(this,"_mergeOtherInfo",(a,l)=>{const s=JSON.parse(JSON.stringify(l));Object.keys(s).forEach(i=>{a[i]=s[i]}),Object.keys(a).forEach(i=>{i in s||delete a[i]})});Oe(this,"_mergeSnapshot",a=>{const l=this.data.product,s=new Set(["ID","guid","variants","detail","downloadable_files","product_terms","taxonomies","variantOptions"]);if(Object.keys(a).forEach(i=>{if(s.has(i))return;const c=a[i];l[i]=c!==null&&typeof c=="object"?JSON.parse(JSON.stringify(c)):c}),a.detail&&l.detail){const i=JSON.parse(JSON.stringify(a.detail));Object.keys(i).forEach(c=>{c!=="other_info"&&(l.detail[c]=i[c])}),i.other_info&&(l.detail.other_info||(l.detail.other_info={}),this._mergeOtherInfo(l.detail.other_info,i.other_info))}if(Array.isArray(a.variants)&&Array.isArray(l.variants)){const i={};a.variants.forEach(p=>{p.id&&(i[p.id]=p)});const c=new Set(["id","post_id","rowId","media","created_at","updated_at"]);l.variants.forEach(p=>{const m=i[p.id];m&&Object.keys(m).forEach(_=>{if(c.has(_))return;const g=m[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,g):p[_]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});Oe(this,"addDummyVariant",()=>{var a,l;return{post_id:this.product.detail.post_id,serial_index:this.variantsLength()+1,variation_title:"",item_price:"",compare_price:"",manage_cost:"yes",item_cost:"",profit:"--",profit_margin:"--",manage_stock:this.product.detail.manage_stock,stock_status:"in-stock",total_stock:1,on_hold:0,committed:0,available:1,fulfillment_type:this.product.detail.fulfillment_type,media:[],other_info:{description:"",payment_type:"onetime",tax_class:"standard",tax_exempt:"no",tax_inclusion:"",times:"",repeat_interval:"yearly",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no",package_slug:"",weight:null,weight_unit:((l=(a=window.fluentCartAdminApp)==null?void 0:a.shop)==null?void 0:l.weight_unit)||"kg"},downloadable:"true"}});Oe(this,"formatPricing",a=>{let l={};return a.forEach((s,i)=>{s.item_price=s.item_price?ha(s.item_price,!1):0,s.item_cost=s.item_cost?ha(s.item_cost,!1):0,s.compare_price=s.compare_price?ha(s.compare_price,!1):0,s.other_info.signup_fee=s.other_info.signup_fee?ha(s.other_info.signup_fee,!1):0,s.rowId=i,l[s.id]=s}),a});Oe(this,"onChangePricing",(a,l,s)=>{this.ensureVariationIndex(l),this.product.variants[l][a]=s,a==="item_price"&&this.onChangePricingPayment(this.product.variants[l],s,l),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[l][a]=s,this.data.product_changes.variants[l].id=this.product.variants[l].id,(a==="item_price"||a==="compare_price")&&this.validateComparePrice(l),this.setHasChange(!0)});Oe(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),ce.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(l=>{z.success(l.message)}).catch(l=>{l&&l.message&&z.error(l)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Oe(this,"onChangePricingPayment",(a,l,s)=>{var i;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let c=parseInt(a.other_info.times)?u("for %s Times",(i=a==null?void 0:a.other_info)==null?void 0:i.times):u("Until Cancel");return this.data.product_changes.variants[s].billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${c}`,this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=`${a.item_price} ${a.other_info.repeat_interval} ${c}`}return this.data.product_changes.variants[s].billing_summary="",this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=""});Oe(this,"onUploadPricingMedia",(a,l,s)=>{this.product.variants[l][a]=[],this.product.variants[l][a]=[...this.product.variants[l][a],...s];const i=this.product.variants[l].id;ce.post(`products/variants/${i}/setMedia`,{media:this.product.variants[l].media}).then(c=>{z.success(c.message)}).catch(c=>{var p;c.status_code=="422"?z.validationErrors(c):z.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})});Oe(this,"afterCreatingOrUpdatingPricing",(a,l)=>{l.created_at=l.created_at??new Date().toLocaleDateString()+""+new Date().toLocaleTimeString(),a!==void 0&&a!=null?this.product.variants[a]=l:(l.rowId=this.variantsLength()>0?this.data.product.variants[this.variantsLength()-1].rowId+1:this.variantsLength(),this.data.product.variants.push(l),a=this.variantsLength()-1),this.data.productDownloadableModel.setDownloadableFiles(this.data.product.downloadable_files)});Oe(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let l="";return a.id!=null?l=ce.post(`products/variants/${a.id}`,{variants:a}):l=ce.post("products/variants",{variants:a}),l.then(s=>(z.success(s.message),Object.values(this.data.onProductUpdatedListener).forEach(i=>{typeof i=="function"&&i(this.product)}),this.saveSnapshot(),s)).catch(s=>{var i;s.status_code=="422"?(z.validationErrors(s),this.setValidationErrors(s.data)):z.error((i=s.data)==null?void 0:i.message)}).finally(()=>{this.setSaving(!1)})});Oe(this,"updatePricingValue",(a,l,s,i,c)=>{if(s.includes(".")&&(s=s.split(".").pop()),this.ensureVariationIndex(s),s!==void 0&&this.clearValidationError(`${s}.${a}`),i[a]=l,a==="item_price"&&this.onChangePricingPayment(i,l,s),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.variants[s].fulfillment_type=l),a==="item_cost"){const p=parseFloat(l);i.item_cost=isNaN(p)||p<0?0:p}parseFloat(i.item_cost)>parseFloat(i.item_price)&&(i.item_cost=0),this.data.product_changes.variants[s][a]=a==="item_cost"?i[a]:l,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,this.product.detail.variation_type==="simple"&&(a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.variants[s].fulfillment_type=l),this.product.variants[0]=i,this.setHasChange(!0)),(a==="item_price"||a==="compare_price")&&this.validateComparePrice(s)});Oe(this,"updatePricingOtherValue",(a,l,s=null,i,c="")=>{this.ensureVariationIndex(s),["payment_type","times","repeat_interval","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable","tax_class","tax_exempt","tax_inclusion","weight","length","width","height","package_slug","weight_unit","manage_stock"].includes(a)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),i.other_info[a]=l,this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),this.data.product_changes.variants[s].other_info[a]=l,i.other_info.payment_type==="subscription"&&(a==="times"&&parseInt(l)<0&&(i.other_info.times=0),i.other_info.times=i.other_info.times??"",i.other_info.repeat_interval=i.other_info.repeat_interval??"",i.other_info.trial_days=i.other_info.trial_days??0,i.other_info.billing_summary=i.other_info.billing_summary??"",i.other_info.manage_setup_fee=i.other_info.manage_setup_fee??"no",i.other_info.signup_fee_name=i.other_info.signup_fee_name??"",i.other_info.signup_fee=i.other_info.signup_fee??"",i.other_info.setup_fee_per_item=i.other_info.setup_fee_per_item??"no"),this.data.product_changes.variants[s].other_info=i.other_info,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,["payment_type","times","repeat_interval","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable"].includes(a)&&this.onChangePricingPayment(i,l,s)),["media"].includes(a)&&(i.media=[],i.media=[...i.media,...l],this.data.product_changes.variants[s].media=i.media,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),["description"].includes(a)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),i.other_info[a]=l,this.data.product_changes.variants[s].other_info[a]=l,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),this.product.detail.variation_type==="simple"&&(this.product.variants[0]=i,this.data.product_changes.variants=[],this.data.product_changes.variants[0]=i,this.data.product_changes.variants[0].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),c==="add"&&this.setHasChange(!0)});Oe(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Oe(this,"deletePricing",(a,l)=>Fn.ofDelete(u("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return ce.delete(`products/variants/${a}`).then(s=>{z.success(s.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?z.validationErrors(s):z.error(s==null?void 0:s.data),s})}));Oe(this,"getDownloadableHeaderClass",()=>{var l;const a=this.product.downloadable_files&&Array.isArray(this.product.downloadable_files)&&this.product.downloadable_files.length>0;return{"!border-0":((l=this.product.detail)==null?void 0:l.manage_downloadable)=="0"||!a}});Oe(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});Oe(this,"ensureVariationIndex",a=>{var l;(l=this.data.product_changes)!=null&&l.detail||(this.data.product_changes.detail={}),this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[a]||(this.data.product_changes.variants[a]={})});Oe(this,"onChangeNewStock",(a,l,s)=>{this.product.variants[s]||(this.data.product_changes.variants=[]),this.ensureVariationIndex(s),l===""&&(this.product.variants[s].new_stock=0,this.data.product_changes.variants[s].new_stock=0);let i=this.product.variants[s].total_stock??0,c=this.product.variants[s].new_stock??0,p=parseInt(c.toString())-parseInt(i);this.product.variants[s].adjusted_quantity=p,this.data.product_changes.variants[s].adjusted_quantity=p,this.data.product_changes.variants[s].id=this.product.variants[s].id});Oe(this,"onChangeAdjustedQuantity",(a,l,s)=>{this.ensureVariationIndex(s),l===""&&(l=0);let i=this.product.variants[s].total_stock+parseInt(l);this.product.variants[s].new_stock=i<0?0:i});Oe(this,"onChangeInputField",(a,l,s=!0)=>{var i,c,p,m,_;if(a==="post_title"&&this.product.detail.variation_type==="simple"&&Array.isArray(this.product.variants)&&this.variantsLength()>0&&(this.product.variants[0].variation_title=l,(i=this.data.product_changes)!=null&&i.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=l,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=at(l).format("YYYY-MM-DDTHH:mm:ssZ"),this.data.product_changes[a]=this.product[a]),a==="default_variation_id"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.data.product_changes.detail.default_variation_id=l,this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=l,this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=l,this.data.product_changes.variants[y].id=g.id})),a==="shipping_class"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),(c=this.product.detail)!=null&&c.other_info||(this.product.detail.other_info={}),this.product.detail.other_info[a]=l,(p=this.data.product_changes.detail)!=null&&p.other_info||(this.data.product_changes.detail.other_info={}),this.data.product_changes.detail.other_info[a]=l,this.product.variants.forEach((g,y)=>{this.product.variants[y].shipping_class=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].shipping_class=l,this.data.product_changes.variants[y].id=g.id})),["group_pricing_by","use_pricing_table","active_editor","sold_individually"].includes(a)&&(this.ensureVariationIndex(0),this.data.product_changes.detail||(this.data.product_changes.detail={}),(m=this.product.detail)!=null&&m.other_info||(this.product.detail.other_info={}),(_=this.data.product_changes.detail)!=null&&_.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=l,this.data.product_changes.detail.other_info[a]=l,this.product.detail.variation_type==="simple"&&(this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes.variants[0].id=this.product.variants[0].id)),a==="post_excerpt"){this.product[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes[a]=this.product[a];const g=l.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=l,this.data.product_changes[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;s&&this.setHasChange(!0)});Oe(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Oe(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Oe(this,"validateComparePrice",a=>{var p,m;if(a==null)return!0;const l=(m=(p=this.product)==null?void 0:p.variants)==null?void 0:m[a];if(!l)return!0;const s=`variants.${a}.compare_price`,i=parseFloat(l.item_price),c=parseFloat(l.compare_price);return isNaN(c)||c<=0?(this.clearValidationError(s),!0):!isNaN(i)&&c<i?(this.validationErrors[s]=[u("Compare price must be greater than or equal to item price.")],!1):(this.clearValidationError(s),!0)});Oe(this,"discard",()=>{const a=this.data.product_snapshot;!a||!Object.keys(a).length||(this._mergeSnapshot(a),this.data.product_changes={},this.data.discardKey++,this.setHasChange(!1))});Oe(this,"update",async(a=null)=>{var c,p,m,_,g,y;let l=this.data.product_changes;if(l={...this.product},l.metaValue=this.data.metaValue,this.data.product_changes.post_status||(this.data.product_changes.post_status=this.product.post_status),this.data.product_changes.post_title||(this.data.product_changes.post_title=this.product.post_title),this.data.product_changes.detail?((c=this.data.product_changes.detail)!=null&&c.fulfillment_type||(this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type),(p=this.data.product_changes.detail)!=null&&p.variation_type||(this.data.product_changes.detail.variation_type=this.product.detail.variation_type)):(this.data.product_changes.detail={},this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type,this.data.product_changes.detail.variation_type=this.product.detail.variation_type),l=this.data.product_changes,l.metaValue=this.data.metaValue,this.setValidationErrors({}),this.setSaving(!0),((m=l.detail)==null?void 0:m.variation_type)==="simple"&&(l.variants||(l.variants=[]),!Array.isArray(l.variants)||l.variants.length===0)){const v=((_=this.product.variants)==null?void 0:_[0])||{};l.variants[0]={id:v.id,variation_title:l.post_title||v.variation_title,item_price:v.item_price??"",post_id:this.product.ID}}if(delete l.taxonomies,delete l.product_terms,delete l.variantOptions,delete l.downloadable_files,((g=l.detail)==null?void 0:g.variation_type)!=="simple"&&l.variants){let v=[];l.variants.forEach(C=>{v.push({id:C.id,variation_title:C.variation_title,sku:C.sku,item_price:C.item_price,compare_price:C.compare_price,item_cost:C.item_cost,manage_cost:C.manage_cost,fulfillment_type:C.fulfillment_type,shipping_class:C.shipping_class,other_info:C.other_info,manage_stock:C.manage_stock,serial_index:C.serial_index,total_stock:C.total_stock,available:C.available,committed:C.committed,on_hold:C.on_hold,stock_status:C.stock_status,sold_individually:C.sold_individually,media:C.media,downloadable:C.downloadable,payment_type:C.payment_type})}),l.variants=v}((y=l.downloadable_files)==null?void 0:y.length)<1&&(l.variantOptions=[]);const s=ce.post(`products/${this.product.ID}/pricing`,l);let i=document.querySelector(".fct-admin-product-info .badge");s.then(v=>{z.success(a||v.message),this.setHasChange(!1),i&&(i.innerText=v.data.post_status),this.product.view_url=v.data.viewUrl,i&&v.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&v.data.post_status==="future"&&(i.innerText=u("Publishes on: %s",ks(v.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(v.data.post_status==="draft"?(i.classList.remove("success"),i.classList.add("info")):(i.classList.remove("info"),i.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(v.data.variants)&&v.data.variants.length>0&&(this.product.variants[0].id=v.data.variants[0].id,this.product.variants[0].created_at=v.data.variants[0].created_at),this.product.variants=this.product.variants.filter((C,b,w)=>b===w.findIndex(x=>x.id===C.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(C=>{typeof C=="function"&&C(this.product)})}).catch(v=>{var C,b;((C=v==null?void 0:v.status_code)==null?void 0:C.toString())==="422"?(z.validationErrors(v),this.setValidationErrors(v)):z.error(((b=v==null?void 0:v.data)==null?void 0:b.message)||(v==null?void 0:v.message)||u("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Oe(this,"delete",()=>{il(u("Are you sure you want to delete this product?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),ce.delete(`products/${this.product.ID}`).then(a=>{z.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?z.validationErrors(a):z.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});Oe(this,"updateVariationType",(a,l)=>{var p,m;const s=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(m=(p=this.product)==null?void 0:p.variants[0])==null?void 0:m.id],action:"change_variation_type"};const c=ce.post(`products/detail/${this.product.detail.id}`,i);return c.then(_=>{z.info(_.message),a==="variation_type"&&l==="simple"?(this.product.variants=this.product.variants.slice(0,1),this.variantsLength()>0&&(this.product.variants[0].manage_stock=this.product.detail.manage_stock)):a==="variation_type"&&l==="advanced_variations"&&(this.product.variants=[])}).catch(_=>{var g;this.product.detail[a]=s,_.status_code=="422"?z.validationErrors(_):z.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),c});Oe(this,"getMaxExcerptWordCount",()=>{ce.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Oe(this,"shouldShowShippingMethodAlert",()=>ze.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Oe(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Oe(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Oe(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Oe(this,"isTaxEnabled",()=>ze.get("is_tax_enabled"));Oe(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Oe(this,"isBundleProduct",()=>rt.get(this.data.product,"detail.other_info.is_bundle_product")==="yes")}addOnProductUpdatedListener(a,l){this.data.onProductUpdatedListener[a]=l}triggerProductUpdated(a=null){const l=this.data.onProductUpdatedListener;(Array.isArray(a)?a:Object.keys(l)).forEach(i=>{const c=l[i];typeof c=="function"&&c(this.product)})}setProductDownloadableModel(a){this.data.productDownloadableModel=a}setReloader(a){this.data.reloader=a}saveSnapshot(){this.data.product_snapshot=JSON.parse(JSON.stringify(this.data.product))}get product(){return this.data.product}get validationErrors(){return this.data.validationErrors}get excerptWordCount(){return this.data.excerptWordCount}get maxExcerptWordCount(){return this.data.maxExcerptWordCount}get hasChange(){return this.data.hasChange}get hasChangeLongDescEditor(){return this.data.hasChangeLongDescEditor}get saving(){return this.data.saving}beforeInit(){this.data.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"publish",post_date:new Date,comment_status:"close",variants:!1},this.vueInstance=zt().ctx}setProduct(a){let l=document.querySelector(".fct-admin-product-info .badge");l&&a.post_status==="future"&&(l.innerText=u("Publishes on: %s",ks(a.post_date,!0)),l.classList.add("warning")),this.data.product=a,this.data.original_product={...a}}setValidationErrors(a){this.data.validationErrors=a}setExcerptWordCount(a){this.data.excerptWordCount=a}setMaxExcerptWordCount(a){this.data.maxExcerptWordCount=a}setHasChange(a){this.data.hasChange=a}setHasChangeLongDescEditor(a){this.data.hasChangeLongDescEditor=a}setSaving(a){this.data.saving=a}isInDraft(){return this.product.post_status==="draft"}viewUrl(){return this.product.view_url??""}variantsLength(){return this.product.variants.length??0}updateVariantSerialIndexes(a){var l;a.forEach((s,i)=>{s.serial_index=i+1}),(l=this.data.product_changes)!=null&&l.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants=a.map(s=>({id:s.id,serial_index:s.serial_index})),this.setHasChange(!0)}bulkUpdateVariants(a){return ce.post("products/variants/bulk-update",{updates:a})}addDummyDownloadableFile(){super.addDummyDownloadableFiles(this.product),this.setHasChange(!0)}updateMedia(a,l){this.product[a]=l,this.data.product_changes[a]=l,this.setHasChange(!0)}shippingSettingsUrl(){return ze.get("admin_url")+"settings/shipping"}}function YT(){return qT.init()}function WT(){Qe(()=>{document.addEventListener("keydown",t)}),vl(()=>{document.removeEventListener("keydown",t)});let e;function t(l){(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.keyCode===83&&(l.preventDefault(),typeof e=="function"&&e())}function a(l){e=l}return{onSave:a}}const XT={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},JT={key:0,class:"iframe-loader"},ZT=["src"],eM={class:"iframe-controls"},tM={class:"dialog-header"},aM={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},lM={key:0,class:"iframe-loader"},sM=["src"],nM={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=V(!1),l=V(!0),s=V(!0),i=V(),c=V(null),p=V(null);al();const m=()=>{const x=window.location.origin;i.value=x+"/wp-admin"},_=()=>{setTimeout(()=>{l.value=!1},500)},g=()=>{var x;s.value=!1,setTimeout(()=>{},500);try{const F=(x=p.value)==null?void 0:x.contentDocument;F&&F.addEventListener("click",L=>{const U=L.target.closest("a[href]");if(U&&!U.target&&!U.getAttribute("onclick")){const S=U.getAttribute("href");S&&(S.startsWith("/")||S.startsWith("http"))&&(L.preventDefault(),window.parent.postMessage({type:"navigateTo",content:S},"*"))}},!0)}catch{}},y=()=>{a.value=!0,s.value=!0},v=()=>{s.value=!1,a.value=!1,t.productEditModel.data.reloader()},C=()=>{l.value=!0,c.value&&(c.value.src=c.value.src.toString())},b=()=>{s.value=!0,p.value&&(p.value.src=p.value.src.toString())},w=x=>{const{type:F,content:L}=x.data;F==="gutenbergContentChanged"&&C(),F==="navigateTo"&&(v(),window.location.href=L)};return Qe(()=>{m(),window.addEventListener("message",w)}),(x,F)=>{const L=B("el-icon"),U=B("el-button"),S=B("el-breadcrumb-item"),M=B("el-breadcrumb"),I=B("el-dialog");return r(),h(O,null,[o("div",XT,[F[2]||(F[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",JT,[o("span",null,[R(f(A(u)("Loading preview..."))+" ",1),n(L,{class:"is-loading"},{default:d(()=>[n(A(qs))]),_:1})])])):k("",!0),o("iframe",{ref_key:"previewIframeRef",ref:c,class:"scrollbar-none preview-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true`,width:"100%",height:"400px",onLoad:_,style:na({visibility:l.value?"hidden":"visible"})},null,44,ZT)]),o("div",eM,[n(U,{onClick:y},{default:d(()=>[R(f(A(u)("Show Content Editor")),1)]),_:1})]),n(I,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":F[0]||(F[0]=T=>a.value=T),onClose:v,onOpen:F[1]||(F[1]=()=>{b()})},{header:d(()=>[o("div",tM,[n(M,{separator:"/"},{default:d(()=>[n(S,null,{default:d(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:v},f(e.product.post_title),1)]),_:1}),n(S,null,{default:d(()=>F[3]||(F[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?k("",!0):(r(),$(U,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:v},{default:d(()=>[n(ee,{name:"Cross"}),R(" "+f(A(u)("Close")),1)]),_:1}))])]),default:d(()=>[o("div",aM,[s.value?(r(),h("div",lM,[o("span",null,[R(f(A(u)("Loading editor..."))+" ",1),n(L,{class:"is-loading"},{default:d(()=>[n(A(qs))]),_:1})])])):k("",!0),o("iframe",{ref_key:"dialogIframeRef",ref:p,class:"dialog-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true`,width:"100%",height:"700px",sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",onLoad:g,style:na({visibility:s.value?"hidden":"visible"})},null,44,sM)])]),_:1},8,["modelValue"])],64)}}},oM=lt(nM,[["__scopeId","data-v-2a0b985d"]]),iM={class:"fct-product-info-wrap"},rM={class:"fct-admin-input-wrapper"},dM={class:"fct-admin-input-wrapper"},uM={class:"form-note"},cM={class:"fct-excerpt-word-counter mt-[7px]"},AM={class:"editor-tabs-nav"},pM={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},fM={class:"custom-wp-editor-wrapper relative"},mM={class:"relative rounded overflow-hidden"},hM={class:"editor-tab-content fct-wp-editor-tab-content"},_M={class:"editor-tab-content fct-gutenberg-tab-content"},vM={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=V(!1),l=V("wp-editor");V("#gt"),al();const s=V(),i=c=>{t.productEditModel.updateLongDescEditorChange(c),l.value=c};return Ce(()=>t.product.post_title,c=>{const p=document.querySelector(".fct-admin-product-header .product-name");p&&(p.textContent=c&&c.trim()?c:u("Product Name"))}),Qe(()=>{var c,p,m,_,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((c=t.product)==null?void 0:c.post_excerpt)!==void 0&&((p=t.product)==null?void 0:p.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((m=t.product)==null?void 0:m.post_excerpt.toString().split(" ").length),(y=(g=(_=t.product)==null?void 0:_.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(l.value=t.product.detail.other_info.active_editor)}),Ce(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(c,p)=>{const m=B("el-input"),_=B("el-form-item"),g=B("el-form"),y=Va("loading");return r(),h("div",iM,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",rM,[n(_,{label:A(u)("Title"),required:""},{default:d(()=>[n(m,{class:de(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:A(u)("Title"),type:"text",modelValue:e.product.post_title,"onUpdate:modelValue":p[0]||(p[0]=v=>e.product.post_title=v),onInput:p[1]||(p[1]=v=>{e.productEditModel.onChangeInputField("post_title",v)}),onFocus:p[2]||(p[2]=v=>e.productEditModel.clearValidationError("post_title"))},null,8,["class","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",dM,[n(_,{label:A(u)("Short description")},{default:d(()=>[n(m,{class:"fct-short-desc-input",onInput:p[3]||(p[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":p[4]||(p[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:p[5]||(p[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),o("div",null,[o("div",uM,[o("p",cM,f(A(u)("%1$s Words of %2$s",A(u)(e.productEditModel.data.excerptWordCount),A(u)(e.productEditModel.maxExcerptWordCount))),1)]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Long Description")},{action:d(()=>[jt((r(),h("div",AM,[n(Gr,null,{default:d(()=>[n(Co,{label:A(u)("Classic Editor"),class:de(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),n(Co,{label:A(u)("Builder"),class:de(l.value==="gutenberg"?"active":""),onClick:p[8]||(p[8]=v=>i("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ne(()=>{},["prevent"]))},{default:d(()=>[o("div",pM,[n(_,null,{default:d(()=>[o("div",fM,[o("div",mM,[jt(o("div",hM,[n(Wl,{ref_key:"wpEditor",ref:s,modelValue:e.product.post_content,onUpdate:p[9]||(p[9]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[Vl,l.value==="wp-editor"]]),jt(o("div",_M,[n(oM,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Vl,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},gM=["aria-label"],yM=["src","alt"],bM={class:"fmp-featured__edit-icon"},wM=["src","alt"],CM={key:0,class:"fmp-count"},BM={key:0,class:"fmp-preview-grid"},kM=["src","alt"],xM={key:0,class:"fmp-preview-more"},SM={key:1,class:"fmp-add-full",type:"button"},FM={class:"fmp-modal-body"},$M=["src","alt"],EM=["onClick","title"],UM={key:1,class:"fmp-empty"},IM={class:"fmp-url-list"},QM=["src","alt"],DM={class:"fmp-url-info"},VM={class:"fmp-url-title"},TM={class:"fmp-url-text"},MM=["onClick","title"],LM={class:"fmp-url-add"},RM={class:"dialog-footer"},OM={class:"fct-media-picker-footer-actions"},HM={class:"fct-btn-group sm"},hl={__name:"BulkMediaPicker",props:{modelValue:{type:Array,default:()=>[]},compact:{type:Boolean,default:!0},maxThumbs:{type:Number,default:3},multiple:{type:Boolean,default:!0},showUrlTab:{type:Boolean,default:!0},title:{type:String,default:""},featured:{type:Boolean,default:!1},square:{type:Boolean,default:!1},showApplyToAll:{type:Boolean,default:!1},defaultApplyToAll:{type:Boolean,default:!1},selectedCount:{type:Number,default:0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=cs.getUrl("images/placeholder.svg"),l=E=>{E.target&&E.target.src!==a&&(E.target.src=a)},s=e,i=t,c=V(!1),p=V([]),m=V("gallery"),_=V(""),g=V(!1),y=K(()=>s.title||u("Manage Media")),v=K(()=>s.selectedCount>0?u("Apply to all (%1$s)",s.selectedCount):u("Apply to all")),C=K(()=>p.value.filter(E=>E.id>0)),b=K(()=>p.value.filter(E=>!E.id)),w=K(()=>s.showUrlTab),x=K(()=>Array.isArray(s.modelValue)?s.modelValue:[]),F=K(()=>x.value.filter(E=>E&&E.url)),L=()=>{p.value=JSON.parse(JSON.stringify(x.value)),m.value="gallery",_.value="",g.value=s.defaultApplyToAll,c.value=!0},U=()=>{(JSON.stringify(p.value)!==JSON.stringify(x.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),c.value=!1},S=()=>{c.value=!1},M=E=>{p.value.splice(E,1)},I=E=>{const D=E.filter(P=>P.url).map(P=>({id:P.id,title:P.title,url:P.url}));if(!s.multiple){p.value=D.slice(0,1);return}const H=new Set(p.value.map(P=>P.url));for(const P of D)H.has(P.url)||(p.value.push(P),H.add(P.url))},T=()=>{const E=_.value.trim();if(!E)return;if(p.value.some(P=>P.url===E)){_.value="";return}const D=E.split("/").pop().split("?")[0]||"image",H={id:0,url:E,title:D};s.multiple?p.value.push(H):p.value=[H],_.value=""},Q=E=>{const D=p.value.findIndex(H=>H.url===E);D!==-1&&p.value.splice(D,1)};return(E,D)=>{const H=B("el-tag"),P=B("el-button"),G=B("el-tab-pane"),J=B("el-input"),oe=B("el-tabs"),Z=B("el-checkbox"),W=B("el-dialog");return r(),h(O,null,[o("div",{class:de(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:L},[e.featured?(r(),h(O,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("button",{key:0,type:"button",class:"fmp-featured","aria-label":A(u)("Edit media")},[o("img",{src:e.modelValue[0].url||A(a),alt:e.modelValue[0].title||"",class:"fmp-featured__image",onError:l},null,40,yM),o("span",bM,[n(ee,{name:"Edit"})]),e.modelValue.length>1?(r(),$(H,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[R(f(e.modelValue.length)+" "+f(E.$t("images")),1)]),_:1})):k("",!0)],8,gM)):(r(),$(P,{key:1,class:"fct-mp-add-featured"},{default:d(()=>[n(ee,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(O,{key:1},[F.value.length?(r(),h("div",{key:0,class:de(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(O,null,ae(F.value.slice(0,e.maxThumbs),(pe,N)=>(r(),h("span",{key:N,class:"fmp-thumb-wrap",style:na({zIndex:e.maxThumbs-N})},[o("img",{src:pe.url,alt:pe.title||"",class:"fmp-thumb",onError:l},null,40,wM)],4))),128)),F.value.length>e.maxThumbs?(r(),h("span",CM,"+"+f(F.value.length-e.maxThumbs),1)):k("",!0),D[4]||(D[4]=xn('<span class="fmp-edit-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none" width="14" height="14"><path d="M11.7282 3.23787C12.3492 2.56506 12.6597 2.22865 12.9896 2.03243C13.7857 1.55896 14.766 1.54423 15.5754 1.99359C15.9108 2.17982 16.2309 2.50676 16.8709 3.16062C17.511 3.81449 17.8311 4.14143 18.0134 4.48409C18.4533 5.31092 18.4388 6.31232 17.9754 7.12558C17.7833 7.46262 17.454 7.7798 16.7953 8.41416L8.95894 15.9619C7.71081 17.1641 7.08675 17.7651 6.3068 18.0698C5.52685 18.3744 4.66942 18.352 2.95455 18.3071L2.72123 18.301C2.19917 18.2874 1.93814 18.2806 1.7864 18.1084C1.63467 17.9362 1.65538 17.6703 1.69681 17.1385L1.71931 16.8497C1.83592 15.3529 1.89423 14.6046 2.1865 13.9318C2.47878 13.2591 2.98294 12.7129 3.99127 11.6204L11.7282 3.23787Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M10.8333 3.33334L16.6666 9.16668" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M11.6667 18.3333L18.3334 18.3333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></span>',1))],2)):(r(),$(P,{key:1,class:"fct-mp-add-compact"},{default:d(()=>[n(ee,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(O,{key:2},[e.modelValue&&e.modelValue.length?(r(),h("div",BM,[(r(!0),h(O,null,ae(e.modelValue.slice(0,4),(pe,N)=>(r(),h("div",{class:"fmp-preview-item",key:N},[o("img",{src:pe.url,alt:pe.title||""},null,8,kM),N===3&&e.modelValue.length>4?(r(),h("span",xM,"+"+f(e.modelValue.length-4),1)):k("",!0)]))),128))])):(r(),h("button",SM,[D[5]||(D[5]=xn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="none" width="20" height="20"><path d="M9.5 10C10.6046 10 11.5 9.10457 11.5 8C11.5 6.89543 10.6046 6 9.5 6C8.39543 6 7.5 6.89543 7.5 8C7.5 9.10457 8.39543 10 9.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13.5 2H9.5C4.5 2 2.5 4 2.5 9V15C2.5 20 4.5 22 9.5 22H15.5C20.5 22 22.5 20 22.5 15V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.25 5H21.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M19 7.75V2.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M3.16992 18.9501L8.09992 15.6401C8.88992 15.1101 10.0299 15.1701 10.7399 15.7801L11.0699 16.0701C11.8499 16.7401 13.1099 16.7401 13.8899 16.0701L18.0499 12.5001C18.8299 11.8301 20.0899 11.8301 20.8699 12.5001L22.4999 13.9001" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)),o("span",null,f(E.$t("Add Media")),1)]))],64))],2),c.value?(r(),$(W,{key:0,modelValue:c.value,"onUpdate:modelValue":D[3]||(D[3]=pe=>c.value=pe),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,onClose:S,class:"fct-bulk-media-picker-modal"},{default:d(()=>[o("div",FM,[n(oe,{modelValue:m.value,"onUpdate:modelValue":D[1]||(D[1]=pe=>m.value=pe)},{default:d(()=>[n(G,{label:E.$t("Gallery"),name:"gallery"},{default:d(()=>[p.value.length?(r(),$(A(Js),{key:0,list:p.value,class:"fmp-grid",tag:"div",animation:200},{default:d(()=>[(r(!0),h(O,null,ae(p.value,(pe,N)=>(r(),h("div",{class:"fmp-grid-item",key:pe.url||N},[o("img",{src:pe.url,alt:pe.title||""},null,8,$M),N===0?(r(),$(H,{key:0,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[R(f(E.$t("Featured")),1)]),_:1})):k("",!0),o("button",{type:"button",class:"fmp-remove-btn",onClick:Ne(j=>M(N),["stop"]),title:E.$t("Remove")}," × ",8,EM)]))),128))]),_:1},8,["list"])):(r(),h("div",UM,[o("p",null,f(E.$t("No media added yet.")),1)]))]),_:1},8,["label"]),w.value?(r(),$(G,{key:0,name:"imported-urls"},{label:d(()=>[R(f(E.$t("Add by URL"))+" ",1),b.value.length?(r(),$(H,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[R(f(b.value.length),1)]),_:1})):k("",!0)]),default:d(()=>[o("div",IM,[(r(!0),h(O,null,ae(b.value,pe=>(r(),h("div",{class:"fmp-url-item",key:pe.url},[o("img",{src:pe.url,alt:pe.title||"",class:"fmp-url-thumb"},null,8,QM),o("div",DM,[o("span",VM,f(pe.title),1),o("span",TM,f(pe.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ne(N=>Q(pe.url),["stop"]),title:E.$t("Remove")}," × ",8,MM)]))),128)),o("div",LM,[n(J,{modelValue:_.value,"onUpdate:modelValue":D[0]||(D[0]=pe=>_.value=pe),placeholder:E.$t("Paste image URL..."),size:"small",onKeyup:$a(T,["enter"])},null,8,["modelValue","placeholder"]),n(P,{size:"small",onClick:T,disabled:!_.value.trim()},{default:d(()=>[R(f(E.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):k("",!0)]),_:1},8,["modelValue"])]),o("div",RM,[n(Mc,{attachments:C.value,multiple:e.multiple,onOnMediaSelected:I},null,8,["attachments","multiple"]),o("div",OM,[e.showApplyToAll?(r(),h("label",{key:0,class:de(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(Z,{modelValue:g.value,"onUpdate:modelValue":D[2]||(D[2]=pe=>g.value=pe),"aria-label":E.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+f(v.value),1)],2)):k("",!0),o("div",HM,[n(P,{onClick:S},{default:d(()=>[R(f(E.$t("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:U},{default:d(()=>[R(f(E.$t("Save")),1)]),_:1})])])])]),_:1},8,["modelValue","title"])):k("",!0)],64)}}},PM={},NM={class:"fct-shared-variant-item-box"},KM={key:0,class:"fct-shared-variant-item-box__header"},GM={class:"fct-shared-variant-item-box__label"},jM={class:"fct-shared-variant-item-box__action"},zM={class:"fct-shared-variant-item-box__body"};function qM(e,t){return r(),h("div",NM,[e.$slots.label||e.$slots.action?(r(),h("div",KM,[o("div",GM,[Ca(e.$slots,"label")]),o("div",jM,[Ca(e.$slots,"action")])])):k("",!0),o("div",zM,[Ca(e.$slots,"default")])])}const Rn=lt(PM,[["render",qM]]),YM={class:"fct-product-media-row"},WM={key:0,class:"fct-variant-title-readonly"},XM={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},JM={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},ZM={class:"fct-admin-input-wrapper"},e7={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=K(()=>{var s;return["simple_variations","advanced_variations"].includes((s=t.product.detail)==null?void 0:s.variation_type)}),l=K(()=>{var s;return((s=t.product.detail)==null?void 0:s.variation_type)==="advanced_variations"});return(s,i)=>{const c=B("el-input"),p=B("el-form-item");return a.value?(r(),$(Rn,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[o("div",YM,[n(hl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=m=>e.variant.media=m),featured:!0,compact:!1,onChange:i[1]||(i[1]=m=>e.productEditModel.updatePricingOtherValue("media",m,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),h("div",WM,[e.titleInfo&&e.titleInfo.group?(r(),h("div",XM,f(e.titleInfo.group),1)):k("",!0),o("div",JM,f(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),$(p,{key:1,label:A(u)("Variation Title")},{default:d(()=>[o("div",ZM,[n(c,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:A(u)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":i[2]||(i[2]=m=>e.variant.variation_title=m),onInput:i[3]||(i[3]=m=>{e.productEditModel.updatePricingValue("variation_title",m,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):k("",!0)}}},t7=lt(e7,[["__scopeId","data-v-81001ec3"]]),a7={class:"fct-variant-item-collapse"},l7={class:"fct-variant-item-collapse-header"},s7={class:"fct-variant-item-collapse-body"},xp={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=K(()=>s.value.includes("1"));return(c,p)=>{const m=B("el-collapse-item"),_=B("el-collapse");return r(),h("div",a7,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:d(()=>[n(m,{name:"1",icon:A(Tf)},{title:d(()=>[o("div",l7,[Ca(c.$slots,"header",{isOpen:i.value})])]),default:d(()=>[o("div",s7,[Ca(c.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},n7=["innerHTML"],zs={__name:"PriceInput",props:{modelValue:{type:[Number,String],default:""},numberFormat:{type:String,default:"comma_dot",validator:e=>["comma_dot","dot_comma"].includes(e)},id:{type:String,default:""},placeholder:{type:String,default:""},min:{type:Number,default:0},errorClass:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>ze.get("shop.currency_sign","$")),i=K(()=>a.numberFormat==="dot_comma"),c=K(()=>{const E=ze.get("shop.decimal_separator","");return E==="comma"?",":E==="dot"?".":i.value?",":"."}),p=K(()=>c.value===","?".":","),m=K(()=>c.value===","?"de-DE":"en-US"),_=/[\d.,]/,g=E=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(E.key)||E.ctrlKey||E.metaKey||_.test(E.key)||E.preventDefault()},y=E=>String(E||"").replace(/^0+(?=\d)/,""),v=E=>String(E??"").replace(/[^\d.,]/g,""),C=E=>{const D=v(E);if(!D)return"";const H=D.lastIndexOf("."),P=D.lastIndexOf(","),G=Math.max(H,P);if(G===-1)return y(D.replace(/[.,]/g,""));const J=y(D.slice(0,G).replace(/[^\d]/g,"")),oe=D.slice(G+1).replace(/[^\d]/g,""),Z=D.charAt(G),W=(D.match(new RegExp(`\\${Z}`,"g"))||[]).length,pe=G===D.length-1,N=D.includes(".")&&D.includes(",");if(!pe&&!N&&Z===p.value&&(W>1||oe.length>2))return y(D.replace(/[^\d]/g,""));const q=J||"0";return pe?`${q}.`:`${q}.${oe.slice(0,2)}`},b=E=>{if(E==null||E==="")return NaN;const D=typeof E=="number"?String(E):C(E);return D?parseFloat(D.replace(/\.$/,"")):NaN},w=E=>{const D=b(E);return isNaN(D)?"":D.toLocaleString(m.value,{minimumFractionDigits:0,maximumFractionDigits:2})},x=E=>{if(!E)return"";const D=E.endsWith("."),[H="",P=""]=E.split("."),G=(H||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return D?`${G}${c.value}`:P?`${G}${c.value}${P}`:G},F=(E,D=!1)=>{const H=b(E);return isNaN(H)?"":(D?L(H):H).toFixed(2)},L=E=>a.min===null||a.min===void 0||isNaN(E)?E:E<a.min?a.min:E,U=V(""),S=V(""),M=V(!1),I=E=>{const D=F(E);if(!D){U.value="",S.value="";return}U.value=w(D),S.value=D},T=E=>{const D=C(E);if(S.value=D,U.value=x(D),M.value=!0,D===""){l("update:modelValue","");return}const H=F(D);H!==""&&H!==F(a.modelValue)&&l("update:modelValue",H)},Q=()=>{const E=M.value?S.value:a.modelValue;if(E==="")l("update:modelValue",""),l("change",""),U.value="",S.value="";else{const D=F(E,!0);D===""?I(a.modelValue):(l("update:modelValue",D),D!==F(a.modelValue)&&l("change",D),U.value=w(D),S.value=D)}M.value=!1};return Ce([()=>a.modelValue,()=>a.numberFormat],([E])=>{M.value||I(E)}),I(a.modelValue),(E,D)=>{const H=B("el-input");return r(),$(H,{class:de(e.errorClass),id:e.id,placeholder:e.placeholder,"model-value":U.value,disabled:e.disabled,onBlur:Q,onInput:T,onKeydown:g},ta({prefix:d(()=>[o("span",{innerHTML:s.value},null,8,n7)]),_:2},[E.$slots.suffix?{name:"suffix",fn:d(()=>[Ca(E.$slots,"suffix")]),key:"0"}:void 0]),1032,["class","id","placeholder","model-value","disabled"])}}},o7={key:0,class:"fct-shared-variant-item-box__switch"},i7={class:"fct-shared-variant-item-box__hint"},r7={key:1,class:"fct-inline-select-wrap"},d7={class:"fct-price-with-inclusion"},u7={key:0,class:"fct-required"},c7={class:"fct-admin-input-wrapper"},A7={key:0},p7={key:0,class:"fct-collapse-heading"},f7={key:1,class:"fct-tag-group"},m7={class:"fct-tag-item"},h7={class:"fct-tags-internal"},_7={key:0,class:"fct-tag-item"},v7={class:"fct-tags-internal"},g7={key:1,class:"fct-tag-item"},y7={class:"fct-tags-internal"},b7={key:2,class:"fct-tag-item"},w7={class:"fct-tags-internal"},C7={class:"fct-tag-item"},B7={class:"fct-tags-internal"},k7={class:"fct-shared-variant-pricing-additional"},x7={class:"fct-admin-input-wrapper"},S7={class:"fct-admin-input-wrapper"},F7={class:"fct-admin-input-wrapper"},$7={key:0},E7={class:"fct-admin-input-wrapper"},U7={class:"fct-admin-input-wrapper"},I7={class:"fct-admin-input-wrapper"},Q7={class:"fct-admin-input-wrapper"},D7={class:"fct-admin-input-wrapper"},V7={class:"fct-admin-input-wrapper"},T7={class:"fct-admin-input-wrapper"},Sp={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=ze.get("app_config.isProActive"),l=V(),s=V([""]),i=V(0),c=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","setup_fee_per_item","item_cost","manage_cost"]);Ce(()=>{var b;return(b=t.variant)==null?void 0:b.id},()=>{var b,w;i.value=Number((w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.signup_fee)||0}),Ce(()=>{var b,w;return(w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.payment_type},b=>{b==="subscription"&&(s.value="1")}),Ce(()=>{var b;return(b=t.productEditModel)==null?void 0:b.validationErrors},b=>{if(!b||Object.keys(b).length===0)return;Object.keys(b).some(x=>{for(const F of c)if(x.includes(F))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const m=K(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),_=()=>{var b,w,x;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes((x=(w=t.variant)==null?void 0:w.other_info)==null?void 0:x.payment_type)},g=(b,w,x,F)=>{t.productEditModel.updatePricingOtherValue(b,w,x,F,t.modeType)},y=b=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",b,t.fieldKey,t.variant,t.modeType),b==="no"?(i.value=Number(t.variant.other_info.signup_fee),t.productEditModel.updatePricingOtherValue("signup_fee","0",t.fieldKey,t.variant,t.modeType)):t.productEditModel.updatePricingOtherValue("signup_fee",i.value,t.fieldKey,t.variant,t.modeType)},v=K(()=>{var x,F;const b=Number(t.variant.item_price)||0,w=Number((F=(x=t.variant)==null?void 0:x.other_info)==null?void 0:F.times)||1;return b*w}),C=b=>{const w=m.value.find(F=>F.value===b);return!(w!=null&&w.label)&&!b?"":((w==null?void 0:w.label)||b).split(" ").map(F=>F.charAt(0).toUpperCase()).join("")};return(b,w)=>{const x=B("el-switch"),F=B("el-option"),L=B("el-select"),U=B("el-form-item"),S=B("el-col"),M=B("el-input"),I=B("el-row"),T=B("el-checkbox"),Q=B("el-tooltip");return r(),$(Rn,null,{label:d(()=>[R(f(A(u)("Pricing")),1)]),action:d(()=>{var E;return[(E=e.variant)!=null&&E.other_info?(r(),h("div",o7,[e.isGroupMode?(r(),h("div",r7,[o("label",null,f(A(u)("Payment Type"))+":",1),n(L,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":w[1]||(w[1]=D=>e.variant.other_info.payment_type=D),"popper-class":"fct-group-select-popper",onChange:w[2]||(w[2]=D=>{D==="subscription"&&!e.variant.other_info.repeat_interval&&Se(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"subscription",label:A(u)("Subscription")},null,8,["label"]),n(F,{value:"onetime",label:A(u)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(O,{key:0},[o("span",i7,f(A(u)("Subscription")),1),n(x,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:w[0]||(w[0]=D=>{const H=D?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",H,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",D&&Se(()=>{var P;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((P=l.value.value)==null||P.focus())})})},null,8,["model-value"])],64))])):k("",!0)]}),default:d(()=>[o("div",d7,[n(U,{class:"fct-price-with-inclusion__price"},{label:d(()=>{var E,D;return[R(f(((D=(E=e.variant)==null?void 0:E.other_info)==null?void 0:D.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"))+" ",1),e.isGroupMode?k("",!0):(r(),h("span",u7,"*"))]}),default:d(()=>{var E,D;return[o("div",c7,[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):((D=(E=e.variant)==null?void 0:E.other_info)==null?void 0:D.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":w[3]||(w[3]=H=>{e.variant.item_price=H,e.productEditModel.updatePricingValue("item_price",H,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var H,P,G,J;return[((P=(H=e.variant)==null?void 0:H.other_info)==null?void 0:P.installment)==="yes"?(r(),h("span",A7," x "+f((J=(G=e.variant)==null?void 0:G.other_info)==null?void 0:J.times),1)):k("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),$(U,{key:0,class:"fct-price-with-inclusion__tax"},{label:d(()=>[R(f(A(u)("Tax")),1)]),default:d(()=>{var E,D;return[e.isGroupMode?(r(),$(L,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":w[4]||(w[4]=H=>e.variant.other_info.tax_inclusion=H),"popper-class":"fct-group-select-popper"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(F,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),$(L,{key:1,"model-value":((D=(E=e.variant)==null?void 0:E.other_info)==null?void 0:D.tax_inclusion)||"_default_",onChange:w[5]||(w[5]=H=>{const P=H==="_default_"?"":H;e.variant.other_info&&(e.variant.other_info.tax_inclusion=P),e.productEditModel.updatePricingOtherValue("tax_inclusion",P,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[n(F,{value:"_default_",label:A(u)("Store default")},null,8,["label"]),n(F,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(F,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):k("",!0)]),n(xp,{modelValue:s.value,"onUpdate:modelValue":w[26]||(w[26]=E=>s.value=E)},{header:d(({isOpen:E})=>{var D,H,P,G,J,oe;return[E?(r(),h("div",p7,f(A(u)("Additional display prices")),1)):(r(),h("div",f7,[o("div",m7,[R(f(A(u)("Compare-at"))+" ",1),o("span",h7,f((D=e.variant)!=null&&D.compare_price?b.appVars.shop.currency_sign+e.variant.compare_price:0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",_7,[R(f(A(u)("Installment"))+" ",1),o("span",v7,f(((P=(H=e.variant)==null?void 0:H.other_info)==null?void 0:P.installment)==="yes"?A(u)("Yes"):A(u)("No")),1)])):k("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",g7,[R(f(A(u)("Interval"))+" ",1),o("span",y7,f(C(e.variant.other_info.repeat_interval)),1)])):k("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",b7,[R(f(A(u)("Trial Days"))+" ",1),o("span",w7,f(((J=(G=e.variant)==null?void 0:G.other_info)==null?void 0:J.trial_days)??0),1)])):k("",!0),o("div",C7,[R(f(A(u)("Cost Per Item"))+" ",1),o("span",B7,f((oe=e.variant)!=null&&oe.item_cost?b.appVars.shop.currency_sign+e.variant.item_cost:A(u)("N/A")),1)])]))]}),default:d(()=>[o("div",k7,[n(I,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[o("div",x7,[n(U,null,{label:d(()=>[n(ca,{title:A(u)("Compare at price"),content:A(u)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:d(()=>[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":w[6]||(w[6]=E=>{e.variant.compare_price=E,e.productEditModel.updatePricingValue("compare_price",E,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),h(O,{key:0},[n(S,{lg:12},{default:d(()=>[o("div",S7,[n(U,{label:A(u)("Interval"),required:""},{default:d(()=>[n(L,{class:de(["fct-repeat-payment-every-select",e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.repeat_interval`)?"is-error":""]),id:`${e.fieldKey}.other_info.repeat_interval`,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":w[7]||(w[7]=E=>e.variant.other_info.repeat_interval=E),placeholder:A(u)("Interval"),onChange:w[8]||(w[8]=E=>{e.productEditModel.updatePricingOtherValue("repeat_interval",E,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(O,null,ae(m.value,E=>(r(),$(F,{key:E.value,label:E.label,value:E.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),n(S,{lg:12},{default:d(()=>[n(U,{class:"has-tooltip"},{label:d(()=>[n(ca,{title:A(u)("Trial Days"),content:A(u)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:d(()=>[n(M,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:A(u)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":w[9]||(w[9]=E=>e.variant.other_info.trial_days=E),modelModifiers:{number:!0},autofocus:"",onInput:w[10]||(w[10]=E=>{e.productEditModel.updatePricingOtherValue("trial_days",E,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):k("",!0)]),_:1}),_()?(r(),$(I,{key:0},{default:d(()=>{var E;return[n(S,{lg:24},{default:d(()=>[n(U,null,{default:d(()=>[n(T,{"true-value":"yes","false-value":"no",label:A(u)("Enable installment payment"),class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:A(u)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":w[11]||(w[11]=D=>e.variant.other_info.installment=D),modelModifiers:{number:!0},disabled:!A(a),onChange:w[12]||(w[12]=D=>{if(g("installment",D,e.fieldKey,e.variant),D==="no"){g("times",0,e.fieldKey,e.variant);return}e.variant.other_info.times||g("times",1,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),A(a)?k("",!0):(r(),$(Q,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(f(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(ee,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),n(_a,{visible:((E=e.variant.other_info)==null?void 0:E.installment)==="yes",accordion:""},{default:d(()=>[n(I,{gutter:15},{default:d(()=>{var D;return[n(S,{lg:12},{default:d(()=>[n(U,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(ca,{title:A(u)("Installment Count"),content:A(u)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:d(()=>[n(M,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:A(u)("Installment Count"),type:"number",min:1,modelValue:e.variant.other_info.times,"onUpdate:modelValue":w[13]||(w[13]=H=>e.variant.other_info.times=H),modelModifiers:{number:!0},onInput:w[14]||(w[14]=H=>{g("times",H,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((D=e.variant.other_info)==null?void 0:D.installment)==="yes"?(r(),$(S,{key:0,lg:12},{default:d(()=>[n(U,null,{label:d(()=>[n(ca,{title:A(u)("Total Price"),content:A(u)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:d(()=>[n(M,{id:`${e.fieldKey}.total_price`,type:"number",min:1,disabled:"","model-value":v.value,autofocus:""},{prefix:d(()=>[o("span",null,f(b.appVars.shop.currency_sign),1)]),_:1},8,["id","model-value"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):k("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):k("",!0),_()?(r(),$(I,{key:1,gutter:15},{default:d(()=>{var E,D;return[n(S,{lg:24},{default:d(()=>[o("div",F7,[n(U,{label:e.isGroupMode?A(u)("Setup fee"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),$(L,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":w[15]||(w[15]=H=>e.variant.other_info.manage_setup_fee=H),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"yes",label:A(u)("Setup fee: Yes")},null,8,["label"]),n(F,{value:"no",label:A(u)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(O,{key:1},[n(x,{size:"small",disabled:!A(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":w[16]||(w[16]=H=>e.variant.other_info.manage_setup_fee=H),"active-value":"yes","inactive-value":"no",onChange:y,"active-text":A(u)("Setup fee")},null,8,["disabled","modelValue","active-text"]),A(a)?k("",!0):(r(),h("span",$7,[n(Q,{"popper-class":"fct-tooltip"},{content:d(()=>[R(f(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(ee,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),n(_a,{visible:((D=(E=e.variant)==null?void 0:E.other_info)==null?void 0:D.manage_setup_fee)=="yes",accordion:""},{default:d(()=>[n(I,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:d(()=>[n(S,{lg:12},{default:d(()=>[o("div",E7,[n(U,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(ca,{title:A(u)("Setup fee label"),content:A(u)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:d(()=>[n(M,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:A(u)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":w[17]||(w[17]=H=>e.variant.other_info.signup_fee_name=H),onInput:w[18]||(w[18]=H=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",H,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),n(S,{lg:12},{default:d(()=>[o("div",U7,[n(U,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(ca,{title:A(u)("Setup fee amount"),content:A(u)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:d(()=>[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:A(u)("Setup fee amount"),"model-value":e.variant.other_info.signup_fee,"onUpdate:modelValue":w[19]||(w[19]=H=>{e.variant.other_info.signup_fee=H,e.productEditModel.updatePricingOtherValue("signup_fee",H,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.setup_fee_per_item`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["visible"])]}),_:1})):k("",!0),n(I,{gutter:15},{default:d(()=>[e.variant.manage_cost||e.isGroupMode?(r(),$(S,{key:0,lg:24,class:"fct-manage-cost-col"},{default:d(()=>[o("div",I7,[n(U,{label:e.isGroupMode?A(u)("Calculate profit/cost"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),$(L,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":w[20]||(w[20]=E=>e.variant.manage_cost=E),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"true",label:A(u)("Enable")},null,8,["label"]),n(F,{value:"false",label:A(u)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),$(x,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":w[21]||(w[21]=E=>e.variant.manage_cost=E),"active-value":"true","inactive-value":"false",onChange:w[22]||(w[22]=E=>{A(p)&&e.productEditModel.updatePricingOtherValue("manage_cost",E,e.fieldKey,e.variant,e.modeType),_f(p)?p.value=!0:p=!0}),"active-text":A(u)("Calculate profit/cost")},null,8,["modelValue","active-text"]))]),_:1},8,["label","class"])])]),_:1})):k("",!0),n(_a,{visible:e.variant.manage_cost==="true",accordion:""},{default:d(()=>[n(I,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var E,D,H;return[n(S,{lg:e.isGroupMode?24:((E=e.product.detail)==null?void 0:E.variation_type)==="simple_variations"?12:8},{default:d(()=>[o("div",Q7,[n(U,null,{label:d(()=>[n(ca,{title:A(u)("Cost per item"),content:A(u)("Customers won't see this")},null,8,["title","content"])]),default:d(()=>[n(zs,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Cost per item"),"model-value":e.variant.item_cost,"onUpdate:modelValue":w[23]||(w[23]=P=>{e.variant.item_cost=P,e.productEditModel.updatePricingValue("item_cost",P,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),e.isGroupMode?k("",!0):(r(),$(S,{key:0,lg:((D=e.product.detail)==null?void 0:D.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",D7,[n(U,{label:A(u)("Profit")},{default:d(()=>[n(M,{disabled:"",class:"fct-profit-display",value:A(sm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?k("",!0):(r(),$(S,{key:1,lg:((H=e.product.detail)==null?void 0:H.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",V7,[n(U,{label:A(u)("Margin")},{default:d(()=>[n(M,{disabled:"",class:"fct-margin-display",value:A(nm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(S,{lg:24},{default:d(()=>[o("div",T7,[(e.variant.other_info,k("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},M7={class:"fct-adjust-by-wrap"},L7={class:"fct-adjust-by-row"},R7={class:"fct-adjust-by-col"},O7={class:"title"},H7={class:"fct-adjust-by-col"},P7={class:"title"},N7={class:"fct-adjust-by-action"},Ir={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{expose:t,emit:a}){const l=a,s=V(!1);return t({toggle:()=>s.value=!s.value}),(i,c)=>{const p=B("el-input"),m=B("el-button"),_=B("el-popover");return r(),$(_,{visible:s.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{onClick:c[7]||(c[7]=g=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[n(ee,{name:"Configuration"})])]),default:d(()=>[o("div",M7,[o("div",L7,[o("div",R7,[o("span",O7,f(A(u)("Adjust by")),1),n(p,{size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":c[0]||(c[0]=g=>e.variant.adjusted_quantity=g),modelModifiers:{number:!0},onKeyup:c[1]||(c[1]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g.target.value,e.fieldKey)}),onChange:c[2]||(c[2]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g,e.fieldKey)})},null,8,["placeholder","modelValue"])]),o("div",H7,[o("span",P7,f(A(u)("New Stock")),1),n(p,{size:"small",placeholder:A(u)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":c[3]||(c[3]=g=>e.variant.new_stock=g),modelModifiers:{number:!0},onKeyup:c[4]||(c[4]=g=>{e.productEditModel.onChangeNewStock("new_stock",g.target.value,e.fieldKey)})},null,8,["placeholder","modelValue"])])]),o("div",N7,[n(m,{size:"small",type:"info",soft:"",onClick:c[5]||(c[5]=g=>s.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(m,{size:"small",type:"primary",onClick:c[6]||(c[6]=g=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:d(()=>[R(f(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},K7={class:"fct-shared-variant-item-box__switch"},G7={key:1,class:"fct-inline-select-wrap"},j7={key:0,class:"fct-variant-stock-grid"},z7={class:"fct-variant-stock-box"},q7={class:"fct-stock-box-label"},Y7={class:"fct-stock-box-content fct-stock-box-total-content"},W7={class:"fct-stock-number"},X7={class:"fct-variant-stock-box"},J7={class:"fct-stock-box-label"},Z7={class:"fct-stock-box-content"},eL={class:"fct-stock-number"},tL={class:"fct-variant-stock-box"},aL={class:"fct-stock-box-label"},lL={class:"fct-stock-box-content"},sL={class:"fct-stock-number"},nL={class:"fct-variant-stock-box"},oL={class:"fct-stock-box-label"},iL={class:"fct-stock-box-content"},rL={class:"fct-stock-number"},dL={key:1,class:"fct-admin-input-wrapper"},uL={key:0,class:"fct-collapse-heading"},cL={key:1,class:"fct-tag-group"},AL={class:"fct-tag-item"},pL={class:"fct-admin-input-wrapper"},fL={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},mL=["disabled"],Fp={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=V(!1),l=K(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=K(()=>{var m;return["simple_variations","advanced_variations"].includes((m=t.product.detail)==null?void 0:m.variation_type)}),i=m=>{t.productEditModel.updatePricingValue("manage_stock",m,t.fieldKey,t.variant,t.modeType)};Qe(()=>{t.variant.new_stock===void 0&&(t.variant.new_stock=t.variant.total_stock),t.variant.adjusted_quantity===void 0&&(t.variant.adjusted_quantity=0)});const c=()=>{let m=parseInt(t.variant.new_stock)||0;const _=t.variant.total_stock,g=t.variant.available;t.variant.total_stock=m<0?0:m;let y=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);t.variant.available=y<0?0:y,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,ce.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(v=>{z.success(v.message)}).catch(v=>{var C;t.variant.total_stock=_,t.variant.available=g,t.variant.new_stock=_,z.error(((C=v==null?void 0:v.data)==null?void 0:C.message)||u("Failed to update inventory"))})},p=()=>{var v;if(a.value)return;const m=t.product.post_title||"";if(!m)return;const g=["simple_variations","advanced_variations"].includes((v=t.product.detail)==null?void 0:v.variation_type)&&t.variant.variation_title||"",y=t.variant.id||0;a.value=!0,ce.get("products/suggest-sku",{title:m,variant_title:g,exclude_id:y}).then(C=>{C!=null&&C.sku&&(t.variant.sku=C.sku,t.productEditModel.updatePricingValue("sku",C.sku,t.fieldKey,t.variant,t.modeType))}).catch(C=>{var w;const b=((w=C==null?void 0:C.data)==null?void 0:w.message)||u("Failed to generate SKU.");z.error(b)}).finally(()=>{a.value=!1})};return(m,_)=>{var w;const g=B("el-switch"),y=B("el-option"),v=B("el-select"),C=B("el-input"),b=B("el-form-item");return r(),$(Rn,{class:de(["fct-variant-inventory",((w=e.product.detail)==null?void 0:w.variation_type)==="simple"?"fct-variant-inventory--simple":""])},ta({default:d(()=>[l.value&&s.value&&!e.isGroupMode?(r(),h("div",j7,[o("div",z7,[o("div",q7,f(A(u)("Total Stock")),1),o("div",Y7,[o("div",W7,f(e.variant.total_stock),1),n(Ir,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:c},null,8,["variant","field-key","product-edit-model"])])]),o("div",X7,[o("div",J7,f(A(u)("Available")),1),o("div",Z7,[o("div",eL,f(e.variant.available),1)])]),o("div",tL,[o("div",aL,f(A(u)("On Hold")),1),o("div",lL,[o("div",sL,f(e.variant.on_hold),1)])]),o("div",nL,[o("div",oL,f(A(u)("Delivered")),1),o("div",iL,[o("div",rL,f(e.variant.committed),1)])])])):k("",!0),l.value&&s.value&&e.isGroupMode?(r(),h("div",dL,[n(b,{label:A(u)("Total Stock")},{default:d(()=>[n(C,{type:"number",min:0,placeholder:A(u)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":_[2]||(_[2]=x=>e.variant.total_stock=x)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):k("",!0),e.isGroupMode?k("",!0):(r(),$(xp,{key:2},{header:d(({isOpen:x})=>[x?(r(),h("div",uL,f(A(u)("More details")),1)):k("",!0),x?k("",!0):(r(),h("div",cL,[o("div",AL,f(A(u)("SKU")),1)]))]),default:d(()=>[o("div",pL,[n(b,null,{label:d(()=>[o("div",fL,[n(ca,{title:A(u)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:p,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},f(a.value?A(u)("Generating..."):A(u)("Generate SKU")),9,mL)])]),default:d(()=>[n(C,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:A(u)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":_[3]||(_[3]=x=>e.variant.sku=x),maxlength:"30","show-word-limit":"",onInput:_[4]||(_[4]=x=>{e.productEditModel.updatePricingValue("sku",x,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(la,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[s.value?{name:"label",fn:d(()=>[R(f(A(u)("Inventory")),1)]),key:"0"}:void 0,s.value?{name:"action",fn:d(()=>[o("div",K7,[e.isGroupMode?(r(),h("div",G7,[o("label",null,f(A(u)("Manage Stock"))+":",1),n(v,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":_[1]||(_[1]=x=>e.variant.manage_stock=x),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(y,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(y,{value:"1",label:A(u)("Manage stock")},null,8,["label"]),n(y,{value:"0",label:A(u)("Don't manage")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),$(g,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":_[0]||(_[0]=x=>e.variant.manage_stock=x),onChange:i,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},hL={class:"fct-shared-variant-item-box__switch"},_L={class:"fct-shared-variant-item-box__hint"},vL={key:1,class:"fct-inline-select-wrap"},gL={key:0,class:"fct-package-select-icon"},yL={class:"fct-add-new-package-option"},bL={class:"fct-package-options"},wL={class:"fct-package-options-info"},CL={class:"fct-package-options-name"},BL={class:"fct-package-options-dimensions"},kL={class:"fct-product-weight-input"},$p={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var b,w;const t=e,a=V(!1),l=V(!1),s=V(ze.get("shop.shipping_packages")||[]),i=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],c={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},p=K(()=>{var F,L;const x=(L=(F=t.variant)==null?void 0:F.other_info)==null?void 0:L.package_slug;return x?s.value.find(U=>U.slug===x)||null:s.value.find(U=>U.is_default)||null}),m=x=>{if(!x)return u("Select a package");const F=x.type==="envelope"?x.length+" × "+x.width+" "+x.dimension_unit:x.length+" × "+x.width+" × "+x.height+" "+x.dimension_unit;return(x.is_default?u("Store default")+" · ":"")+x.name+" - "+F+", "+x.weight+" "+x.weight_unit},_=()=>ce.get("shipping/packages").then(x=>{s.value=x.packages||s.value}).catch(()=>{Ed({message:u("Failed to load packages."),type:"error"})}),g=V(((w=(b=t.variant)==null?void 0:b.other_info)==null?void 0:w.package_slug)||""),y=async x=>{if(x==="__add_new__"){t.variant.other_info.package_slug=g.value,await _(),a.value=!0;return}g.value=x||"",t.productEditModel.updatePricingOtherValue("package_slug",x,t.fieldKey,t.variant,t.modeType)},v=x=>{t.productEditModel.updatePricingOtherValue("weight_unit",x,t.fieldKey,t.variant,t.modeType)},C=x=>{const F=JSON.parse(JSON.stringify(s.value));x.is_default&&s.value.forEach(S=>{S.is_default=!1});let L=x.slug,U=1;for(;s.value.some(S=>S.slug===L);)L=x.slug+"-"+U,U++;x.slug=L,s.value.push(x),l.value=!0,ce.post("shipping/packages",{packages:s.value}).then(S=>{s.value=S.packages||s.value,a.value=!1,y(x.slug)}).catch(()=>{s.value=F,Ed({message:u("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(x,F)=>{const L=B("el-switch"),U=B("el-option"),S=B("el-select"),M=B("el-form-item"),I=B("el-col"),T=B("el-input"),Q=B("el-row");return r(),h(O,null,[e.variant.other_info?(r(),$(Rn,{key:0},{label:d(()=>[R(f(A(u)("Shipping")),1)]),action:d(()=>[o("div",hL,[e.isGroupMode?(r(),h("div",vL,[o("label",null,f(A(u)("Fulfillment Type"))+":",1),n(S,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[2]||(F[2]=E=>e.variant.fulfillment_type=E),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(U,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(U,{value:"physical",label:A(u)("Physical")},null,8,["label"]),n(U,{value:"digital",label:A(u)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(O,{key:0},[o("span",_L,f(A(u)("Physical Product")),1),n(L,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":F[0]||(F[0]=E=>e.variant.fulfillment_type=E),"active-value":"physical","inactive-value":"digital",onChange:F[1]||(F[1]=E=>{e.productEditModel.updatePricingValue("fulfillment_type",E,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:d(()=>[n(_a,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:d(()=>[n(Q,{gutter:10,class:"fct-physical-product-meta-row"},{default:d(()=>[n(I,{xs:24,sm:14,lg:14},{default:d(()=>[n(M,null,{label:d(()=>[R(f(A(u)("Package")),1)]),default:d(()=>[n(S,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":F[3]||(F[3]=E=>e.variant.other_info.package_slug=E),placeholder:A(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[p.value?(r(),h("span",gL,[n(ee,{name:c[p.value.type]||"Box"},null,8,["name"])])):k("",!0)]),default:d(()=>[n(U,{value:"__add_new__",label:A(u)("Add new package")},{default:d(()=>[o("div",yL," + "+f(A(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(O,null,ae(s.value,E=>(r(),$(U,{key:E.slug,label:m(E),value:E.slug},{default:d(()=>[o("div",bL,[n(ee,{name:c[E.type]||"Box"},null,8,["name"]),o("div",wL,[o("span",CL,f(E.is_default?A(u)("Store default")+" · ":"")+f(E.name),1),o("span",BL,f(E.type==="envelope"?E.length+" × "+E.width:E.length+" × "+E.width+" × "+E.height)+" "+f(E.dimension_unit)+", "+f(E.weight)+" "+f(E.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),n(I,{xs:24,sm:10,lg:10},{default:d(()=>[n(M,null,{label:d(()=>[R(f(A(u)("Product weight")),1)]),default:d(()=>[o("div",kL,[n(T,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":F[5]||(F[5]=E=>e.variant.other_info.weight=E),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:F[6]||(F[6]=E=>{e.productEditModel.updatePricingOtherValue("weight",E,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[n(S,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":F[4]||(F[4]=E=>e.variant.other_info.weight_unit=E),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(O,null,ae(i,E=>n(U,{key:E.value,label:E.label,value:E.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):k("",!0),n(zf,{modelValue:a.value,"onUpdate:modelValue":F[7]||(F[7]=E=>a.value=E),saving:l.value,onSave:C},null,8,["modelValue","saving"])],64)}}},xL={key:0,class:"fct-tax-class-control"},SL={class:"fct-inline-select-wrap"},FL={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},$L=["title"],EL={key:1,class:"fct-tax-class-control"},UL={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},IL=["title"],Ep={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=V([]),l=x=>{if(!x)return"standard";const F=a.value.find(U=>String(U.slug)===String(x));if(F)return F.slug;const L=a.value.find(U=>String(U.id)===String(x));return L?L.slug:x},s=K(()=>rt.get(t.variant,"other_info.tax_exempt","no")),i=K(()=>{const x=rt.get(t.variant,"other_info.tax_class","standard");return l(x)||"standard"}),c=V(s.value!=="yes"),p=V(i.value||"standard");Ce([s,i,a],([x,F])=>{c.value=x!=="yes",p.value=F||"standard"});const m=()=>{t.variant.other_info||(t.variant.other_info={})},_=(x,F)=>{m(),t.variant.other_info.tax_exempt=x,t.variant.other_info.tax_class=F||"standard",t.productEditModel&&t.fieldKey&&(t.productEditModel.updatePricingOtherValue("tax_exempt",t.variant.other_info.tax_exempt,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingOtherValue("tax_class",t.variant.other_info.tax_class,t.fieldKey,t.variant,t.modeType))},g=()=>{ce.get("tax/classes").then(x=>{a.value=x.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})},y=x=>{const F=p.value||i.value||"standard";c.value=x,p.value=F,_(x?"no":"yes",F)},v=x=>{p.value=x,c.value=!0,_("no",x)},C=()=>{const x=a.value.find(F=>F.slug===p.value);return x?x.title:"Standard"},b=()=>{var L,U;const x=(U=(L=t.variant)==null?void 0:L.other_info)==null?void 0:U.tax_class;if(!x)return u("Unchanged");const F=a.value.find(S=>S.slug===x);return F?F.title:x},w=x=>{t.variant.other_info&&(t.variant.other_info.tax_class=x)};return Qe(()=>{g()}),(x,F)=>{const L=B("el-option"),U=B("el-select"),S=B("el-dropdown-item"),M=B("el-dropdown-menu"),I=B("el-dropdown"),T=B("el-checkbox");return r(),$(Rn,null,{label:d(()=>[R(f(A(u)("Tax")),1)]),default:d(()=>[e.isGroupMode?(r(),h("div",xL,[o("div",SL,[o("label",null,f(A(u)("Tax Exemption"))+":",1),n(U,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":F[0]||(F[0]=Q=>e.variant.other_info.tax_exempt=Q),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:d(()=>[n(L,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(L,{value:"no",label:A(u)("Charge tax")},null,8,["label"]),n(L,{value:"yes",label:A(u)("Tax exempt")},null,8,["label"])]),_:1},8,["modelValue"])]),e.variant.other_info.tax_exempt==="no"&&a.value.length>=1?(r(),h("div",FL,[o("span",null,[R(f(A(u)("Class:"))+" ",1),o("strong",{class:de(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},f(b()),3)]),a.value.length>1?(r(),$(I,{key:0,trigger:"click",onCommand:w},{dropdown:d(()=>[n(M,null,{default:d(()=>[n(S,{command:null,class:de({"is-active":!e.variant.other_info.tax_class})},{default:d(()=>[R(f(A(u)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(O,null,ae(a.value,Q=>(r(),$(S,{key:Q.slug,command:Q.slug,class:de({"is-active":e.variant.other_info.tax_class===Q.slug})},{default:d(()=>[R(f(Q.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:A(u)("Change tax class")},F[2]||(F[2]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,$L)]),_:1})):k("",!0)])):k("",!0)])):(r(),h("div",EL,[n(T,{class:"fct-tax-class-control__checkbox",modelValue:c.value,"onUpdate:modelValue":F[1]||(F[1]=Q=>c.value=Q),onChange:y},{default:d(()=>[R(f(A(u)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),c.value&&a.value.length>=1?(r(),h("div",UL,[o("span",null,[R(f(A(u)("Class:"))+" ",1),o("strong",{class:de(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},f(C()),3)]),a.value.length>1?(r(),$(I,{key:0,trigger:"click",onCommand:v},{dropdown:d(()=>[n(M,null,{default:d(()=>[(r(!0),h(O,null,ae(a.value,Q=>(r(),$(S,{key:Q.slug,command:Q.slug,class:de({"is-active":p.value===Q.slug})},{default:d(()=>[R(f(Q.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:A(u)("Change tax class")},F[3]||(F[3]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,IL)]),_:1})):k("",!0)])):k("",!0)]))]),_:1})}}},QL={class:"fct-product-pricing-form-wrap"},DL={class:"fct-product-pricing-form-inner"},VL={key:0,class:"dialog-footer"},TL={class:"fct-btn-group sm"},Bd={__name:"ProductPricingForm",props:{modeType:String,index:Number,fieldKey:String,product:Object,productEditModel:Object,variantTitleInfo:Object},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,s=V({}),i=a,c=ps(),p=V(0),m=V(!1),_=V({}),g=V(null),y=V(!1),v=H=>H?JSON.parse(JSON.stringify(H)):{},C=(H=l.modeType,P=l.index)=>{var J,oe,Z;if(H==="create")return"create";if(H==="duplicate"){const W=(J=l.product.variants)==null?void 0:J[P];return`duplicate-${(W==null?void 0:W.id)??P??"draft"}`}if(((oe=l.product.detail)==null?void 0:oe.variation_type)==="simple")return"simple-0";const G=(Z=l.product.variants)==null?void 0:Z[P];return`update-${(G==null?void 0:G.id)??P??"draft"}`},b=(H=l.modeType,P=l.index,G=s.value)=>({modeType:H,index:P,variant:v(G)}),w=()=>{if(y.value){y.value=!1;return}!g.value||m.value||!p.value||(_.value[g.value]=b())},x=()=>{var H;(H=s.value)!=null&&H.other_info&&(s.value.other_info.payment_type||(s.value.other_info.payment_type="onetime"),s.value.other_info.weight_unit||(s.value.other_info.weight_unit=S.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},F=async()=>{var P,G,J,oe;w(),m.value=!0,p.value=0,g.value=C();const H=(P=_.value[g.value])==null?void 0:P.variant;if(H){s.value=v(H),x(),await Se(),p.value=1,m.value=!1;return}((G=l.product.detail)==null?void 0:G.variation_type)==="simple"?Array.isArray(l.product.variants)&&l.product.variants.length===0?(s.value=l.productEditModel.addDummyVariant(),s.value.variation_title=l.product.post_title):s.value=l.product.variants[0]:l.modeType==="create"?s.value=l.productEditModel.addDummyVariant():l.modeType==="update"?s.value=v((J=l.product.variants)==null?void 0:J[l.index]):l.modeType==="duplicate"?(s.value=v((oe=l.product.variants)==null?void 0:oe[l.index]),s.value.serial_index=l.productEditModel.variantsLength()+1,s.value.variation_title=`${u("Copy of")} ${s.value.variation_title||""}`.trim(),s.value.sku="",s.value.on_hold=0,s.value.committed=0,s.value.available=s.value.total_stock??0,delete s.value.id):s.value={},x(),await Se(),p.value=0,m.value=!1},L=async()=>{var H;try{let P=l.index;const G=v(s.value);l.modeType==="duplicate"&&(P=l.productEditModel.variantsLength(),G.rowId=(G.rowId??0)+1);let J=await l.productEditModel.createOrUpdatePricing(G);return(H=J==null?void 0:J.data)!=null&&H.id?(G.id=J.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(P,G),P==null&&(P=l.product.variants.findIndex(oe=>(oe==null?void 0:oe.id)===G.id),P===-1&&(P=l.product.variants.length-1)),g.value&&delete _.value[g.value],p.value=0,i("createOrUpdateVariant",{index:P,modeType:l.modeType,variant:v(G)}),{index:P,modeType:l.modeType,variant:v(G)}):null}catch{return null}},U=async()=>L(),S=K(()=>ze.get("shop.weight_unit")||"kg"),M=()=>{const H={..._.value};return g.value&&p.value&&(H[g.value]=b()),Object.entries(H)},I=()=>M().length>0,T=()=>M().length,Q=K(()=>M().length),E=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await F()};return Ce(s,()=>{m.value||p.value++},{deep:!0}),Ce(()=>[l.modeType,l.index],()=>{F()},{immediate:!0}),Ce(Q,H=>{i("dirtyStateChange",!!H)},{immediate:!0}),c.bind(["mod+s"],H=>{var P,G;((G=(P=l.product)==null?void 0:P.detail)==null?void 0:G.variation_type)!=="simple"&&(H.preventDefault(),p.value&&U())}),Ct(()=>{c.unbind("mod+s")}),t({hasDirtyDrafts:I,getDirtyDraftCount:T,discardDrafts:E,saveCurrentDraft:L,loadVariantFromProps:F,getVariantData:()=>v(s.value)}),(H,P)=>{const G=B("el-form"),J=B("el-button");return r(),h("div",QL,[o("div",DL,[n(G,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(t7,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel,"title-info":e.variantTitleInfo},null,8,["variant","field-key","mode-type","product","product-edit-model","title-info"]),n(Sp,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),n(Fp,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),n($p,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),$(Ep,{key:0,variant:s.value,"product-edit-model":e.productEditModel,"field-key":l.fieldKey,"mode-type":e.modeType},null,8,["variant","product-edit-model","field-key","mode-type"])):k("",!0)]),_:1})]),e.modeType!=="add"?(r(),h("div",VL,[o("div",TL,[Q.value?(r(),$(J,{key:0,onClick:E},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1})):k("",!0),n(J,{onClick:P[0]||(P[0]=()=>{i("closeModal")})},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(J,{disabled:e.productEditModel.saving||e.modeType==="update"&&!Q.value,onClick:U,type:"primary",loading:e.productEditModel.saving},{default:d(()=>[R(f(typeof s.value.id>"u"?A(u)("Save"):A(u)("Update")),1)]),_:1},8,["disabled","loading"])])])):k("",!0)])}}},ML={class:"fct-product-button-and-drawer-wrap"},LL={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},RL={key:1,class:"fct-btn-group sm"},OL={class:"more-btn"},qi={__name:"ProductPricingActions",props:{modeType:String,index:Number,variant:{type:Object,default:{}},product:Object,productEditModel:Object},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t;let s=V(null);const i=V(1),c=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=K(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:C=>{c(C)},vueContext:(v=zt())==null?void 0:v.ctx}}),m=V([]),_=()=>{var w,x;const v=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks),C=[],b=(x=v==null?void 0:v.applyFilters)==null?void 0:x.call(v,"fluent_cart_product_pricing_actions_dropdown_items",C,p.value);m.value=Array.isArray(b)?b:C},g=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;Qe(()=>{s.value=a.index,_(),setTimeout(_,0)});const y=v=>{var C,b;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const w=((C=window==null?void 0:window.fluent_cart_admin)==null?void 0:C.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(b=w==null?void 0:w.doAction)==null?void 0:b.call(w,"fluent_cart_product_pricing_actions_dropdown_command",v.command,p.value,v)}}v==="duplicate_pricing"?c("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,C)=>{const b=B("el-button"),w=B("el-checkbox"),x=B("el-dropdown-item"),F=B("el-dropdown-menu"),L=B("el-dropdown");return r(),h("div",ML,[a.modeType=="add"?(r(),h("div",LL,[e.product.detail.variation_type!=="simple"?(r(),$(b,{key:0,text:"",type:"primary",onClick:C[0]||(C[0]=U=>c("create"))},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):k("",!0)])):k("",!0),a.modeType=="action"?(r(),h("div",RL,[n(Xe,{class:"hide-on-mobile",size:"small",tag:"button",onClick:C[1]||(C[1]=U=>c("update"))},{default:d(()=>[n(ee,{name:"Edit"})]),_:1}),n(L,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:C[5]||(C[5]=U=>{U&&_()})},{dropdown:d(()=>[n(F,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),$(x,{key:0,class:"item-checkbox"},{default:d(()=>[n(w,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":C[2]||(C[2]=U=>e.variant.manage_stock=U),onChange:C[3]||(C[3]=U=>{e.productEditModel.onChangePricing("manage_stock",A(s),U)}),"true-value":"0","false-value":"1"},{default:d(()=>[R(f(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):k("",!0),n(x,{class:"show-on-mobile",onClick:C[4]||(C[4]=U=>c("update"))},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),$(x,{key:1,command:"duplicate_pricing"},{default:d(()=>[n(ee,{name:"Duplicate"}),R(" "+f(v.$t("Duplicate")),1)]),_:1})):k("",!0),n(x,null,{default:d(()=>[e.variant.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:String(e.variant.id),showMode:"icon_with_text",buttonText:v.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:1}),n(x,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:d(()=>{var U;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:((U=v.appVars)==null?void 0:U.frontend_url)+"=instant_checkout&item_id="+e.variant.id+"&quantity=1",showMode:"icon_with_text",buttonText:v.$t("Direct Checkout"),tooltipContent:v.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(O,{key:1},[n(ee,{name:"Copy"}),R(" "+f(v.$t("Direct Checkout"))+" ",1),n(ca,{content:v.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:1},8,["disabled"]),(r(!0),h(O,null,ae(m.value,(U,S)=>(r(),$(x,{key:"js_item_"+S,command:U,class:de(U==null?void 0:U.class),divided:!!(U!=null&&U.divided),disabled:g(U)},{default:d(()=>[U!=null&&U.icon?(r(),$(ee,{key:0,name:U.icon},null,8,["name"])):k("",!0),R(" "+f(U==null?void 0:U.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),$(x,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(v.$t("Delete")),1)]),_:1})):k("",!0)]),_:1})]),default:d(()=>[o("span",OL,[n(ee,{name:"More"})])]),_:1})])):k("",!0)])}}},HL={class:"fct-variant-pricing-add-button-wrap"},PL={__name:"VariantPricingAddButton",props:{product:Object,drawerMode:String,isVariationDirty:Boolean},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t,s=()=>{l("open-editor",{modeType:"create"})},i=()=>a.drawerMode==="create"||a.isVariationDirty;return(c,p)=>{var _;const m=B("el-button");return r(),h("div",HL,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),$(m,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(e.product.variants.length>0?c.$t("Add more"):c.$t("Add Pricing")),1)]),_:1},8,["disabled"])):k("",!0)])}}},NL={class:"fct-shared-variant-nav__summary"},KL={class:"fct-shared-variant-nav__summary-product"},GL={class:"fct-shared-variant-nav__summary-product-name"},jL={class:"fct-shared-variant-nav__summary-meta"},zL={class:"fct-shared-variant-nav__status"},qL={class:"fct-shared-variant-nav__variant-count"},Qr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",NL,[o("div",KL,[o("h3",GL,f(e.product.post_title||A(u)("Untitled product")),1)]),o("div",jL,[o("span",zL,[n(Aa,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",qL,f(e.product.variants.length)+" "+f(A(u)("variants")),1)])]))}},YL={class:"fct-shared-variant-nav__group-header"},WL=["aria-expanded","onClick"],XL={class:"fct-shared-variant-nav__group-caret"},JL={class:"fct-shared-variant-nav__group-title"},ZL={class:"fct-shared-variant-nav__group-count"},eR=["aria-label","onClick"],tR={class:"fct-shared-variant-nav__group-body"},aR=["disabled","aria-current","onClick"],lR={class:"fct-shared-variant-nav__item-image-wrapper"},sR={class:"fct-shared-variant-nav__item-image"},nR=["src","alt"],oR=["src","alt"],iR={key:0,class:"fct-shared-variant-nav__item-dot"},rR={class:"fct-shared-variant-nav__item-content"},dR={class:"fct-shared-variant-nav__item-title"},uR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},cR={class:"fct-shared-variant-nav__item-meta"},AR=["disabled","aria-label"],pR=["disabled","aria-label"],fR={class:"more-btn"},mR=["disabled","aria-current","onClick"],hR={class:"fct-shared-variant-nav__item-image-wrapper"},_R={class:"fct-shared-variant-nav__item-image"},vR=["src","alt"],gR=["src","alt"],yR={key:0,class:"fct-shared-variant-nav__item-dot"},bR={class:"fct-shared-variant-nav__item-content"},wR={class:"fct-shared-variant-nav__item-title"},CR={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},BR={class:"fct-shared-variant-nav__item-meta"},kR=["disabled","aria-label"],xR=["disabled","aria-label"],SR={class:"more-btn"},Up={__name:"VariantNavList",props:{items:Array,groupedItems:{type:Array,default:null},activeKey:[String,Number],isDirty:Boolean,isSaving:Boolean,drawerMode:String,product:Object,productEditModel:Object,canCopyDirectCheckout:Function},emits:["select","command","save","edit-group"],setup(e,{emit:t}){const a=()=>cs.getUrl("images/placeholder.svg"),l=e,s=b=>{const w=l.isDirty&&l.activeKey!==b.key,x=l.drawerMode==="create"&&b.key!=="draft-variation";return w||x},i=t,c=K(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=V(null),m=(b,w)=>{for(const x of b||[])if((x.items||[]).some(F=>F.key===w))return String(x.termId);return null};Ce(()=>l.groupedItems,b=>{if(!Array.isArray(b)||!b.length){p.value=null;return}p.value=m(b,l.activeKey)||String(b[0].termId)},{immediate:!0}),Ce(()=>l.activeKey,b=>{if(!c.value||b==null)return;const w=m(l.groupedItems,b);w&&(p.value=w)});const _=b=>String(b.termId)===p.value,g=b=>{const w=String(b.termId);p.value=p.value===w?null:w},y=V(null);let v=null;const C=()=>{v&&clearTimeout(v),Se(()=>{v=setTimeout(()=>{var w;v=null;const b=(w=y.value)==null?void 0:w.querySelector(".fct-shared-variant-nav__item-shell.is-active");b&&b.scrollIntoView({block:"center"})},240)})};return Qe(C),Ce(()=>l.activeKey,()=>C()),vl(()=>{v&&clearTimeout(v)}),(b,w)=>{const x=B("el-dropdown-item"),F=B("el-dropdown-menu"),L=B("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[c.value?(r(!0),h(O,{key:0},ae(e.groupedItems,U=>(r(),h("div",{key:"g-"+U.termId,class:de(["fct-shared-variant-nav__group",{"is-collapsed":!_(U)}])},[o("div",YL,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_(U)?"true":"false",onClick:S=>g(U)},[o("span",XL,[n(ee,{name:_(U)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",JL,f(U.title),1),o("span",ZL,f(A(u)("%1$s variants",U.count)),1)],8,WL),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":A(u)("Edit group"),onClick:Ne(S=>i("edit-group",U),["stop"])},[n(ee,{name:"Edit"})],8,eR)]),n(_a,{visible:_(U),accordion:"",duration:220},{default:d(()=>[o("div",tR,[(r(!0),h(O,null,ae(U.items,S=>{var M,I,T,Q,E,D,H,P;return r(),h("div",{key:S.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===S.key,"is-draft":S.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(S)}]),disabled:s(S),"aria-current":e.activeKey===S.key?"true":void 0,onClick:G=>!s(S)&&i("select",S)},[o("div",lR,[o("div",sR,[(T=(I=(M=S.variant)==null?void 0:M.media)==null?void 0:I[0])!=null&&T.url?(r(),h("img",{key:0,src:(D=(E=(Q=S.variant)==null?void 0:Q.media)==null?void 0:E[0])==null?void 0:D.url,alt:S.label},null,8,nR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:S.label},null,8,oR))]),e.activeKey===S.key?(r(),h("span",iR)):k("",!0)]),o("div",rR,[o("span",dR,[R(f(S.label)+" ",1),((H=S.variant)==null?void 0:H.item_status)==="inactive"&&((P=e.product.detail)==null?void 0:P.variation_type)==="advanced_variations"?(r(),h("span",uR,f(A(u)("Inactive")),1)):k("",!0)]),o("span",cR,f(S.meta),1)])],10,aR),e.isDirty&&e.activeKey===S.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[0]||(w[0]=G=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),$(ee,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),$(ee,{key:0,name:"Save"}))],10,AR)):k("",!0),S.isDraft?k("",!0):(r(),$(L,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(S),onCommand:G=>!s(S)&&i("command",G,S)},{dropdown:d(()=>[n(F,null,{default:d(()=>{var G,J,oe,Z,W;return[["simple","advanced_variations"].includes((G=e.product.detail)==null?void 0:G.variation_type)?k("",!0):(r(),$(x,{key:0,command:"duplicate"},{default:d(()=>[n(ee,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(ee,{name:"Copy"}),R(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(S)},{default:d(()=>[n(ee,{name:"Copy"}),R(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(J=S.variant)!=null&&J.id&&((oe=e.product.detail)==null?void 0:oe.variation_type)==="advanced_variations"?(r(),$(x,{key:1,command:"toggle_status",class:de({"item-destructive":((Z=S.variant)==null?void 0:Z.item_status)!=="inactive"})},{default:d(()=>{var pe,N;return[n(ee,{name:((pe=S.variant)==null?void 0:pe.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((N=S.variant)==null?void 0:N.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):k("",!0),((W=e.product.detail)==null?void 0:W.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),$(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})):k("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(S)}]),disabled:s(S),onClick:w[1]||(w[1]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",fR,[n(ee,{name:"More"})])],10,pR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(O,{key:1},ae(e.items,U=>{var S,M,I,T,Q,E,D,H;return r(),h("div",{key:U.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===U.key,"is-draft":U.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(U)}]),disabled:s(U),"aria-current":e.activeKey===U.key?"true":void 0,onClick:P=>!s(U)&&i("select",U)},[o("div",hR,[o("div",_R,[(I=(M=(S=U.variant)==null?void 0:S.media)==null?void 0:M[0])!=null&&I.url?(r(),h("img",{key:0,src:(E=(Q=(T=U.variant)==null?void 0:T.media)==null?void 0:Q[0])==null?void 0:E.url,alt:U.label},null,8,vR)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:U.label},null,8,gR))]),e.activeKey===U.key?(r(),h("span",yR)):k("",!0)]),o("div",bR,[o("span",wR,[R(f(U.label)+" ",1),((D=U.variant)==null?void 0:D.item_status)==="inactive"&&((H=e.product.detail)==null?void 0:H.variation_type)==="advanced_variations"?(r(),h("span",CR,f(A(u)("Inactive")),1)):k("",!0)]),o("span",BR,f(U.meta),1)])],10,mR),e.isDirty&&e.activeKey===U.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:w[2]||(w[2]=P=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),$(ee,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),$(ee,{key:0,name:"Save"}))],10,kR)):k("",!0),U.isDraft?k("",!0):(r(),$(L,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(U),onCommand:P=>!s(U)&&i("command",P,U)},{dropdown:d(()=>[n(F,null,{default:d(()=>{var P,G,J,oe,Z;return[["simple","advanced_variations"].includes((P=e.product.detail)==null?void 0:P.variation_type)?k("",!0):(r(),$(x,{key:0,command:"duplicate"},{default:d(()=>[n(ee,{name:"Duplicate"}),R(" "+f(A(u)("Duplicate")),1)]),_:1})),n(x,{command:"copy_variation_id"},{default:d(()=>[n(ee,{name:"Copy"}),R(" "+f(A(u)("Copy Variation ID")),1)]),_:1}),n(x,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(U)},{default:d(()=>[n(ee,{name:"Copy"}),R(" "+f(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(G=U.variant)!=null&&G.id&&((J=e.product.detail)==null?void 0:J.variation_type)==="advanced_variations"?(r(),$(x,{key:1,command:"toggle_status",class:de({"item-destructive":((oe=U.variant)==null?void 0:oe.item_status)!=="inactive"})},{default:d(()=>{var W,pe;return[n(ee,{name:((W=U.variant)==null?void 0:W.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(((pe=U.variant)==null?void 0:pe.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):k("",!0),((Z=e.product.detail)==null?void 0:Z.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),$(x,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})):k("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(U)}]),disabled:s(U),onClick:w[3]||(w[3]=Ne(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",SR,[n(ee,{name:"More"})])],10,xR)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},FR={class:"fct-shared-variant-nav-mobile"},$R=["disabled","onClick"],Ip={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),h("div",FR,[(r(!0),h(O,null,ae(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:de(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===i.key,"is-draft":i.isDraft}]),disabled:e.isDirty&&e.activeKey!==i.key,onClick:c=>a("select",i)},f(i.label),11,$R))),128))]))}},ER={class:"fct-product-pricing-table-wrap"},UR={class:"fct-table-draggable hide-on-mobile"},IR={class:"is-right"},QR={key:0,class:"fct-drag-handle drag-icon"},DR=["src","alt"],VR=["src"],TR={class:"fct-product-pricing-table-item"},MR={key:0,class:"fct-variant-badge"},LR={class:"fct-product-pricing-table-item"},RR={key:0,class:"fct-variant-badge fct-variant-badge--light"},OR={class:"fct-product-pricing-table-item"},HR={class:"is-right"},PR={class:"fct-product-pricing-table-item"},NR={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},KR={key:0,class:"fct-drag-handle drag-icon"},GR={class:"fct-product-pricing-table-mobile-item-inner"},jR={class:"fct-product-pricing-table-item"},zR={class:"media"},qR=["src","alt"],YR=["src"],WR={class:"fct-product-pricing-table-item-content"},XR={class:"title"},JR={key:0,class:"fct-variant-badge"},ZR={key:0,class:"compare-price"},eO={class:"price"},tO={key:0,class:"capitalize"},aO={key:0,class:"fct-product-pricing-table-item-action"},lO={class:"fct-shared-variant-drawer__layout"},sO={key:0,class:"fct-shared-variant-nav"},nO={class:"fct-shared-variant-drawer__content"},oO={class:"fct-shared-variant-drawer__form"},iO={class:"fct-variant-dirty-dialog__header"},rO={class:"dialog-footer"},dO={class:"fct-btn-group sm"},ju=1040,uO=1060,cO={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=V(typeof window<"u"?window.innerWidth:ju),l=V(0),s=()=>{if(typeof window>"u")return 0;const fe=document.querySelector("#adminmenuwrap");if(!fe)return 0;const he=window.getComputedStyle(fe);return he.display==="none"||he.visibility==="hidden"?0:Math.round(fe.getBoundingClientRect().width)},i=()=>{typeof window>"u"||(a.value=window.innerWidth,l.value=s())};Qe(()=>{i(),window.addEventListener("resize",i),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(he=>{he.addEventListener("wheel",le=>{document.activeElement===he&&le.preventDefault()})}),t.product.variants.filter(he=>{const le=he.media?he.media.meta_value||[]:[];return he.media=le})},50)}),Ct(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const c=K(()=>({animation:600,ghostClass:"ghost"})),p=V(!1),m=V("update"),_=V(null),g=V(null),y=V(!1),v=V(!1),C=V(null),b=V(!1),w=K(()=>Math.max(a.value-l.value,360)),x=K(()=>w.value<=uO),F=K(()=>{let fe=24;a.value<=640?fe=12:a.value<=900&&(fe=16);const he=Math.max(w.value-fe,320);return`${Math.min(ju,he)}px`}),L=(fe,he)=>(fe==null?void 0:fe.variation_title)||`${u("Variation")} ${he+1}`,U=fe=>{var le,me;const he=(fe==null?void 0:fe.item_price)??"";return he===""||he===null||he===void 0?u("No price set"):`${((me=(le=window.appVars)==null?void 0:le.shop)==null?void 0:me.currency_sign)||"$"} ${he}`},S=fe=>typeof fe=="number"&&fe>=0&&fe<t.product.variants.length?fe:t.product.variants.length?0:null,M=({modeType:fe="update",index:he=null}={})=>{m.value=fe,_.value=fe==="create"?null:S(he),b.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},I=()=>{b.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},T=()=>{y.value=!1,v.value=!1,C.value=null},Q=()=>{var fe,he;return((he=(fe=g.value)==null?void 0:fe.hasDirtyDrafts)==null?void 0:he.call(fe))??!1},E=fe=>{fe&&(m.value=fe.modeType,_.value=fe.index,t.productEditModel.setValidationErrors({}))},D=async(fe,he)=>{var le,me;if(!(!he||!fe)){if(fe==="duplicate"){M({modeType:"duplicate",index:he.index});return}if(fe==="delete"&&((le=he.variant)!=null&&le.id)){t.productEditModel.deletePricing(he.variant.id,he.index).then(async()=>{var Ue,et;await Se(),t.product.variants.length>0?(m.value="update",_.value=Math.min(he.index,t.product.variants.length-1),b.value=!1,(et=(Ue=g.value)==null?void 0:Ue.loadVariantFromProps)==null||et.call(Ue)):I()}).catch(()=>{});return}if(fe==="copy_variation_id"&&((me=he.variant)!=null&&me.id)){Yl.copy(String(he.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}fe==="copy_direct_checkout"&&H(he)&&Yl.copy(P(he),{successMessage:u("Direct checkout link copied to clipboard")})}},H=fe=>{var he,le;return!!((he=fe==null?void 0:fe.variant)!=null&&he.id)&&["publish","private"].includes((le=t.product)==null?void 0:le.post_status)},P=fe=>`${ze.get("frontend_url")}=instant_checkout&item_id=${fe.variant.id}&quantity=1`,G=()=>{const fe=C.value;if(T(),!!fe&&fe.type==="close"){if(typeof fe.done=="function"){fe.done();return}I()}},J=()=>{T()},oe=async()=>{var fe,he;await((he=(fe=g.value)==null?void 0:fe.discardDrafts)==null?void 0:he.call(fe)),G()},Z=async()=>{var he;if(!((he=g.value)!=null&&he.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){G();return}v.value=!1,J()},W=fe=>{if(!Q()){fe();return}C.value={type:"close",done:fe},y.value=!0},pe=()=>{W(()=>{I()})},N=fe=>{b.value=fe},j=fe=>{fe&&(m.value="update",typeof fe.index=="number"&&fe.index>=0?_.value=fe.index:_.value=S(_.value),b.value=!1,t.productEditModel.setValidationErrors({}))},q=(fe,he)=>{const le=L(fe,he);return`${u("Copy of")} ${le}`},X=K(()=>{var he;const fe=(t.product.variants||[]).map((le,me)=>({key:(le==null?void 0:le.id)??`variant-${me}`,index:me,variant:le,label:L(le,me),meta:U(le),modeType:"update",isDraft:!1}));if(p.value&&m.value==="create"&&fe.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&m.value==="duplicate"){const le=(he=t.product.variants)==null?void 0:he[_.value];fe.push({key:"duplicate-variation",index:_.value,variant:le,label:q(le,_.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return fe}),ie=K(()=>{var he;if(m.value==="create"&&_.value===null)return"draft-variation";if(m.value==="duplicate")return"duplicate-variation";const fe=(he=t.product.variants)==null?void 0:he[_.value];return(fe==null?void 0:fe.id)??`variant-${_.value??0}`}),ge=fe=>{fe&&(b.value&&ie.value!==fe.key||E(fe))};return(fe,he)=>{const le=B("el-input"),me=B("el-drawer"),Ue=B("el-button"),et=B("el-dialog");return r(),h("div",ER,[o("div",UR,[o("table",null,[he[5]||(he[5]=o("colgroup",null,[o("col"),o("col",{width:"50"}),o("col",{width:"300"}),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[he[4]||(he[4]=o("th",null,null,-1)),o("th",null,f(fe.$t("Image")),1),o("th",null,f(fe.$t("Title")),1),o("th",null,f(fe.$t("Price")),1),o("th",null,f(fe.$t("Compare at price")),1),o("th",IR,f(fe.$t("Action")),1)])]),n(A(Js),ga(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:he[0]||(he[0]=be=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(O,null,ae(e.product.variants,(be,qe)=>{var gt,Ze,Fe,Ee;return r(),h("tr",{key:be.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",QR,[n(ee,{name:"ReorderDotsVertical"})])):k("",!0)]),o("td",null,[e.readonly?be.media&&be.media[0]?(r(),h("img",{key:1,src:be.media[0].url,alt:be.variation_title,class:"fct-variant-thumb-readonly"},null,8,DR)):(r(),h("img",{key:2,src:fe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,VR)):(r(),$(hl,{key:0,modelValue:be.media,"onUpdate:modelValue":Pe=>be.media=Pe,compact:!0,"max-thumbs":1,onChange:Pe=>e.productEditModel.onUploadPricingMedia("media",qe,Pe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",TR,[n(le,{class:de(e.productEditModel.hasValidationError(`variants.${qe}.variation_title`)?"is-error":""),id:`variants.${qe}.variation_title`,placeholder:fe.$t("e.g. Small, Medium, Large"),type:"text",modelValue:be.variation_title,"onUpdate:modelValue":Pe=>be.variation_title=Pe,onInput:Pe=>{e.productEditModel.onChangePricing("variation_title",qe,Pe)},disabled:((Ze=(gt=e.product)==null?void 0:gt.detail)==null?void 0:Ze.variation_type)==="simple"||e.readonly,onFocus:Pe=>e.productEditModel.clearValidationError(`variants.${qe}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((Fe=be.other_info)==null?void 0:Fe.installment)==="yes"?(r(),h("span",MR,f(be.other_info.times)+" "+f(A(u)("Installment")),1)):k("",!0)])]),o("td",null,[o("div",LR,[n(zs,{placeholder:fe.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${qe}.item_price`)?"is-error":"",id:`variants.${qe}.item_price`,"model-value":be.item_price,disabled:be.expanded||e.readonly,"onUpdate:modelValue":Pe=>{e.readonly||(be.item_price=Pe,e.productEditModel.onChangePricing("item_price",qe,Pe),e.productEditModel.clearValidationError(`variants.${qe}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),((Ee=be.other_info)==null?void 0:Ee.payment_type)==="subscription"?(r(),h("span",RR,f(be.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",OR,[n(zs,{placeholder:fe.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${qe}.compare_price`)?"is-error":"",id:`variants.${qe}.compare_price`,"model-value":be.compare_price,disabled:be.expanded||e.readonly,"onUpdate:modelValue":Pe=>{e.readonly||(be.compare_price=Pe,e.productEditModel.onChangePricing("compare_price",qe,Pe),e.productEditModel.clearValidationError(`variants.${qe}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",HR,[o("div",PR,[e.readonly?k("",!0):(r(),$(qi,{key:0,modeType:"action",index:qe,variant:be,product:e.product,productEditModel:e.productEditModel,onOpenEditor:M},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",NR,[n(A(Js),ga(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:he[1]||(he[1]=be=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(O,null,ae(e.product.variants,(be,qe)=>{var gt,Ze;return r(),h("div",{key:be.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",KR,[n(ee,{name:"ReorderDotsVertical"})])):k("",!0),o("div",GR,[o("div",jR,[o("div",zR,[e.readonly?be.media&&be.media[0]?(r(),h("img",{key:1,src:be.media[0].url,alt:be.variation_title,class:"fct-variant-thumb-readonly"},null,8,qR)):(r(),h("img",{key:2,src:fe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,YR)):(r(),$(hl,{key:0,modelValue:be.media,"onUpdate:modelValue":Fe=>be.media=Fe,compact:!0,"max-thumbs":1,onChange:Fe=>e.productEditModel.onUploadPricingMedia("media",qe,Fe)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",WR,[o("div",XR,[R(f(be.variation_title)+" ",1),((gt=be.other_info)==null?void 0:gt.installment)==="yes"?(r(),h("span",JR,f(be.other_info.times)+" "+f(A(u)("Installment")),1)):k("",!0)]),o("ul",null,[o("li",null,[be.compare_price?(r(),h("div",ZR,[o("span",null,f(fe.appVars.shop.currency_sign),1),R(" "+f(be.compare_price),1)])):k("",!0),o("div",eO,[o("span",null,f(fe.appVars.shop.currency_sign),1),R(" "+f(be.item_price),1)])]),((Ze=be.other_info)==null?void 0:Ze.payment_type)==="subscription"?(r(),h("li",tO,f(be.other_info.repeat_interval),1)):k("",!0)])])]),e.readonly?k("",!0):(r(),h("div",aO,[n(qi,{modeType:"action",index:qe,variant:be,product:e.product,productEditModel:e.productEditModel,onOpenEditor:M},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?k("",!0):(r(),$(qi,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:M},null,8,["product","productEditModel"])),n(me,{modelValue:p.value,"onUpdate:modelValue":he[2]||(he[2]=be=>p.value=be),title:fe.$t("Pricing"),size:F.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":W,class:"fct-shared-variant-drawer",onClose:I},{default:d(()=>[o("div",lO,[x.value?k("",!0):(r(),h("aside",sO,[n(Qr,{product:e.product},null,8,["product"]),n(Up,{items:X.value,"active-key":ie.value,"is-dirty":b.value,"drawer-mode":m.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":H,"is-saving":v.value,onSelect:ge,onCommand:D,onSave:Z},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(PL,{product:e.product,"drawer-mode":m.value,"is-variation-dirty":b.value,onOpenEditor:M},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",nO,[x.value?(r(),$(Ip,{key:0,items:X.value,"active-key":ie.value,"is-dirty":b.value,onSelect:ge},null,8,["items","active-key","is-dirty"])):k("",!0),o("div",oO,[n(Bd,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:m.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:j,onCloseModal:pe,onDirtyStateChange:N},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(et,{modelValue:y.value,"onUpdate:modelValue":he[3]||(he[3]=be=>y.value=be),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:J},{header:d(()=>[o("div",iO,[o("h3",null,f(A(u)("Unsaved changes")),1)])]),default:d(()=>[o("p",null,f(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",rO,[o("div",dO,[n(Ue,{disabled:v.value,onClick:J,size:"small"},{default:d(()=>[R(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(Ue,{disabled:v.value,onClick:oe,size:"small"},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(Ue,{type:"primary",loading:v.value,onClick:Z,size:"small"},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},AO={key:0,class:"fct-adv-groupby-bar"},pO={class:"fct-adv-groupby-label"},fO={__name:"AdvancedVariationGroupBar",props:{product:Object,attributeGroups:{type:Array,default:()=>[]},modelValue:{type:[Number,null],default:null}},emits:["update:modelValue"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=K({get(){return l.modelValue},set(p){s("update:modelValue",p)}}),c=K(()=>{var m,_,g;const p=(g=(_=(m=l.product)==null?void 0:m.detail)==null?void 0:_.other_info)==null?void 0:g.attribute_config;return!p||!Array.isArray(p)?[]:p.map(y=>{const v=l.attributeGroups.find(C=>String(C.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:c}),(p,m)=>{const _=B("el-option"),g=B("el-select");return c.value.length>=2?(r(),h("div",AO,[o("span",pO,f(p.$t("Group by")),1),n(g,{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=y=>i.value=y),placeholder:p.$t("Select")},{default:d(()=>[(r(!0),h(O,null,ae(c.value,y=>(r(),$(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):k("",!0)}}},mO={key:0,class:"fct-adv-bulk-bar"},hO={class:"fct-adv-bulk-count"},_O=["textContent"],vO={__name:"AdvancedVariationBulkBar",props:{selectedCount:{type:Number,default:0},bulkAction:{type:String,default:""},bulkValue:{type:[String,Number],default:""},saving:{type:Boolean,default:!1}},emits:["update:bulkAction","update:bulkValue","apply","clear"],setup(e,{emit:t}){const a=e,l=t,s=K({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=K({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),c=K(()=>a.bulkAction==="set_price");return(p,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-input"),v=B("el-button");return e.selectedCount>0?(r(),h("div",mO,[o("span",hO,f(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:m[0]||(m[0]=C=>p.$emit("clear"))},f(p.$t("Clear")),1),n(g,{modelValue:s.value,"onUpdate:modelValue":m[1]||(m[1]=C=>s.value=C),placeholder:p.$t("Bulk Actions"),size:"small"},{default:d(()=>[n(_,{label:p.$t("Set Price"),value:"set_price"},null,8,["label"]),n(_,{label:p.$t("Set Active"),value:"set_status_active"},null,8,["label"]),n(_,{label:p.$t("Set Inactive"),value:"set_status_inactive"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),c.value?(r(),$(y,{key:0,modelValue:i.value,"onUpdate:modelValue":m[2]||(m[2]=C=>i.value=C),placeholder:p.$t("Value"),size:"small",type:"number"},{prefix:d(()=>[o("span",{textContent:f(p.appVars.shop.currency_sign)},null,8,_O)]),_:1},8,["modelValue","placeholder"])):k("",!0),n(v,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:m[3]||(m[3]=C=>p.$emit("apply"))},{default:d(()=>[R(f(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):k("",!0)}}},gO={class:"fct-grouped-variant-table fct-adv-table-desktop"},yO={class:"is-right"},bO=["aria-expanded","aria-label"],wO=["onClick"],CO={class:"fct-adv-group-header"},BO={class:"fct-adv-group-count"},kO={class:"fct-product-pricing-table-item"},xO=["textContent"],SO={class:"is-right"},FO={class:"fct-adv-group-actions"},$O=["aria-expanded","aria-label","onClick"],EO={class:"fct-adv-slot-row"},UO={colspan:"6"},IO={class:"fct-product-pricing-table-item"},QO={class:"fct-product-pricing-table-item fct-adv-child-title"},DO={class:"fct-adv-title-cell"},VO={class:"fct-adv-title-main"},TO={class:"fct-adv-variant-title"},MO={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},LO={class:"fct-product-pricing-table-item"},RO=["textContent"],OO={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},HO={class:"fct-product-pricing-table-item"},PO=["textContent"],NO={class:"is-right"},KO={class:"fct-product-pricing-table-item"},GO={class:"fct-btn-group sm justify-end"},jO=["aria-label"],zO={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},qO={colspan:"6"},YO={class:"fct-grouped-variant-table fct-adv-table-mobile"},WO={class:"is-right"},XO=["aria-expanded","aria-label"],JO=["onClick"],ZO={class:"fct-adv-group-header"},eH={class:"fct-adv-group-count"},tH={class:"is-right"},aH={class:"fct-adv-group-actions"},lH=["aria-expanded","aria-label","onClick"],sH={class:"fct-adv-slot-row"},nH={colspan:"4"},oH={class:"fct-product-pricing-table-item"},iH={class:"fct-product-pricing-table-item fct-adv-child-title"},rH={class:"fct-adv-title-cell"},dH={class:"fct-adv-title-main"},uH={class:"fct-adv-variant-title"},cH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},AH={class:"fct-adv-variant-price"},pH={key:0,class:"fct-adv-variant-compare"},fH={class:"is-right"},mH={class:"fct-product-pricing-table-item"},hH={class:"fct-btn-group sm justify-end"},_H=["aria-label"],vH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},gH={colspan:"6"},zu=30,yH=30,bH={__name:"AdvancedVariationGroupedTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},groupedVariants:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},groupById:{type:Number,default:null},expandedGroups:{type:Set,default:()=>new Set}},emits:["update:selectedVariants","update:isAllSelected","update:expandedGroups","editVariant","editGroup","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded","groupPriceApply","groupMediaUploaded"],setup(e,{emit:t}){const a=e,l=K(()=>{var fe,he,le;const j=a.groupById?parseInt(a.groupById):null,q=(((le=(he=(fe=a.product)==null?void 0:fe.detail)==null?void 0:he.other_info)==null?void 0:le.attribute_config)||[]).map(me=>parseInt(me.group_id)).filter(Boolean),X=me=>{const Ue=q.indexOf(me);return Ue===-1?Number.MAX_SAFE_INTEGER:Ue},ie={};(a.attributeGroups||[]).forEach(me=>{const Ue={};(me.terms||[]).forEach(et=>{Ue[parseInt(et.id)]=et.title}),ie[parseInt(me.id)]=Ue});const ge={};return(a.groupedVariants||[]).forEach(me=>{(me.variants||[]).forEach(Ue=>{const et=Ue.attr_map||[];if(!et.length){ge[Ue.id]="";return}const be=[...et].sort((qe,gt)=>X(parseInt(qe.group_id))-X(parseInt(gt.group_id))).map(qe=>{const gt=parseInt(qe.group_id);if(j&>===j)return null;const Ze=ie[gt];return Ze&&Ze[parseInt(qe.term_id)]||null}).filter(Boolean);ge[Ue.id]=be.join(" / ")})}),ge}),s=V(new Set),i=j=>{s.value.has(j)||(s.value=new Set(s.value).add(j))},c=V({}),p=j=>c.value[j]||zu,m=j=>{const q=j.variants||[],X=p(j.termId);return X>=q.length?q:q.slice(0,X)},_=j=>(j.variants||[]).length>p(j.termId),g=(j,q)=>{const X=c.value[j]||zu;X>=q||(c.value={...c.value,[j]:Math.min(X+yH,q)})};Ce(()=>a.expandedGroups,j=>{const q=Object.keys(c.value);if(!q.length)return;const X={};q.forEach(ie=>{j&&(j.has(ie)||j.has(Number(ie)))&&(X[ie]=c.value[ie])}),Object.keys(X).length!==q.length&&(c.value=X)});let y=null;const v={},C=j=>{let q=j&&j.parentElement;for(;q;){const X=getComputedStyle(q).overflowY;if(X==="auto"||X==="scroll"||X==="overlay")return q;q=q.parentElement}return null},b=j=>{y||(y=new IntersectionObserver(q=>{q.forEach(X=>{X.isIntersecting&&g(X.target.dataset.termId,parseInt(X.target.dataset.total,10)||0)})},{root:C(j),rootMargin:"300px 0px"}))},w=(j,q)=>X=>{X?(X.dataset.termId=j,X.dataset.total=q,b(X),v[j]=X,y.observe(X)):v[j]&&(y&&y.unobserve(v[j]),delete v[j])};Ct(()=>{y&&(y.disconnect(),y=null)});const x=j=>{if(!a.productEditModel)return!1;const q=a.product.variants.findIndex(X=>X.id===j.id);return q===-1?!1:a.productEditModel.hasValidationError(`variants.${q}.compare_price`)},F=t,L=V({});Ce(()=>{var j,q;return(q=(j=a.productEditModel)==null?void 0:j.data)==null?void 0:q.discardKey},()=>{L.value={}});const U=K(()=>a.groupedVariants.every(j=>a.expandedGroups.has(j.termId))),S=()=>{const j=U.value?new Set:new Set(a.groupedVariants.map(q=>q.termId));F("update:expandedGroups",j)},M=j=>{const q=new Set(a.expandedGroups);q.has(j)?q.delete(j):q.add(j),F("update:expandedGroups",q)},I=j=>a.expandedGroups.has(j),T=j=>j.variants.length>0&&j.variants.every(q=>a.selectedVariants.includes(q.id)),Q=j=>{if(j.variants.length===0)return!1;const q=j.variants.filter(X=>a.selectedVariants.includes(X.id)).length;return q>0&&q<j.variants.length},E=(j,q)=>{let X;if(q){const ie=new Set(a.selectedVariants);j.variants.forEach(ge=>ie.add(ge.id)),X=Array.from(ie)}else{const ie=new Set(j.variants.map(ge=>ge.id));X=a.selectedVariants.filter(ge=>!ie.has(ge))}F("update:selectedVariants",X)},D=(j,q)=>{let X;q?X=[...a.selectedVariants,j]:X=a.selectedVariants.filter(ie=>ie!==j),F("update:selectedVariants",X)},H=(j,q)=>{F("groupPriceApply",j,q)},P=j=>{const q=j.variants.map(ge=>parseFloat(ge.item_price)).filter(ge=>!isNaN(ge));if(!q.length)return"";const X=Math.min(...q),ie=Math.max(...q);return X===ie?String(X):`${X} – ${ie}`},G=V(null),J=j=>G.value===j.termId?"":P(j)||"",oe=j=>{G.value=j.termId},Z=()=>{G.value=null},W=j=>{const q=new Set,X=[];return(j.variants||[]).forEach(ie=>{Array.isArray(ie==null?void 0:ie.media)&&ie.media.forEach(ge=>{const fe=(ge==null?void 0:ge.id)||(ge==null?void 0:ge.url);fe&&!q.has(fe)&&(q.add(fe),X.push(ge))})}),X},pe=(j,q,X)=>{!X||!X.applyToAll||F("groupMediaUploaded",j,q)},N=(j,q,X,ie)=>{ie&&ie.applyToAll?F("groupMediaUploaded",j,X):F("mediaUploaded",q,X)};return(j,q)=>{const X=B("el-checkbox"),ie=B("el-input"),ge=B("el-dropdown-item"),fe=B("el-dropdown-menu"),he=B("el-dropdown");return r(),h(O,null,[o("div",gO,[o("table",null,[q[11]||(q[11]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(X,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":j.$t("Select all variants"),"onUpdate:modelValue":q[0]||(q[0]=le=>j.$emit("update:isAllSelected",le))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(j.$t("Image")),1),o("th",null,f(j.$t("Variant")),1),o("th",null,f(j.$t("Price")),1),o("th",null,f(j.$t("Compare at price")),1),o("th",yO,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":U.value,"aria-label":U.value?j.$t("Collapse all groups"):j.$t("Expand all groups"),onClick:S},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":U.value}])},[n(ee,{name:"ChevronDown"})],2)],8,bO)])])]),o("tbody",null,[(r(!0),h(O,null,ae(e.groupedVariants,le=>(r(),h(O,{key:le.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":I(le.termId)}]),onClick:me=>M(le.termId)},[o("td",null,[n(X,{onClick:q[1]||(q[1]=Ne(()=>{},["stop"])),"model-value":T(le),indeterminate:Q(le),"aria-label":A(u)("Select all variants in %1$s",le.title),onChange:me=>E(le,me)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:q[2]||(q[2]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":W(le),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(me,Ue)=>pe(le,me,Ue)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",CO,[o("strong",null,f(le.title),1),o("span",BO,f(le.variants.length)+" "+f(le.variants.length===1?j.$t("variant"):j.$t("variants")),1)])]),o("td",null,[o("div",kO,[n(ie,{onClick:q[3]||(q[3]=Ne(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:J(le),type:"number",min:0,size:"small",modelValue:L.value[le.termId],"onUpdate:modelValue":me=>L.value[le.termId]=me,onFocus:me=>oe(le),onBlur:Z,onKeyup:$a(me=>H(le.termId,L.value[le.termId]),["enter"]),onChange:me=>H(le.termId,me)},{prefix:d(()=>[o("span",{textContent:f(j.appVars.shop.currency_sign)},null,8,xO)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","onFocus","onKeyup","onChange"])])]),q[9]||(q[9]=o("td",null,null,-1)),o("td",SO,[o("div",FO,[I(le.termId)?(r(),$(Xe,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":j.$t("Edit group %1$s",le.title),onClick:Ne(me=>j.$emit("editGroup",le),["stop"])},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):k("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":I(le.termId),"aria-label":j.$t("Toggle %1$s variants",le.title),onClick:Ne(me=>M(le.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":I(le.termId)}])},[n(ee,{name:"ChevronDown"})],2)],8,$O)])])],10,wO),o("tr",EO,[o("td",UO,[n(Ud,{visible:I(le.termId),duration:220},{default:d(()=>[o("table",null,[q[10]||(q[10]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("tbody",null,[(r(!0),h(O,null,ae(m(le),me=>{var Ue,et;return r(),h("tr",{key:me.id,class:"fct-adv-group-child-row"},[o("td",{onClick:q[4]||(q[4]=Ne(()=>{},["stop"]))},[n(X,{"model-value":e.selectedVariants.includes(me.id),"aria-label":A(u)("Select variant %1$s",me.variation_title),onChange:be=>D(me.id,be)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",IO,[n(hl,{modelValue:me.media,"onUpdate:modelValue":be=>me.media=be,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(be,qe)=>N(le,me,be,qe)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",QO,[o("div",DO,[o("div",VO,[o("span",TO,f(l.value[me.id]||me.variation_title),1),me.item_status==="inactive"?(r(),h("span",MO,f(A(u)("Inactive")),1)):k("",!0)])])])]),o("td",null,[o("div",LO,[n(ie,{placeholder:j.$t("Price"),type:"number",min:0,"model-value":me.item_price,onInput:be=>j.$emit("inlinePriceChange",me,"item_price",be),onChange:be=>j.$emit("inlinePriceCommit",me)},{prefix:d(()=>[o("span",{textContent:f(j.appVars.shop.currency_sign)},null,8,RO)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),((Ue=me.other_info)==null?void 0:Ue.payment_type)==="subscription"&&((et=me.other_info)!=null&&et.repeat_interval)?(r(),h("span",OO,f(me.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",HO,[n(ie,{placeholder:j.$t("Compare price"),type:"number",min:0,class:de({"is-error":x(me)}),title:x(me)?j.$t("Compare price must be greater than or equal to item price."):null,"model-value":me.compare_price,onInput:be=>j.$emit("inlinePriceChange",me,"compare_price",be),onChange:be=>j.$emit("inlinePriceCommit",me)},{prefix:d(()=>[o("span",{textContent:f(j.appVars.shop.currency_sign)},null,8,PO)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",NO,[o("div",KO,[o("div",GO,[n(Xe,{class:"hide-on-mobile",size:"small",tag:"button",onClick:be=>j.$emit("editVariant",me)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(he,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:be=>be&&i(me.id),onCommand:be=>{be==="toggle_status"&&j.$emit("toggleStatus",me)}},{dropdown:d(()=>[n(fe,null,{default:d(()=>[s.value.has(me.id)?(r(),h(O,{key:0},[n(ge,{class:"show-on-mobile",onClick:be=>j.$emit("editVariant",me)},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(j.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ge,null,{default:d(()=>[me.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:String(me.id),showMode:"icon_with_text",buttonText:j.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(ge,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!me.id},{default:d(()=>{var be;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&me.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:((be=j.appVars)==null?void 0:be.frontend_url)+"=instant_checkout&item_id="+me.id+"&quantity=1",showMode:"icon_with_text",buttonText:j.$t("Direct Checkout"),tooltipContent:j.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(O,{key:1},[n(ee,{name:"Copy"}),R(" "+f(j.$t("Direct Checkout"))+" ",1),n(ca,{content:j.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),me.id?(r(),$(ge,{key:0,command:"toggle_status",class:de({"item-destructive":me.item_status!=="inactive"})},{default:d(()=>[n(ee,{name:me.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(me.item_status==="inactive"?j.$t("Set Active"):j.$t("Set Inactive")),1)]),_:2},1032,["class"])):k("",!0)],64)):k("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(ee,{name:"More"})],8,jO)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(le)?(r(),h("tr",zO,[o("td",qO,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(le.termId,le.variants.length)},null,512)])])):k("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",YO,[o("table",null,[q[13]||(q[13]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(X,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":j.$t("Select all variants"),"onUpdate:modelValue":q[5]||(q[5]=le=>j.$emit("update:isAllSelected",le))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(j.$t("Image")),1),o("th",null,f(j.$t("Variant")),1),o("th",WO,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":U.value,"aria-label":U.value?j.$t("Collapse all groups"):j.$t("Expand all groups"),onClick:S},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":U.value}])},[n(ee,{name:"ChevronDown"})],2)],8,XO)])])]),o("tbody",null,[(r(!0),h(O,null,ae(e.groupedVariants,le=>(r(),h(O,{key:le.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":I(le.termId)}]),onClick:me=>M(le.termId)},[o("td",null,[n(X,{onClick:q[6]||(q[6]=Ne(()=>{},["stop"])),"model-value":T(le),indeterminate:Q(le),"aria-label":A(u)("Select all variants in %1$s",le.title),onChange:me=>E(le,me)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:q[7]||(q[7]=Ne(()=>{},["stop"]))},[n(hl,{"model-value":W(le),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(me,Ue)=>pe(le,me,Ue)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",ZO,[o("strong",null,f(le.title),1),o("span",eH,f(le.variants.length)+" "+f(le.variants.length===1?j.$t("variant"):j.$t("variants")),1)])]),o("td",tH,[o("div",aH,[I(le.termId)?(r(),$(Xe,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":j.$t("Edit group %1$s",le.title),onClick:Ne(me=>j.$emit("editGroup",le),["stop"])},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):k("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":I(le.termId),"aria-label":j.$t("Toggle %1$s variants",le.title),onClick:Ne(me=>M(le.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":I(le.termId)}])},[n(ee,{name:"ChevronDown"})],2)],8,lH)])])],10,JO),o("tr",sH,[o("td",nH,[n(Ud,{visible:I(le.termId),duration:220},{default:d(()=>[o("table",null,[q[12]||(q[12]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("tbody",null,[(r(!0),h(O,null,ae(m(le),me=>(r(),h("tr",{key:me.id,class:"fct-adv-group-child-row"},[o("td",{onClick:q[8]||(q[8]=Ne(()=>{},["stop"]))},[n(X,{"model-value":e.selectedVariants.includes(me.id),"aria-label":A(u)("Select variant %1$s",me.variation_title),onChange:Ue=>D(me.id,Ue)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",oH,[n(hl,{modelValue:me.media,"onUpdate:modelValue":Ue=>me.media=Ue,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Ue,et)=>N(le,me,Ue,et)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",iH,[o("div",rH,[o("div",dH,[o("span",uH,f(l.value[me.id]||me.variation_title),1),me.item_status==="inactive"?(r(),h("span",cH,f(A(u)("Inactive")),1)):k("",!0)]),o("span",AH,[me.compare_price?(r(),h("span",pH,f(j.appVars.shop.currency_sign)+f(me.compare_price),1)):k("",!0),o("span",null,f(j.appVars.shop.currency_sign)+f(me.item_price||"0"),1)])])])]),o("td",fH,[o("div",mH,[o("div",hH,[n(he,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:Ue=>Ue&&i(me.id),onCommand:Ue=>{Ue==="toggle_status"&&j.$emit("toggleStatus",me)}},{dropdown:d(()=>[n(fe,null,{default:d(()=>[s.value.has(me.id)?(r(),h(O,{key:0},[n(ge,{onClick:Ue=>j.$emit("editVariant",me)},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(j.$t("Edit")),1)]),_:2},1032,["onClick"]),n(ge,null,{default:d(()=>[me.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:String(me.id),showMode:"icon_with_text",buttonText:j.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(ge,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!me.id},{default:d(()=>{var Ue;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&me.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:((Ue=j.appVars)==null?void 0:Ue.frontend_url)+"=instant_checkout&item_id="+me.id+"&quantity=1",showMode:"icon_with_text",buttonText:j.$t("Direct Checkout"),tooltipContent:j.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(O,{key:1},[n(ee,{name:"Copy"}),R(" "+f(j.$t("Direct Checkout"))+" ",1),n(ca,{content:j.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),me.id?(r(),$(ge,{key:0,command:"toggle_status",class:de({"item-destructive":me.item_status!=="inactive"})},{default:d(()=>[n(ee,{name:me.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(me.item_status==="inactive"?j.$t("Set Active"):j.$t("Set Inactive")),1)]),_:2},1032,["class"])):k("",!0)],64)):k("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(ee,{name:"More"})],8,_H)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(le)?(r(),h("tr",vH,[o("td",gH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:w(le.termId,le.variants.length)},null,512)])])):k("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},wH={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},CH={class:"is-right"},BH={class:"fct-product-pricing-table-item"},kH={class:"fct-product-pricing-table-item"},xH={class:"fct-adv-title-cell"},SH={class:"fct-adv-title-main"},FH={class:"fct-adv-variant-title"},$H={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},EH={key:0,class:"fct-adv-attr-breadcrumb"},UH={class:"fct-product-pricing-table-item"},IH=["textContent"],QH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},DH={class:"fct-product-pricing-table-item"},VH=["textContent"],TH={class:"is-right"},MH={class:"fct-product-pricing-table-item"},LH={class:"fct-btn-group sm"},RH=["aria-label"],OH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},qu=30,HH=30,PH={__name:"AdvancedVariationFlatTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},variants:{type:Array,default:null}},emits:["update:selectedVariants","update:isAllSelected","editVariant","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded"],setup(e,{emit:t}){const a=e,l=K(()=>a.variants??a.product.variants),s=V(qu),i=K(()=>{const w=l.value;return w.length<=s.value?w:w.slice(0,s.value)}),c=K(()=>l.value.length>s.value);Ce(l,()=>{s.value=qu});let p=null,m=null;const _=w=>{let x=w&&w.parentElement;for(;x;){const F=getComputedStyle(x).overflowY;if(F==="auto"||F==="scroll"||F==="overlay")return x;x=x.parentElement}return null},g=w=>{w?(p||(p=new IntersectionObserver(x=>{x.some(F=>F.isIntersecting)&&(s.value=Math.min(s.value+HH,l.value.length))},{root:_(w),rootMargin:"300px 0px"})),m=w,p.observe(w)):m&&(p&&p.unobserve(m),m=null)};Ct(()=>{p&&(p.disconnect(),p=null)});const y=w=>{if(!a.productEditModel)return!1;const x=a.product.variants.findIndex(F=>F.id===w.id);return x===-1?!1:a.productEditModel.hasValidationError(`variants.${x}.compare_price`)},v=w=>{var S,M,I;const x=w.attr_map||[];if(!x.length)return"";const F=(((I=(M=(S=a.product)==null?void 0:S.detail)==null?void 0:M.other_info)==null?void 0:I.attribute_config)||[]).map(T=>parseInt(T.group_id)).filter(Boolean),L=T=>{const Q=F.indexOf(T);return Q===-1?Number.MAX_SAFE_INTEGER:Q};return[...x].sort((T,Q)=>L(parseInt(T.group_id))-L(parseInt(Q.group_id))).map(T=>{const Q=a.attributeGroups.find(D=>D.id===parseInt(T.group_id));if(!Q)return null;const E=(Q.terms||[]).find(D=>D.id===parseInt(T.term_id));return E?E.title:null}).filter(Boolean).join(" / ")},C=t,b=(w,x)=>{let F;x?F=[...a.selectedVariants,w]:F=a.selectedVariants.filter(L=>L!==w),C("update:selectedVariants",F)};return(w,x)=>{const F=B("el-checkbox"),L=B("el-input"),U=B("el-dropdown-item"),S=B("el-dropdown-menu"),M=B("el-dropdown");return r(),h("div",wH,[o("table",null,[x[1]||(x[1]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(F,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":w.$t("Select all variants"),"onUpdate:modelValue":x[0]||(x[0]=I=>w.$emit("update:isAllSelected",I))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,f(w.$t("Image")),1),o("th",null,f(w.$t("Title")),1),o("th",null,f(w.$t("Price")),1),o("th",null,f(w.$t("Compare at price")),1),o("th",CH,f(w.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(O,null,ae(i.value,I=>{var T,Q;return r(),h("tr",{key:I.id},[o("td",null,[n(F,{"model-value":e.selectedVariants.includes(I.id),"aria-label":A(u)("Select variant %1$s",I.variation_title),onChange:E=>b(I.id,E)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",BH,[n(hl,{modelValue:I.media,"onUpdate:modelValue":E=>I.media=E,compact:!0,"max-thumbs":1,square:!0,onChange:E=>w.$emit("mediaUploaded",I,E)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",kH,[o("div",xH,[o("div",SH,[o("span",FH,f(I.variation_title),1),I.item_status==="inactive"?(r(),h("span",$H,f(A(u)("Inactive")),1)):k("",!0)]),v(I)&&v(I)!==I.variation_title?(r(),h("span",EH,f(v(I)),1)):k("",!0)])])]),o("td",null,[o("div",UH,[n(L,{placeholder:w.$t("Price"),type:"number",min:0,"model-value":I.item_price,onInput:E=>w.$emit("inlinePriceChange",I,"item_price",E),onChange:E=>w.$emit("inlinePriceCommit",I)},{prefix:d(()=>[o("span",{textContent:f(w.appVars.shop.currency_sign)},null,8,IH)]),_:2},1032,["placeholder","model-value","onInput","onChange"]),((T=I.other_info)==null?void 0:T.payment_type)==="subscription"&&((Q=I.other_info)!=null&&Q.repeat_interval)?(r(),h("span",QH,f(I.other_info.repeat_interval),1)):k("",!0)])]),o("td",null,[o("div",DH,[n(L,{placeholder:w.$t("Compare price"),type:"number",min:0,class:de({"is-error":y(I)}),title:y(I)?w.$t("Compare price must be greater than or equal to item price."):null,"model-value":I.compare_price,onInput:E=>w.$emit("inlinePriceChange",I,"compare_price",E),onChange:E=>w.$emit("inlinePriceCommit",I)},{prefix:d(()=>[o("span",{textContent:f(w.appVars.shop.currency_sign)},null,8,VH)]),_:2},1032,["placeholder","class","title","model-value","onInput","onChange"])])]),o("td",TH,[o("div",MH,[o("div",LH,[n(Xe,{class:"hide-on-mobile",size:"small",tag:"button",onClick:E=>w.$emit("editVariant",I)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(M,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:E=>{E==="toggle_status"&&w.$emit("toggleStatus",I)}},{dropdown:d(()=>[n(S,null,{default:d(()=>[n(U,{class:"show-on-mobile",onClick:E=>w.$emit("editVariant",I)},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(w.$t("Edit")),1)]),_:2},1032,["onClick"]),n(U,null,{default:d(()=>[I.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:String(I.id),showMode:"icon_with_text",buttonText:w.$t("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),n(U,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!I.id},{default:d(()=>{var E;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&I.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:((E=w.appVars)==null?void 0:E.frontend_url)+"=instant_checkout&item_id="+I.id+"&quantity=1",showMode:"icon_with_text",buttonText:w.$t("Direct Checkout"),tooltipContent:w.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(O,{key:1},[n(ee,{name:"Copy"}),R(" "+f(w.$t("Direct Checkout"))+" ",1),n(ca,{content:w.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),I.id?(r(),$(U,{key:0,command:"toggle_status",class:de({"item-destructive":I.item_status!=="inactive"})},{default:d(()=>[n(ee,{name:I.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(I.item_status==="inactive"?w.$t("Set Active"):w.$t("Set Inactive")),1)]),_:2},1032,["class"])):k("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(ee,{name:"More"})],8,RH)]),_:2},1032,["onCommand"])])])])])}),128)),c.value?(r(),h("tr",OH,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):k("",!0)])])])}}},NH={class:"fct-product-pricing-form-wrap"},KH={class:"fct-product-pricing-form-inner"},GH={class:"dialog-footer"},jH={class:"fct-btn-group sm"},zH={__name:"GroupBulkEditForm",props:{groupVariantIds:{type:Array,required:!0},product:Object,productEditModel:Object,fieldKey:String},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=()=>({item_price:null,compare_price:null,item_cost:null,manage_cost:"__unchanged__",sku:null,manage_stock:"__unchanged__",total_stock:null,fulfillment_type:"__unchanged__",available:null,on_hold:null,committed:null,other_info:{payment_type:"__unchanged__",description:null,tax_class:null,tax_exempt:"__unchanged__",tax_inclusion:"__unchanged__",package_slug:null,weight:null,weight_unit:null,length:null,width:null,height:null,interval:null,interval_count:null,billing_summary:null,manage_setup_fee:"__unchanged__",signup_fee:null,signup_fee_name:null,times:null,trial_days:null}}),c=V(i()),p=V(0),m=V(!1),_=V(!1);Qe(async()=>{await Se(),_.value=!0});const g=()=>{const v=c.value||{},C={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(L=>{const U=v[L];U!=null&&U!==""&&U!=="__unchanged__"&&(C[L]=U)});const w=v.other_info||{},x={};Object.keys(w).forEach(L=>{const U=w[L];U!=null&&U!==""&&U!=="__unchanged__"&&(x[L]=U)});const F={...C};return Object.keys(x).length>0&&(F.other_info=x),F},y=async()=>{const v=g();if(!Object.keys(v).length)return z.error(u("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const C=await ce.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return z.success(C.message||u("Variants updated successfully")),p.value=0,s("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),C}catch(C){return C&&(C.status_code===422||C.status===422)?z.validationErrors(C):z.error(C&&C.data&&C.data.message||u("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return Ce(c,()=>{m.value||!_.value||p.value++},{deep:!0}),Ce(()=>p.value,v=>{s("dirtyStateChange",v>0)},{immediate:!0}),t({hasDirtyDrafts:()=>p.value>0,getDirtyDraftCount:()=>p.value>0?1:0,discardDrafts:async()=>{m.value=!0,c.value=i(),await Se(),p.value=0,m.value=!1},saveCurrentDraft:y}),(v,C)=>{const b=B("el-form"),w=B("el-button");return r(),h("div",NH,[o("div",KH,[n(b,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(Sp,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),n(Fp,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),n($p,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update","product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),$(Ep,{key:0,variant:c.value,"product-edit-model":e.productEditModel,"field-key":e.fieldKey,"mode-type":"update","is-group-mode":!0},null,8,["variant","product-edit-model","field-key"])):k("",!0)]),_:1})]),o("div",GH,[o("div",jH,[n(w,{onClick:C[0]||(C[0]=x=>s("closeModal"))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(w,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:d(()=>[R(f(A(u)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},qH={class:"fct-adv-variant-table-wrap"},YH={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},WH={class:"flex items-center flex-wrap gap-2 ml-auto"},XH=["aria-label"],JH={key:0,class:"fct-adv-filters-panel-wrap"},ZH={class:"fct-adv-variant-search-row"},eP={key:0,class:"fct-adv-variant-filters"},tP=["aria-pressed"],aP={key:0,class:"fct-adv-filter-chip__count"},lP={class:"fct-adv-filter-options"},sP={class:"fct-adv-filter-options__header"},nP=["onClick"],oP={class:"fct-adv-filter-options__list"},iP={key:0,class:"fct-adv-filter-count"},rP={key:0,class:"fct-adv-variant-empty"},dP={class:"fct-adv-variant-empty__title"},uP={class:"fct-adv-variant-empty__hint"},cP=["aria-label"],AP={class:"fct-grouped-variant-skeleton"},pP={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},fP={class:"fct-product-pricing-table-mobile-item-inner"},mP={class:"fct-product-pricing-table-item"},hP={class:"media relative"},_P={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},vP={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},gP=["src","alt"],yP=["src"],bP={class:"fct-product-pricing-table-item-content"},wP={class:"title"},CP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},BP={class:"fct-adv-attr-breadcrumb"},kP={key:0,class:"compare-price"},xP=["textContent"],SP={class:"price"},FP=["textContent"],$P={class:"fct-product-pricing-table-item-action"},EP={class:"fct-btn-group sm"},UP=["aria-label"],IP={class:"fct-shared-variant-drawer__layout"},QP={key:0,class:"fct-shared-variant-nav"},DP={class:"fct-group-edit-aside"},VP={class:"fct-group-edit-aside__label"},TP={class:"fct-group-edit-aside__title"},MP={class:"fct-group-edit-aside__hint"},LP={class:"fct-group-edit-aside__list"},RP={key:1,class:"fct-shared-variant-nav"},OP={class:"fct-shared-variant-nav__filters"},HP={key:0,class:"fct-shared-variant-nav__chips"},PP=["aria-pressed"],NP={key:0,class:"fct-adv-filter-chip__count"},KP={class:"fct-adv-filter-options"},GP={class:"fct-adv-filter-options__header"},jP=["onClick"],zP={class:"fct-adv-filter-options__list"},qP={class:"fct-shared-variant-drawer__content"},YP={key:0,class:"fct-compact-group-edit-summary"},WP={class:"fct-compact-group-edit-summary__title"},XP={class:"fct-compact-group-edit-summary__count"},JP={key:0,class:"fct-compact-group-edit-bar"},ZP=["disabled","aria-label","onClick"],eN={class:"fct-shared-variant-drawer__form"},tN={class:"fct-variant-dirty-dialog__header"},aN=["id"],lN={class:"dialog-footer"},sN={class:"fct-btn-group sm"},Yu=200,nN={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var se,ye,Re,tt,dt,je;const t=e,a=V([]),l=V(!1),s=V(!1),i=V(null),c=V(!1),p=V(new Set),m=V(0),_=()=>{m.value++},g=()=>{m.value=Math.max(0,m.value-1)},y=K(()=>m.value>0||l.value||t.externalBusy),v=V(((je=(dt=(tt=(Re=(ye=(se=t.product)==null?void 0:se.detail)==null?void 0:ye.other_info)==null?void 0:Re.attribute_config)==null?void 0:tt[0])==null?void 0:dt.variants)==null?void 0:je.length)||6),C=V(!1),b=V(null),w=V(null),x=V(!1),F=V(!1),L=V(!1),U=V(null),S=V(""),M=V(""),I=V(null),T=V(""),Q=V(!1),E=V({}),D=()=>{Q.value=!Q.value},H=()=>{E.value={},T.value="",Q.value=!1},P=ne=>{ne.style.opacity="0",ne.style.overflow="hidden"},G=ne=>{const Ae=ne.scrollHeight+"px";ne.style.height="0",ne.offsetHeight,ne.style.transition="height 0.25s ease, opacity 0.2s ease",ne.style.height=Ae,ne.style.opacity="1"},J=ne=>{ne.style.height="",ne.style.overflow="",ne.style.transition="",ne.style.opacity=""},oe=ne=>{ne.style.height=ne.scrollHeight+"px",ne.style.overflow="hidden",ne.offsetHeight,ne.style.transition="height 0.25s ease, opacity 0.2s ease",ne.style.height="0",ne.style.opacity="0"},Z=ne=>{ne.style.height="",ne.style.overflow="",ne.style.transition="",ne.style.opacity=""},W=K(()=>{var Ae,we,Be;const ne=(Be=(we=(Ae=t.product)==null?void 0:Ae.detail)==null?void 0:we.other_info)==null?void 0:Be.attribute_config;return!ne||!Array.isArray(ne)?[]:ne.map(Ye=>{const bt=parseInt(Ye.group_id,10),wt=t.attributeGroups.find(te=>parseInt(te.id,10)===bt);return wt?{id:parseInt(wt.id,10),title:wt.title}:null}).filter(Boolean)}),pe=K(()=>W.value.map(ne=>{const Ae=t.attributeGroups.find(we=>we.id===ne.id);return Ae?{id:Ae.id,title:Ae.title,terms:Ae.terms||[]}:null}).filter(Boolean)),N=(ne,Ae)=>{const we=E.value[ne];return we?we.has(Ae):!1},j=(ne,Ae)=>{const we={...E.value},Be=we[ne]?new Set(we[ne]):new Set;Be.has(Ae)?Be.delete(Ae):Be.add(Ae),Be.size===0?delete we[ne]:we[ne]=Be,E.value=we},q=ne=>{var Ae;return((Ae=E.value[ne])==null?void 0:Ae.size)||0},X=ne=>{if(!E.value[ne])return;const Ae={...E.value};delete Ae[ne],E.value=Ae},ie=()=>{E.value={},T.value=""},ge=K(()=>Object.keys(E.value).length>0||T.value.trim()!==""),fe=K(()=>ge.value&&t.product.variants.length>0&&he.value.length===0),he=K(()=>{let ne=t.product.variants;const Ae=Object.keys(E.value);Ae.length>0&&(ne=ne.filter(Be=>Ae.every(Ye=>{const bt=E.value[Ye];if(!bt||bt.size===0)return!0;const wt=(Be.attr_map||[]).find(te=>parseInt(te.group_id)===parseInt(Ye));return wt&&bt.has(parseInt(wt.term_id))})));const we=T.value.trim().toLowerCase();return we&&(ne=ne.filter(Be=>(Be.variation_title||"").toLowerCase().includes(we)?!0:(Be.attr_map||[]).map(wt=>{const te=t.attributeGroups.find(Rt=>Rt.id===parseInt(wt.group_id));if(!te)return"";const st=(te.terms||[]).find(Rt=>Rt.id===parseInt(wt.term_id));return st?st.title.toLowerCase():""}).join(" ").includes(we))),ne}),le=K(()=>{if(!I.value)return null;const ne=parseInt(I.value,10),Ae=t.attributeGroups.find(Ye=>parseInt(Ye.id,10)===ne);if(!Ae)return null;const we=[],Be={};for(const Ye of he.value){const bt=(Ye.attr_map||[]).find(te=>parseInt(te.group_id,10)===ne);if(!bt)continue;const wt=parseInt(bt.term_id,10);if(!Be[wt]){const te=(Ae.terms||[]).find(st=>parseInt(st.id,10)===wt);Be[wt]={termId:wt,title:te?te.title:"Unknown",variants:[]},we.push(Be[wt])}Be[wt].variants.push(Ye)}return we}),me=K(()=>!!I.value&&le.value&&le.value.length>0);Ce(le,ne=>{Array.isArray(ne)&&ne.length>0&&(v.value=ne.length)},{immediate:!0});const Ue=ne=>t.productEditModel.validateComparePrice(ne),et=(ne,Ae)=>{const we=le.value?le.value.find(wt=>wt.termId===ne):null;if(!we||Ae===""||Ae===null||Ae===void 0)return;const Be=parseFloat(Ae);if(isNaN(Be)||Be<0){z.error(u("Please enter a valid price."));return}const Ye=we.variants.filter(wt=>a.value.includes(wt.id));(Ye.length?Ye:we.variants).forEach(wt=>{const te=t.product.variants.findIndex(st=>st.id===wt.id);te!==-1&&(t.productEditModel.onChangePricing("item_price",te,Be),Ue(te))})},be=ne=>{const Ae=t.product.variants.findIndex(Be=>Be.id===ne.id);if(Ae===-1)return;Ue(Ae)||z.error(u("Compare price must be greater than or equal to item price."))};Ce(()=>t.product.variants,ne=>{Array.isArray(ne)&&(ne.forEach(Ae=>{const we=Ae.media?Ae.media.meta_value||Ae.media:[];Ae.media=Array.isArray(we)?we:[]}),c.value&&(c.value=!1,Ut()))},{immediate:!0,deep:!1});const qe=[];Qe(async()=>{await Se(),document.querySelectorAll(".fct-adv-variant-table-wrap .el-input__wrapper input[type='number']").forEach(Ae=>{const we=Be=>{document.activeElement===Ae&&Be.preventDefault()};Ae.addEventListener("wheel",we),qe.push({input:Ae,handler:we})})}),Ct(()=>{qe.forEach(({input:ne,handler:Ae})=>{ne.removeEventListener("wheel",Ae)}),qe.length=0}),Ce(()=>{var ne;return(ne=W.value[0])==null?void 0:ne.id},ne=>{if(W.value.length<2||!ne){I.value=null;return}I.value=parseInt(ne,10)},{immediate:!0}),Ce(()=>W.value.length,ne=>{ne<2&&(I.value=null)}),Ce([I,W],([ne,Ae])=>{var Ye;if(!Array.isArray(Ae)||Ae.length<2)return;const we=(Ye=Ae[0])==null?void 0:Ye.id;if(!we)return;const Be=Ae.map(bt=>parseInt(bt.id,10));(ne==null||!Be.includes(parseInt(ne,10)))&&(I.value=parseInt(we,10))},{deep:!0});const gt=(ne,Ae,we)=>{const Be=parseFloat(we)||0,Ye=t.product.variants.findIndex(bt=>bt.id===ne.id);Ye!==-1&&t.productEditModel.onChangePricing(Ae,Ye,Be)},Ze=(ne,Ae)=>{const we=ne.media;ne.media=Ae,_(),ce.post(`products/variants/${ne.id}/setMedia`,{media:Ae}).then(Be=>{z.success(Be.message||u("Thumbnail set successfully"))}).catch(Be=>{var Ye;ne.media=we,z.error(((Ye=Be==null?void 0:Be.data)==null?void 0:Ye.message)||(Be==null?void 0:Be.message)||u("Failed to save thumbnail"))}).finally(g)},Fe=async(ne,Ae)=>{const we=ne.variants.filter(te=>a.value.includes(te.id)),Be=we.length?we:ne.variants;Be.forEach(te=>{te.media=Ae});const Ye=Be.map(te=>te.id),bt=5;let wt=0;_();try{for(let te=0;te<Ye.length;te+=bt){const st=await Promise.allSettled(Ye.slice(te,te+bt).map(Rt=>ce.post(`products/variants/${Rt}/setMedia`,{media:Ae})));wt+=st.filter(Rt=>Rt.status==="rejected").length}}finally{g()}wt===0?z.success(u("Thumbnail applied to %1$s variants",Be.length)):z.error(u("Failed to apply thumbnail to %1$s variants",wt))},Ee=K({get(){const ne=he.value.map(Ae=>Ae.id);return ne.length===0?!1:ne.every(Ae=>a.value.includes(Ae))},set(ne){const Ae=he.value.map(we=>we.id);if(ne){const we=new Set([...a.value,...Ae]);a.value=Array.from(we)}else{const we=new Set(Ae);a.value=a.value.filter(Be=>!we.has(Be))}}}),Pe=K(()=>{const ne=he.value.map(we=>we.id);if(ne.length===0)return!1;const Ae=ne.filter(we=>a.value.includes(we)).length;return Ae>0&&Ae<ne.length}),Me=()=>{if(l.value||!S.value||a.value.length===0)return;if(S.value==="delete"){Fn.confirmDeleteWithInput("delete",u("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{ht()}).catch(()=>{});return}const ne=S.value==="set_price";let Ae=null;if(ne&&(Ae=parseFloat(M.value),M.value===""||isNaN(Ae)||Ae<0)){z.error(u("Please enter a valid price."));return}if(ne&&a.value.slice(0,Yu).map(Ye=>t.product.variants.find(bt=>bt.id===Ye)).filter(Ye=>{if(!Ye)return!1;const bt=parseFloat(Ye.compare_price);return!isNaN(bt)&&bt>0&&bt<Ae}).length){z.error(u("Compare price must be greater than or equal to item price."));return}const we=a.value.slice(0,Yu).map(Be=>{const Ye={id:Be};return S.value==="set_price"?Ye.item_price=Ae:S.value==="set_status_active"?Ye.item_status="active":S.value==="set_status_inactive"&&(Ye.item_status="inactive"),Ye});l.value=!0,t.productEditModel.bulkUpdateVariants(we).then(Be=>{z.success((Be==null?void 0:Be.message)||u("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],S.value="",M.value=""}).catch(Be=>{var Ye;z.error(((Ye=Be==null?void 0:Be.data)==null?void 0:Ye.message)||u("Bulk action failed"))}).finally(()=>{l.value=!1})},ht=async()=>{const ne=[...a.value],Ae=5;_();try{for(let we=0;we<ne.length;we+=Ae)await Promise.all(ne.slice(we,we+Ae).map(Be=>ce.delete(`products/variants/${Be}`)));z.success(u("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{z.error(u("Failed to delete some variants"))}finally{g()}},At=ne=>{if(!ne||!ne.id)return;const Ae=ne.item_status==="inactive"?"active":"inactive";_(),t.productEditModel.bulkUpdateVariants([{id:ne.id,item_status:Ae}]).then(we=>{ne.item_status=Ae,z.success((we==null?void 0:we.message)||u("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(we=>{var Be;z.error(((Be=we==null?void 0:we.data)==null?void 0:Be.message)||u("Failed to update variant"))}).finally(g)},Mt=ne=>{const Ae=ne.attr_map||[];return Ae.length?Ae.map(Be=>{const Ye=t.attributeGroups.find(wt=>wt.id===parseInt(Be.group_id));if(!Ye)return null;const bt=(Ye.terms||[]).find(wt=>wt.id===parseInt(Be.term_id));return bt?bt.title:null}).filter(Boolean).join(" / "):""},Ft=(ne,Ae)=>{const we=ne.attr_map||[];if(!we.length)return"";const Be=parseInt(Ae);return we.filter(bt=>parseInt(bt.group_id)!==Be).map(bt=>{const wt=t.attributeGroups.find(st=>st.id===parseInt(bt.group_id));if(!wt)return null;const te=(wt.terms||[]).find(st=>st.id===parseInt(bt.term_id));return te?te.title:null}).filter(Boolean).join(" / ")},$t=ne=>{const Ae=t.product.variants.findIndex(we=>we.id===ne.id);Ae!==-1&&(t.productEditModel.setValidationErrors({}),b.value=Ae,C.value=!0)},ct=()=>{t.productEditModel.setValidationErrors({}),L.value=!1,C.value=!1,b.value=null,s.value=!1,i.value=null,c.value=!1},Ut=()=>{t.productEditModel.setValidationErrors({}),L.value=!1,s.value=!1,i.value=null},St=()=>{x.value=!1,F.value=!1,U.value=null},Dt=()=>{var ne,Ae;return((Ae=(ne=w.value)==null?void 0:ne.hasDirtyDrafts)==null?void 0:Ae.call(ne))??!1},Et=ne=>{L.value=ne},It=()=>{const ne=U.value;if(St(),!!ne&&ne.type==="close"){if(typeof ne.done=="function"){ne.done();return}ct()}},Ht=()=>{St()},Bt=async()=>{var ne,Ae;await((Ae=(ne=w.value)==null?void 0:ne.discardDrafts)==null?void 0:Ae.call(ne)),L.value=!1,It()},ra=async()=>{var Ae;if(!((Ae=w.value)!=null&&Ae.saveCurrentDraft)||F.value)return;if(F.value=!0,await w.value.saveCurrentDraft()){L.value=!1,It();return}F.value=!1,Ht()},ve=ne=>{if(!Dt()){ne();return}U.value={type:"close",done:ne},x.value=!0},$e=()=>{if(s.value){ve(Ut);return}ve(ct)},ot=ne=>{if(L.value=!1,t.productEditModel.setValidationErrors({}),s.value){c.value=!0,t.productEditModel.data.reloader();return}ne&&typeof ne.index=="number"&&ne.index>=0&&(b.value=ne.index)},vt=ne=>{const Ae=aa.value?aa.value.find(we=>we.termId===ne.termId):null;Ae&&yt(Ae)},yt=ne=>{if(!ne||!ne.items||!ne.items.length||L.value)return;i.value=ne,s.value=!0;const Ae=ne.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof Ae.index=="number"?Ae.index:null,C.value=!0},Nt=V(typeof window<"u"?window.innerWidth:1280);let ft=null;Qe(()=>{typeof window>"u"||(ft=()=>{Nt.value=window.innerWidth},window.addEventListener("resize",ft))}),Ct(()=>{ft&&(window.removeEventListener("resize",ft),ft=null)});const Zt=K(()=>Nt.value<=900),pa=K(()=>Nt.value<=640?"100%":Nt.value<=900?"95%":"920px"),Kt=K(()=>{const ne=new Map;return(t.product.variants||[]).forEach((Ae,we)=>{Ae&&Ae.id!=null&&ne.set(Ae.id,we)}),(he.value||[]).map(Ae=>{var Be,Ye;const we=ne.get(Ae==null?void 0:Ae.id);return{key:(Ae==null?void 0:Ae.id)??`variant-${we}`,index:we,variant:Ae,label:Mt(Ae)||(Ae==null?void 0:Ae.variation_title)||`${u("Variant")} ${we+1}`,meta:(Ae==null?void 0:Ae.item_price)!==void 0&&(Ae==null?void 0:Ae.item_price)!==null&&(Ae==null?void 0:Ae.item_price)!==""?`${((Ye=(Be=window.appVars)==null?void 0:Be.shop)==null?void 0:Ye.currency_sign)||"$"} ${Ae.item_price}`:u("No price set"),modeType:"update",isDraft:!1}})}),aa=K(()=>{if(!le.value||le.value.length===0)return null;const ne=new Map;(t.product.variants||[]).forEach((Be,Ye)=>{Be&&Be.id!=null&&ne.set(Be.id,Ye)});const Ae=I.value,we=Be=>{var wt,te;const Ye=ne.get(Be==null?void 0:Be.id),bt=Ae?Ft(Be,Ae):Mt(Be);return{key:(Be==null?void 0:Be.id)??`variant-${Ye}`,index:Ye,variant:Be,label:bt||(Be==null?void 0:Be.variation_title)||`${u("Variant")} ${Ye+1}`,meta:(Be==null?void 0:Be.item_price)!==void 0&&(Be==null?void 0:Be.item_price)!==null&&(Be==null?void 0:Be.item_price)!==""?`${((te=(wt=window.appVars)==null?void 0:wt.shop)==null?void 0:te.currency_sign)||"$"} ${Be.item_price}`:u("No price set"),modeType:"update",isDraft:!1}};return le.value.map(Be=>({termId:Be.termId,title:Be.title,count:Be.variants.length,items:Be.variants.map(we)}))}),Ma=K(()=>{var Ae;const ne=(Ae=t.product.variants)==null?void 0:Ae[b.value];return(ne==null?void 0:ne.id)??`variant-${b.value??0}`}),Fl=(ne,Ae)=>{const we=parseInt(Ae,10),Be=(ne.attr_map||[]).find(te=>parseInt(te.group_id,10)===we);if(!Be)return"";const Ye=t.attributeGroups.find(te=>parseInt(te.id,10)===we);if(!Ye)return"";const bt=parseInt(Be.term_id,10),wt=(Ye.terms||[]).find(te=>parseInt(te.id,10)===bt);return wt?wt.title:""},ul=K(()=>{var Ae;if(b.value===null)return{group:"",detail:""};const ne=(Ae=t.product.variants)==null?void 0:Ae[b.value];return ne?I.value?{group:Fl(ne,I.value),detail:Ft(ne,I.value)}:{group:"",detail:Mt(ne)}:{group:"",detail:""}}),da=ne=>{ne&&(L.value&&Ma.value!==ne.key||typeof ne.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=ne.index))},_e=ne=>{var Ae,we;return!!((Ae=ne==null?void 0:ne.variant)!=null&&Ae.id)&&["publish","private"].includes((we=t.product)==null?void 0:we.post_status)},qa=ne=>`${ze.get("frontend_url")}=instant_checkout&item_id=${ne.variant.id}&quantity=1`,Y=(ne,Ae)=>{var we,Be;if(!(!Ae||!ne)){if(ne==="copy_variation_id"&&((we=Ae.variant)!=null&&we.id)){Yl.copy(String(Ae.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}if(ne==="copy_direct_checkout"&&_e(Ae)){Yl.copy(qa(Ae),{successMessage:u("Direct checkout link copied to clipboard")});return}ne==="toggle_status"&&((Be=Ae.variant)!=null&&Be.id)&&At(Ae.variant)}};return(ne,Ae)=>{const we=B("el-button"),Be=B("el-input"),Ye=B("el-checkbox"),bt=B("el-popover"),wt=B("el-dropdown-item"),te=B("el-dropdown-menu"),st=B("el-dropdown"),Rt=B("el-drawer"),La=B("el-dialog");return r(),h("div",qH,[o("div",YH,[n(fO,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:I.value,"onUpdate:modelValue":Ae[0]||(Ae[0]=He=>I.value=He)},null,8,["product","attribute-groups","modelValue"]),o("div",WH,[Q.value?(r(),$(we,{key:1,onClick:H},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})):(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":A(u)("Search and filter variants"),onClick:D},[n(ee,{name:"Search"}),n(ee,{name:"Filter"})],8,XH))])]),n(Gl,{onBeforeEnter:P,onEnter:G,onAfterEnter:J,onLeave:oe,onAfterLeave:Z},{default:d(()=>[Q.value?(r(),h("div",JH,[o("div",ZH,[n(Be,{modelValue:T.value,"onUpdate:modelValue":Ae[1]||(Ae[1]=He=>T.value=He),placeholder:A(u)("Search variants"),size:"small",clearable:""},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),pe.value.length>0?(r(),h("div",eP,[(r(!0),h(O,null,ae(pe.value,He=>(r(),$(bt,{key:He.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":q(He.id)>0}]),"aria-pressed":q(He.id)>0,type:"button"},[o("span",null,f(He.title),1),q(He.id)>0?(r(),h("span",aP,f(q(He.id)),1)):k("",!0),n(ee,{name:"ChevronDown"})],10,tP)]),default:d(()=>[o("div",lP,[o("div",sP,[o("span",null,f(A(u)("Filter by %1$s",He.title)),1),q(He.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Ie=>X(He.id)},f(A(u)("Clear")),9,nP)):k("",!0)]),o("ul",oP,[(r(!0),h(O,null,ae(He.terms,Ie=>(r(),h("li",{key:Ie.id},[n(Ye,{"model-value":N(He.id,Ie.id),onChange:re=>j(He.id,Ie.id)},{default:d(()=>[R(f(Ie.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),ge.value&&!fe.value?(r(),h("span",iP,f(A(u)("Showing %1$s of %2$s variants",he.value.length,e.product.variants.length)),1)):k("",!0),ge.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:ie},f(A(u)("Clear filters")),1)):k("",!0)])):k("",!0)])):k("",!0)]),_:1}),n(vO,{"selected-count":a.value.length,"bulk-action":S.value,"onUpdate:bulkAction":Ae[2]||(Ae[2]=He=>S.value=He),"bulk-value":M.value,"onUpdate:bulkValue":Ae[3]||(Ae[3]=He=>M.value=He),saving:l.value,onApply:Me,onClear:Ae[4]||(Ae[4]=He=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),fe.value?(r(),h("div",rP,[n(ee,{name:"Search"}),o("p",dP,f(A(u)("No variants match your filters")),1),o("p",uP,f(A(u)("Try a different search term or clear some filters.")),1),n(we,{size:"small",onClick:ie},{default:d(()=>[R(f(A(u)("Clear filters")),1)]),_:1})])):k("",!0),y.value&&!fe.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":ne.$t("Updating variants")},[o("table",null,[Ae[16]||(Ae[16]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col",{width:"160"}),o("col",{width:"160"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[Ae[13]||(Ae[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,f(ne.$t("Image")),1),o("th",null,f(ne.$t("Variant")),1),o("th",null,f(ne.$t("Price")),1),o("th",null,f(ne.$t("Compare at price")),1),Ae[14]||(Ae[14]=o("th",null,null,-1))])]),o("tbody",AP,[(r(!0),h(O,null,ae(Math.min(v.value,8),He=>(r(),h("tr",{key:"wrap-skel-"+He},Ae[15]||(Ae[15]=[o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-img"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-title"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-action"})],-1)])))),128))])])],8,cP)):me.value&&!fe.value?(r(),$(bH,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":le.value,"selected-variants":a.value,"is-all-selected":Ee.value,"is-selection-indeterminate":Pe.value,"group-by-id":I.value,"expanded-groups":p.value,"onUpdate:selectedVariants":Ae[5]||(Ae[5]=He=>a.value=He),"onUpdate:isAllSelected":Ae[6]||(Ae[6]=He=>Ee.value=He),"onUpdate:expandedGroups":Ae[7]||(Ae[7]=He=>p.value=He),onEditVariant:$t,onEditGroup:vt,onToggleStatus:At,onInlinePriceChange:gt,onInlinePriceCommit:be,onMediaUploaded:Ze,onGroupPriceApply:et,onGroupMediaUploaded:Fe},null,8,["product","product-edit-model","attribute-groups","grouped-variants","selected-variants","is-all-selected","is-selection-indeterminate","group-by-id","expanded-groups"])):!me.value&&!fe.value?(r(),$(PH,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:he.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":Ee.value,"is-selection-indeterminate":Pe.value,"onUpdate:selectedVariants":Ae[8]||(Ae[8]=He=>a.value=He),"onUpdate:isAllSelected":Ae[9]||(Ae[9]=He=>Ee.value=He),onEditVariant:$t,onToggleStatus:At,onInlinePriceChange:gt,onInlinePriceCommit:be,onMediaUploaded:Ze},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):k("",!0),me.value?k("",!0):(r(),h("div",pP,[(r(!0),h(O,null,ae(he.value,He=>{var Ie,re;return r(),h("div",{key:He.id,class:"fct-product-pricing-table-mobile-row"},[o("div",fP,[o("div",mP,[o("div",hP,[o("div",_P,[n(up,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:ue=>Ze(He,ue)},null,8,["onMediaUploaded"])]),((Ie=He==null?void 0:He.media)==null?void 0:Ie.length)>0?(r(),h("div",vP,[o("img",{src:(re=He.media[0])==null?void 0:re.url,alt:He.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,gP)])):(r(),h("img",{key:1,src:ne.appVars.asset_url+"images/empty-image.svg",alt:"No Image"},null,8,yP))]),o("div",bP,[o("div",wP,[R(f(He.variation_title)+" ",1),He.item_status==="inactive"?(r(),h("span",CP,f(A(u)("Inactive")),1)):k("",!0)]),o("div",BP,f(Mt(He)||"—"),1),o("ul",null,[o("li",null,[He.compare_price?(r(),h("div",kP,[o("span",{textContent:f(ne.appVars.shop.currency_sign)},null,8,xP),R(" "+f(He.compare_price),1)])):k("",!0),o("div",SP,[o("span",{textContent:f(ne.appVars.shop.currency_sign)},null,8,FP),R(" "+f(He.item_price),1)])])])])]),o("div",$P,[o("div",EP,[n(Xe,{size:"small",tag:"button",onClick:ue=>$t(He)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(st,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:ue=>{ue==="toggle_status"&&At(He)}},{dropdown:d(()=>[n(te,null,{default:d(()=>[n(wt,null,{default:d(()=>[He.id?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline",text:String(He.id),showMode:"icon_with_text",buttonText:A(u)("Copy Variation ID")},null,8,["text","buttonText"])):k("",!0)]),_:2},1024),He.id?(r(),$(wt,{key:0,command:"toggle_status",class:de({"item-destructive":He.item_status!=="inactive"})},{default:d(()=>[n(ee,{name:He.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+f(He.item_status==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]),_:2},1032,["class"])):k("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(ee,{name:"More"})],8,UP)]),_:2},1032,["onCommand"])])])])])}),128))])),n(Rt,{modelValue:C.value,"onUpdate:modelValue":Ae[11]||(Ae[11]=He=>C.value=He),title:A(u)("Pricing"),size:pa.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":ve,class:"fct-shared-variant-drawer",onClose:ct},{default:d(()=>{var He,Ie,re;return[o("div",IP,[!Zt.value&&s.value?(r(),h("aside",QP,[n(Qr,{product:e.product},null,8,["product"]),o("div",DP,[o("p",VP,f(A(u)("Editing group")),1),o("p",TP,f((He=i.value)==null?void 0:He.title),1),o("p",MP,f(A(u)("Changes will apply to all %1$s variants in this group.",(Ie=i.value)==null?void 0:Ie.count)),1),o("ul",LP,[(r(!0),h(O,null,ae((re=i.value)==null?void 0:re.items,ue=>(r(),h("li",{key:ue.key,class:"fct-group-edit-aside__item"},f(ue.label),1))),128))])])])):Zt.value?k("",!0):(r(),h("aside",RP,[n(Qr,{product:e.product},null,8,["product"]),o("div",OP,[n(Be,{modelValue:T.value,"onUpdate:modelValue":Ae[10]||(Ae[10]=ue=>T.value=ue),placeholder:A(u)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),pe.value.length>0?(r(),h("div",HP,[(r(!0),h(O,null,ae(pe.value,ue=>(r(),$(bt,{key:"nav-chip-"+ue.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":q(ue.id)>0}]),"aria-pressed":q(ue.id)>0,type:"button"},[o("span",null,f(ue.title),1),q(ue.id)>0?(r(),h("span",NP,f(q(ue.id)),1)):k("",!0),n(ee,{name:"ChevronDown"})],10,PP)]),default:d(()=>[o("div",KP,[o("div",GP,[o("span",null,f(A(u)("Filter by %1$s",ue.title)),1),q(ue.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:De=>X(ue.id)},f(A(u)("Clear")),9,jP)):k("",!0)]),o("ul",zP,[(r(!0),h(O,null,ae(ue.terms,De=>(r(),h("li",{key:De.id},[n(Ye,{"model-value":N(ue.id,De.id),onChange:Le=>j(ue.id,De.id)},{default:d(()=>[R(f(De.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):k("",!0),ge.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:ie},f(A(u)("Clear filters")),1)):k("",!0)]),n(Up,{items:Kt.value,"grouped-items":aa.value,"active-key":Ma.value,"is-dirty":L.value,"is-saving":F.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":_e,onSelect:da,onSave:ra,onCommand:Y,onEditGroup:yt},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",qP,[Zt.value&&s.value?(r(),h("div",YP,[o("span",WP,f(A(u)("Editing group: %1$s",i.value.title)),1),o("span",XP,f(A(u)("%1$s variants",i.value.count)),1)])):Zt.value?(r(),h(O,{key:1},[aa.value&&aa.value.length?(r(),h("div",JP,[(r(!0),h(O,null,ae(aa.value,ue=>(r(),h("button",{key:"cge-"+ue.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:L.value,"aria-label":A(u)("Edit group %1$s",ue.title),onClick:De=>yt(ue)},[n(ee,{name:"Edit"}),o("span",null,f(ue.title),1)],8,ZP))),128))])):k("",!0),n(Ip,{items:Kt.value,"active-key":Ma.value,"is-dirty":L.value,onSelect:da},null,8,["items","active-key","is-dirty"])],64)):k("",!0),o("div",eN,[C.value&&b.value!==null&&!s.value?(r(),$(Bd,{ref_key:"pricingFormRef",ref:w,key:Ma.value,index:b.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":ul.value,onCreateOrUpdateVariant:ot,onCloseModal:$e,onDirtyStateChange:Et},null,8,["index","product","productEditModel","variant-title-info"])):C.value&&s.value&&i.value?(r(),$(zH,{ref_key:"pricingFormRef",ref:w,key:`group-${i.value.termId}`,"group-variant-ids":i.value.items.map(function(ue){return ue.variant&&ue.variant.id?ue.variant.id:null}).filter(Boolean),fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:ot,onCloseModal:$e,onDirtyStateChange:Et},null,8,["group-variant-ids","product","productEditModel"])):k("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(La,{modelValue:x.value,"onUpdate:modelValue":Ae[12]||(Ae[12]=He=>x.value=He),"close-on-click-modal":!1,"close-on-press-escape":!F.value,"show-close":!F.value,class:"fct-variant-dirty-dialog",onClose:Ht},{header:d(({titleId:He})=>[o("div",tN,[o("h3",{id:He},f(A(u)("Unsaved changes")),9,aN)])]),default:d(()=>[o("p",null,f(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",lN,[o("div",sN,[n(we,{disabled:F.value,size:"small",onClick:Ht},{default:d(()=>[R(f(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(we,{disabled:F.value,size:"small",onClick:Bt},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(we,{type:"primary",loading:F.value,size:"small",onClick:ra},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},oN=["src","alt"],iN={class:"fct-swatch-tag-label"},rN=["aria-label","onClick","onKeydown"],Yi={__name:"DraggableOptionValues",props:{modelValue:{type:Array,default:()=>[]},terms:{type:Array,default:()=>[]},type:{type:String,default:"options"}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=(y,v)=>String(y)===String(v),i=K({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),c=y=>a.terms.find(v=>s(v.id,y))||null,p=y=>{if(typeof y=="string")return y;const v=c(y);return v?v.title:String(y)},m=y=>{const v=c(y);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=y=>{const v=c(y);return v&&v.settings&&v.settings.image?v.settings.image:""},g=y=>{l("update:modelValue",a.modelValue.filter(v=>!s(v,y)))};return(y,v)=>(r(),$(A(Js),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=C=>i.value=C),handle:".fct-value-tag-handle",disabled:i.value.length<2,class:"fct-value-tag-list",tag:"div"},{default:d(()=>[(r(!0),h(O,null,ae(i.value,C=>(r(),h("span",{key:String(C),class:"fct-swatch-tag"},[i.value.length>1?(r(),h("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ne(()=>{},["stop"]))},[n(ee,{name:"ReorderDotsVertical"})],32)):k("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:na(m(C))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(C),alt:p(C)},null,8,oN)):k("",!0),o("span",iN,f(p(C)),1),o("span",{class:"fct-swatch-tag-close",role:"button",tabindex:"0","aria-label":A(u)("Remove"),onMousedown:v[1]||(v[1]=Ne(()=>{},["stop"])),onClick:Ne(b=>g(C),["stop"]),onKeydown:$a(Ne(b=>g(C),["prevent"]),["enter","space"])},"×",40,rN)]))),128))]),_:1},8,["modelValue","disabled"]))}},dN={class:"fct-add-term-modal"},uN={class:"dialog-footer"},cN={__name:"AddTermModal",props:{groupId:{type:[String,Number],required:!0},group:{type:Object,default:()=>({})},initialTitle:{type:String,default:""}},emits:["isTermCreatingDone"],setup(e,{emit:t}){const a=e,l=t,s=V(!1),i=V({}),c=V(null),p=K(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),m=V({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=K(()=>(m.value.title||"").trim()!==""),g=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const y={terms:[{title:m.value.title.trim(),settings:{color:m.value.settings.color||"",image:m.value.settings.image||""}}]};ce.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{Xs(v.message);const C=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",C)}).catch(v=>{var C;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:z.error(((C=v==null?void 0:v.data)==null?void 0:C.message)||(v==null?void 0:v.message)||u("Failed to add the term."))}).finally(()=>{s.value=!1})};return(y,v)=>{const C=B("el-button");return r(),h("div",dN,[n(ho,{ref_key:"formRef",ref:c,term:m.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:g,onRemove:v[0]||(v[0]=b=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",uN,[n(C,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:g},{default:d(()=>[R(f(A(u)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},AN={class:"fct-advanced-variation-config"},pN={class:"fct-adv-var-attributes"},fN={key:0,class:"fct-adv-var-loading"},mN={key:1,class:"fct-adv-var-empty-hint"},hN={key:2,class:"fct-adv-var-empty-state"},_N={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},vN={class:"fct-adv-var-empty-state__copy"},gN=["aria-expanded","onClick","onKeydown"],yN={class:"fct-option-card-summary"},bN={class:"fct-option-card-summary-header"},wN={key:0,class:"fct-option-card-chips"},CN=["src","alt"],BN={class:"fct-option-value-chip-label"},kN=["aria-label","title","onClick"],xN={key:0,class:"fct-option-card-body"},SN={class:"fct-option-label"},FN={key:0,class:"mt-2"},$N={key:1,class:"fct-option-error"},EN={class:"fct-option-label"},UN={key:0,class:"fct-select-all-header"},IN={class:"fct-option-item"},QN={class:"fct-option-item"},DN={key:1,class:"fct-picker-inline-form-body"},VN={class:"fct-picker-inline-form-actions"},TN={key:1,class:"fct-option-field-values"},MN={class:"fct-option-empty-default"},LN={key:0,class:"fct-select-all-header"},RN={class:"fct-color-option"},ON={key:1,class:"fct-picker-inline-form-body"},HN={class:"fct-picker-inline-form-actions"},PN={key:2,class:"fct-option-field-values"},NN={class:"fct-option-empty-default"},KN={key:0,class:"fct-select-all-header"},GN={class:"fct-image-option"},jN=["src"],zN={key:1,class:"fct-picker-inline-form-body"},qN={class:"fct-picker-inline-form-actions"},YN={key:3,class:"fct-option-error"},WN={class:"fct-option-card-actions"},XN=["title"],JN={key:5,class:"fct-adv-order-save-bar"},ZN={class:"fct-adv-order-save-bar__msg"},eK={class:"fct-adv-order-save-bar__actions"},tK={key:6},aK={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},lK={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},sK={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},nK={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},Ao=200,Wi=10,Xi=100,Wu=200,oK={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V([]),l=V([]),s=V(!1),i=V(!1),c=V(!1),p=V(null),m=V(!1),_=V(null),g=V(!1),y=V(null),v=V(null),C=V([]),b=V([]),w=V(""),x=re=>JSON.stringify(re.map(ue=>({group_id:ue.group_id||null,variants:[...ue.variants||[]].map(De=>String(De))}))),F=()=>{b.value=l.value.map(re=>({group_id:re.group_id||null,title:re.title||"",variants:Array.isArray(re.variants)?[...re.variants]:[]})),w.value=x(l.value)},L=K(()=>{const re=l.value.filter(ue=>ue.group_id&&Array.isArray(ue.variants)&&ue.variants.length>0);return re.length===0?w.value!==x([]):x(re)!==w.value}),U=K(()=>l.value.length===0?u("All options removed. Save to delete all variations."):u("Option config changed. Save to update variants.")),S=K(()=>{if(p.value===null||!v.value)return!1;const re=l.value[p.value];if(!re)return!1;if(String(re.group_id||"")!==String(v.value.group_id||"")||(re.title||"")!==(v.value.title||""))return!0;const ue=Array.isArray(re.variants)?re.variants:[],De=Array.isArray(v.value.variants)?v.value.variants:[];if(ue.length!==De.length)return!0;const Le=ue.map(pt=>String(pt)),Ke=De.map(pt=>String(pt));return Le.some((pt,mt)=>pt!==Ke[mt])});Qe(()=>{I(),M()}),Ct(()=>{st()});const M=()=>{c.value=!0,ce.get("options/attr/groups/library").then(re=>{a.value=(re.groups||[]).slice(0,Wu),l.value.forEach(ue=>D(ue.group_id))}).catch(re=>{var ue;z.error(((ue=re==null?void 0:re.data)==null?void 0:ue.message)||u("Failed to load attribute groups"))}).finally(()=>{c.value=!1})},I=()=>{var De,Le;const re=(Le=(De=t.product)==null?void 0:De.detail)==null?void 0:Le.other_info,ue=re==null?void 0:re.attribute_config;ue&&Array.isArray(ue)&&(l.value=ue.map(Ke=>({group_id:/^\d+$/.test(String(Ke.group_id))?parseInt(Ke.group_id,10):Ke.group_id,title:Ke.title||"",variants:(Ke.variants||[]).map(pt=>parseInt(pt,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),W(),F()},T=new Set,Q=V({}),E=K(()=>{if(!v.value||!v.value.group_id)return!1;const re=parseInt(v.value.group_id,10);return!!Q.value[re]}),D=re=>{if(!/^\d+$/.test(String(re)))return;const ue=parseInt(re,10),De=a.value.find(Ke=>Ee(Ke.id,ue));if(!De||Array.isArray(De.terms)||T.has(ue))return;T.add(ue),Q.value[ue]=!0;const Le=Math.min(Math.max(parseInt(De.terms_count,10)||0,50),200);ce.get("options/attr/group/"+ue+"/terms",{per_page:Le}).then(Ke=>{De.terms=Ke.terms&&Ke.terms.data||[]}).catch(Ke=>{var pt;z.error(((pt=Ke==null?void 0:Ke.data)==null?void 0:pt.message)||u("Failed to load option values"))}).finally(()=>{T.delete(ue),delete Q.value[ue]})},H=new Set;let P=null;const G=(re,ue)=>{const De=(ue||"").trim();if(!De||!/^\d+$/.test(String(re)))return;const Le=parseInt(re,10),Ke=a.value.find(Vt=>Ee(Vt.id,Le));if(!Ke)return;const pt=Array.isArray(Ke.terms)?Ke.terms.length:0,mt=parseInt(Ke.terms_count,10)||0;mt&&pt>=mt||Array.isArray(Ke.terms)&&Ke.terms.some(Vt=>(Vt.title||"").trim().toLowerCase()===De.toLowerCase())||(P&&clearTimeout(P),P=setTimeout(()=>{const Vt=Le+":"+De.toLowerCase();H.has(Vt)||(H.add(Vt),ce.get("options/attr/group/"+Le+"/terms",{search:De,per_page:50}).then(ea=>{const Ia=ea.terms&&ea.terms.data||[];if(!Ia.length)return;Array.isArray(Ke.terms)||(Ke.terms=[]);const Gt=new Set(Ke.terms.map(Ba=>Ba.id)),fa=Ia.filter(Ba=>!Gt.has(Ba.id));fa.length&&(Ke.terms=[...Ke.terms,...fa])}).catch(()=>{}).finally(()=>{H.delete(Vt)}))},250))},J=re=>{if(!/^\d+$/.test(String(re)))return;const ue=parseInt(re,10),De=a.value.find(Ke=>Ee(Ke.id,ue));if(!De||T.has(ue))return;T.add(ue);const Le=Math.min(Math.max(parseInt(De.terms_count,10)||0,50),200);ce.get("options/attr/group/"+ue+"/terms",{per_page:Le}).then(Ke=>{const pt=Ke.terms&&Ke.terms.data||[],mt=new Map((Array.isArray(De.terms)?De.terms:[]).map(ea=>[ea.id,ea]));pt.forEach(ea=>mt.set(ea.id,ea)),De.terms=Array.from(mt.values());const Vt=Ke.terms&&Ke.terms.total;typeof Vt=="number"&&(De.terms_count=Vt)}).catch(()=>{}).finally(()=>{T.delete(ue)})};let oe=!1;const Z=()=>{oe||(oe=!0,ce.get("options/attr/groups/library").then(re=>{const ue=(re.groups||[]).slice(0,Wu),De=new Map(a.value.map(Le=>[Le.id,Le]));ue.forEach(Le=>{const Ke=De.get(Le.id);De.set(Le.id,Ke&&Array.isArray(Ke.terms)?{...Le,terms:Ke.terms}:Le)}),a.value=Array.from(De.values())}).catch(()=>{}).finally(()=>{oe=!1}))},W=()=>{C.value=l.value.map(re=>re.group_id).filter(Boolean)},pe=()=>{v.value=null,p.value=null,l.value=b.value.map(re=>({group_id:re.group_id,title:re.title,variants:[...re.variants],errors:{name:"",values:""}}))},N=async()=>{if(p.value!==null&&(await fe(p.value),p.value!==null))return;if(i.value=!0,!await ot()){i.value=!1;return}ra({silent:!1})},j=re=>{const ue=l.value.filter((De,Le)=>Le!==re).map(De=>De.group_id).filter(Boolean);return a.value.filter(De=>!ue.includes(De.id))},q=async()=>{if(p.value!==null&&(await fe(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const re=l.value.length-1;ge(re)},X=re=>{l.value.splice(re,1),p.value===re?(p.value=null,v.value=null):p.value!==null&&p.value>re&&p.value--},ie=re=>{p.value===re?fe(re):ge(re)},ge=re=>{const ue=l.value[re];v.value={group_id:ue.group_id||null,title:ue.title||"",variants:Array.isArray(ue.variants)?[...ue.variants]:[],errors:{name:"",values:""}},p.value=re,D(ue.group_id)},fe=async re=>{if(!v.value||(v.value.errors.name=v.value.group_id?"":u("Option name is required."),v.value.errors.values=!v.value.variants||v.value.variants.length===0?u("Please add at least one option value."):"",v.value.errors.name||v.value.errors.values))return;const ue=l.value[re];ue.group_id=v.value.group_id,ue.title=v.value.title,ue.variants=[...v.value.variants],ue.errors={name:"",values:""},v.value=null,p.value=null},he=V(""),le=re=>{he.value=re||""},me=re=>{if(re){Z();return}he.value=""},Ue=re=>{const ue=j(re),De=he.value.trim().toLowerCase();return De?ue.filter(Le=>typeof Le.title=="string"&&Le.title.toLowerCase().includes(De)):ue},et=K(()=>{const re=he.value.trim().toLowerCase();return re?!a.value.some(ue=>typeof ue.title=="string"&&ue.title.trim().toLowerCase()===re):!0}),be=re=>{if(v.value){if(typeof re=="string"&&re!==""){const ue=re.trim().toLowerCase(),De=a.value.find(Le=>typeof Le.title=="string"&&Le.title.trim().toLowerCase()===ue);De?(v.value.group_id=De.id,v.value.title=De.title,v.value.variants=[],D(De.id)):(v.value.title=re,v.value.variants=[])}else{const ue=a.value.find(De=>Ee(De.id,re));ue&&(v.value.title=ue.title,v.value.variants=[]),D(re)}v.value.errors&&(v.value.errors.name="")}},qe=K(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),gt=V(!1),Ze=async re=>{var Ke;if(!re||typeof re.group_id!="string"||re.group_id.trim()==="")return re?re.group_id:null;const ue=re.group_id.trim(),De=ue.toLowerCase(),Le=a.value.find(pt=>typeof pt.title=="string"&&pt.title.trim().toLowerCase()===De);if(Le)return re.group_id=Le.id,re.title=Le.title,D(Le.id),Le.id;gt.value=!0;try{const pt=await ce.post("options/attr/group/",{title:ue,slug:ue}),mt=pt.data||pt.group||pt;if(!mt||!mt.id)return z.error(u("Failed to create attribute group")),null;a.value=[...a.value,{...mt,terms:mt.terms||[]}];const Vt=parseInt(mt.id,10);return re.group_id=Vt,re.title=mt.title||ue,Vt}catch(pt){let mt="";if((pt==null?void 0:pt.status_code)===422||(pt==null?void 0:pt.status)===422){z.validationErrors(pt);const Vt=pt!=null&&pt.data&&typeof pt.data=="object"?pt.data:{},ea=Object.values(Vt)[0],Ia=ea&&typeof ea=="object"?Object.values(ea)[0]:ea;mt=typeof Ia=="string"?Ia:u("Failed to create attribute group")}else mt=((Ke=pt==null?void 0:pt.data)==null?void 0:Ke.message)||u("Failed to create attribute group"),z.error(mt);return re.errors&&(re.errors.name=mt),null}finally{gt.value=!1}},Fe=async()=>!v.value||!qe.value?!0:await Ze(v.value)!==null,Ee=(re,ue)=>String(re)===String(ue),Pe=re=>{const ue=a.value.find(De=>Ee(De.id,re));return ue?ue.terms||[]:[]},Me=re=>{if(!v.value||!Ee(v.value.group_id,re))return[];const ue=Pe(re).map(De=>De.title.toLowerCase());return(v.value.variants||[]).filter(De=>typeof De=="string"&&De.trim()!==""&&!ue.includes(De.toLowerCase()))},ht=K(function(){if(!v.value||!v.value.group_id)return!1;var re=Pe(v.value.group_id);return re.length?re.every(function(ue){return v.value.variants.some(function(De){return Ee(De,ue.id)})}):!1}),At=K(function(){if(!v.value||!v.value.group_id)return!1;var re=Pe(v.value.group_id),ue=re.filter(function(De){return v.value.variants.some(function(Le){return Ee(Le,De.id)})}).length;return ue>0&&ue<re.length}),Mt=function(re){if(v.value){var ue=String(re),De=v.value.variants.findIndex(function(Le){return String(Le)===ue});De===-1?v.value.variants.push(re):v.value.variants.splice(De,1)}},Ft=function(re){if(v.value){var ue=Pe(v.value.group_id);v.value.variants=re?ue.map(function(De){return De.id}):[]}},$t=(re,ue)=>{const De=p.value===ue&&v.value?v.value:re;if(De.title)return De.title;const Le=a.value.find(Ke=>Ee(Ke.id,De.group_id));return Le&&Le.title?Le.title:u("Untitled option")},ct=K(()=>{const re=l.value.map(ue=>ue.group_id).filter(Boolean);return new Set(re).size!==re.length}),Ut=K(()=>l.value.length>Wi),St=K(()=>l.value.length>0&&l.value.length<=Wi&&!ct.value&&l.value.every(re=>re.group_id&&re.variants&&re.variants.length>0&&re.variants.every(ue=>typeof ue=="number"))),Dt=K(()=>St.value?l.value.reduce((re,ue)=>re*(ue.variants?ue.variants.length:0),1):0),Et=K(()=>Dt.value>Ao),It=K(()=>{const re=l.value.filter(ue=>ue.group_id&&Array.isArray(ue.variants)&&ue.variants.length>0);return re.length?re.reduce((ue,De)=>ue*De.variants.length,1):0}),Ht=K(()=>{const re=l.value.filter(De=>Array.isArray(De.variants)&&De.variants.length>0);if(!re.length)return 0;let ue=re.length-1;return re.forEach(De=>{const Le=De.variants.map(pt=>parseInt(pt,10)).filter(Number.isFinite),Ke=Le.length?Math.max(...Le):0;ue+=String(Ke).length}),ue}),Bt=K(()=>Ht.value>Xi),ra=({silent:re=!1}={})=>{if(s.value)return;if(l.value.length===0){s.value=!0,ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:[]}).then(()=>{const Le=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Le&&(Le.variants=[]),W(),F(),t.productEditModel&&t.productEditModel.data&&typeof t.productEditModel.data.reloader=="function"&&t.productEditModel.data.reloader(),t.productEditModel&&typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Le=>{var Ke;z.error(((Ke=Le==null?void 0:Le.data)==null?void 0:Ke.message)||u("Failed to clear variations"))}).finally(()=>{s.value=!1,i.value=!1});return}if(!St.value){re||z.error(u("Please select at least one term for each attribute.")),i.value=!1;return}if(Et.value){re||z.error(u("Too many combinations (%1$s). Maximum allowed is %2$s.",Dt.value,Ao)),i.value=!1;return}if(Bt.value){re||z.error(u("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",Xi)),i.value=!1;return}s.value=!0;const ue=l.value.map(Le=>({group_id:Le.group_id,title:Le.title,variants:[...new Set((Le.variants||[]).map(Ke=>parseInt(Ke,10)).filter(Number.isFinite))]}));let De=null;ce.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:ue}).then(Le=>{re||(De=Le.message||u("Variations generated successfully!")),W(),F();const Ke=Le&&Array.isArray(Le.data)?Le.data:null,pt=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Ke&&pt&&(pt.variants=Ke),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Le=>{var Ke;z.error(((Ke=Le==null?void 0:Le.data)==null?void 0:Ke.message)||u("Failed to generate variations"))}).finally(async()=>{var Vt,ea;await Se();const Le=(ea=(Vt=t.productEditModel)==null?void 0:Vt.data)==null?void 0:ea.product,Ke=()=>{const Ia=Le?Le.variants:null;return Array.isArray(Ia)&&Ia.some(Gt=>Array.isArray(Gt.attr_map)&&Gt.attr_map.length>0)},pt=2500,mt=Date.now();for(;!Ke()&&Date.now()-mt<pt;)await new Promise(Ia=>setTimeout(Ia,50));await Se(),s.value=!1,await Se(),await Se(),i.value=!1,De&&(z.success(De),De=null)})},ve=re=>{v.value&&v.value.errors&&re&&re.length>0&&(v.value.errors.values="")},$e=async(re,{silent:ue=!1}={})=>{var pt;const De=Pe(re.group_id).map(mt=>mt.title.toLowerCase()),Le=(re.variants||[]).filter(mt=>typeof mt=="string"&&!De.includes(mt.toLowerCase()));if(!Le.length)return!0;const Ke=a.value.find(mt=>Ee(mt.id,re.group_id));try{const mt=await ce.post("options/attr/group/"+re.group_id+"/terms",{terms:Le.map(ea=>({title:ea}))}),Vt=mt.data;Ke&&(Array.isArray(Ke.terms)||(Ke.terms=[]),Ke.terms=[...Ke.terms,...Vt]),Vt.forEach(ea=>{re.variants=re.variants.map(Ia=>typeof Ia=="string"&&Ia.toLowerCase()===ea.title.toLowerCase()?ea.id:Ia)}),re.variants=re.variants.filter(ea=>typeof ea!="string"),ue||z.success(mt.message||u("Option values created successfully"))}catch(mt){return re.variants=re.variants.filter(Vt=>typeof Vt!="string"),z.error(((pt=mt==null?void 0:mt.data)==null?void 0:pt.message)||u("Failed to create option values")),!1}return!0},ot=async()=>{for(const re of l.value)if(typeof re.group_id=="string"&&re.group_id.trim()!==""&&!await Ze(re)||!await $e(re,{silent:!0}))return!1;return!0},vt=re=>{const ue=a.value.find(De=>Ee(De.id,re));return ue&&ue.settings&&ue.settings.type?ue.settings.type:"options"},yt=re=>({options:u("Text"),color:u("Color"),image:u("Image")})[vt(re)]||vt(re),Nt=re=>({options:"info",color:"warning",image:"success"})[vt(re)]||"info",ft=re=>{if(!re.variants||re.variants.length===0)return[];const ue=Pe(re.group_id);return re.variants.map(De=>typeof De=="string"?{id:De,title:De}:ue.find(Le=>Ee(Le.id,De))).filter(Boolean)},Zt=re=>re.title?u("Add %1$s",re.title.toLowerCase()):u("Add more value"),pa=V(""),Kt=V(""),aa=V("");let Ma=null;const Fl=re=>{Ma=re},ul=V(!1),da=V({title:"",settings:{color:"",image:""}}),_e=V(!1),qa=V({}),Y=re=>{Kt.value=re||"",v.value&&G(v.value.group_id,re)},se=K(()=>{if(!v.value||!v.value.group_id)return[];const re=Pe(v.value.group_id),ue=Kt.value.trim().toLowerCase();return ue?re.filter(De=>(De.title||"").toLowerCase().includes(ue)):re}),ye=()=>{const re=Kt.value.trim();if(!re||!v.value||!v.value.group_id)return;const ue=vt(v.value.group_id);ue!=="color"&&ue!=="image"||te(re)},Re=(re,ue)=>{if(!re||re.key!=="Enter"||!v.value||!v.value.group_id)return;const De=vt(v.value.group_id);if(De!=="color"&&De!=="image")return;const Le=re.target,Ke=(Le&&typeof Le.value=="string"?Le.value:"").trim();!Ke||Pe(v.value.group_id).find(mt=>typeof mt.title=="string"&&mt.title.trim().toLowerCase()===Ke.toLowerCase())||(re.preventDefault(),re.stopPropagation(),te(Ke))};let tt=null,dt=null,je=null,ne=null;const Ae=re=>{tt=re},we=re=>{y.value=re,g.value=!0},Be=re=>{if(!re||!re.id){g.value=!1,y.value=null;return}const ue=y.value;a.value=[...a.value,{...re,terms:re.terms||[]}],ue!==null&&v.value&&p.value===ue&&(v.value.group_id=parseInt(re.id,10),v.value.title=re.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),D(parseInt(re.id,10))),g.value=!1,y.value=null},Ye=re=>{aa.value=re||"",v.value&&G(v.value.group_id,re)},bt=K(()=>{if(!v.value||!v.value.group_id)return[];const re=Pe(v.value.group_id),ue=aa.value.trim().toLowerCase();return ue?re.filter(De=>(De.title||"").toLowerCase().includes(ue)):re}),wt=K(()=>{if(!v.value||!v.value.group_id)return[];const re=Me(v.value.group_id),ue=aa.value.trim().toLowerCase();return ue?re.filter(De=>(De||"").toLowerCase().includes(ue)):re}),te=re=>{da.value={title:(re||"").trim(),settings:{color:"",image:""}},ul.value=!0,qa.value={},dt||(dt=function(ue){var De=document.querySelector(".fct-option-values-select");if(!(De&&De.contains(ue.target))){var Le=document.querySelector(".el-color-picker__panel");Le&&Le.contains(ue.target)||ue.stopPropagation()}},document.addEventListener("mousedown",dt,!0),je=function(ue){var De=document.querySelector(".el-color-picker__panel");De&&De.contains(ue.target)&&ue.stopPropagation()},document.body.addEventListener("mousedown",je)),ne&&document.removeEventListener("keyup",ne,!0),ne=function(ue){ue.key==="Enter"&&(ue.stopPropagation(),document.removeEventListener("keyup",ne,!0),ne=null)},document.addEventListener("keyup",ne,!0),Se(()=>{var ue=document.querySelector(".fct-option-values-select");if(ue){var De=tt||Ma;if(De){var Le=De.$el||De,Ke=Le?Le.getBoundingClientRect().width:0;Ke>0&&(ue.style.maxWidth=Ke+"px")}}})},st=()=>{ul.value=!1,da.value={title:"",settings:{color:"",image:""}},qa.value={},dt&&(document.removeEventListener("mousedown",dt,!0),dt=null),je&&(document.body.removeEventListener("mousedown",je),je=null),ne&&(document.removeEventListener("keyup",ne,!0),ne=null);var re=document.querySelector(".fct-option-values-select");re&&(re.style.maxWidth="")},Rt=async re=>{const ue=(da.value.title||"").trim();if(!ue||_e.value||!v.value||!v.value.group_id)return;_e.value=!0,qa.value={};const De={terms:[{title:ue,settings:{color:da.value.settings.color||"",image:da.value.settings.image||""}}]};try{if(qe.value&&!await Fe())return;const Le=await ce.post("options/attr/group/"+v.value.group_id+"/terms",De),Ke=Array.isArray(Le.data)?Le.data[0]:Le.data;_.value=re,Ie(Ke),st(),Kt.value="",aa.value=""}catch(Le){Le&&Le.status_code===422&&Le.data?qa.value=Le.data:z.error(Le&&Le.data&&Le.data.message||Le&&Le.message||u("Failed to add the term."))}finally{_e.value=!1}},La=re=>{if(re){v.value&&J(v.value.group_id);return}st(),Kt.value=""},He=re=>{if(re){v.value&&J(v.value.group_id);return}st(),aa.value=""},Ie=re=>{const ue=_.value,De=l.value[ue];if(De){const Le=v.value?v.value.group_id:De.group_id;if(Le&&/^\d+$/.test(String(Le))){const Ke=parseInt(Le,10),pt=a.value.find(mt=>Ee(mt.id,Ke));if(pt&&re&&Array.isArray(pt.terms)?pt.terms.push(re):(pt&&delete pt.terms,D(Ke)),re&&v.value&&Array.isArray(v.value.variants)){const mt=(re.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(Vt){return!(typeof Vt=="string"&&Vt.trim().toLowerCase()===mt)}),v.value.variants.some(function(Vt){return String(Vt)===String(re.id)})||v.value.variants.push(re.id)}}z.success(u("Term created successfully"))}m.value=!1,_.value=null,pa.value=""};return(re,ue)=>{var Ia;const De=B("router-link"),Le=B("el-tag"),Ke=B("el-option"),pt=B("el-select"),mt=B("el-button"),Vt=B("el-checkbox"),ea=B("el-dialog");return r(),h("div",AN,[o("div",pN,[c.value?(r(),h("div",fN,[(r(!0),h(O,null,ae(l.value.length||3,Gt=>(r(),h("div",{key:Gt,class:"fct-adv-var-loading-card"},ue[26]||(ue[26]=[o("span",{class:"fct-skel-block fct-adv-var-loading-handle"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-title"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-badge"},null,-1)])))),128))])):k("",!0),l.value.length===0&&!c.value&&a.value.length===0?(r(),h("div",mN,[R(f(A(u)("No attribute groups found."))+" ",1),n(De,{to:{name:"attributes"}},{default:d(()=>[R(f(A(u)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!c.value?(r(),h("div",hN,[o("span",_N,[n(ee,{name:"Information"})]),o("div",vN,[o("strong",null,f(A(u)("No options added yet.")),1),o("span",null,f(A(u)("Add options like Color, Size etc. to create variations.")),1)])])):k("",!0),l.value.length>0&&!c.value?(r(),$(A(Js),{key:3,modelValue:l.value,"onUpdate:modelValue":ue[22]||(ue[22]=Gt=>l.value=Gt),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:d(()=>[(r(!0),h(O,null,ae(l.value,(Gt,fa)=>(r(),h("div",{key:Gt.group_id||"new-"+fa,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===fa,onClick:Ba=>ie(fa),onKeydown:$a(Ne(Ba=>ie(fa),["prevent"]),["enter","space"])},[l.value.length>1?(r(),h("span",{key:0,class:"fct-option-drag-handle",onClick:ue[0]||(ue[0]=Ne(()=>{},["stop"]))},[n(ee,{name:"ReorderDotsVertical"})])):k("",!0),o("div",yN,[o("div",bN,[o("strong",null,f($t(Gt,fa)),1),Gt.group_id?(r(),$(Le,{key:0,size:"small",type:Nt(Gt.group_id),class:"fct-group-type-badge"},{default:d(()=>[R(f(yt(Gt.group_id)),1)]),_:2},1032,["type"])):k("",!0)]),ft(Gt).length?(r(),h("div",wN,[(r(!0),h(O,null,ae(ft(Gt),Ba=>(r(),h("span",{key:Ba.id,class:de(["fct-option-value-chip",`fct-option-value-chip--${vt(Gt.group_id)}`])},[vt(Gt.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:na({background:Ba.settings&&Ba.settings.color?Ba.settings.color:""})},null,4)):vt(Gt.group_id)==="image"&&Ba.settings&&Ba.settings.image?(r(),h("img",{key:1,src:Ba.settings.image,alt:Ba.title,class:"fct-option-value-img"},null,8,CN)):k("",!0),o("span",BN,f(Ba.title),1)],2))),128))])):k("",!0)]),p.value===fa?(r(),h("button",{key:1,type:"button",class:"fct-option-card-toggle fct-option-card-toggle--open","aria-label":A(u)("Done"),title:A(u)("Done"),onClick:Ne(Ba=>fe(fa),["stop"])},ue[27]||(ue[27]=[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M6 4l4 4-4 4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,kN)):k("",!0)],40,gN),n(_a,{accordion:"",visible:p.value===fa},{default:d(()=>{var Ba,We,Yt,Na;return[p.value===fa&&v.value?(r(),h("div",xN,[o("div",{class:de(["fct-option-field",{"fct-option-field--error":(Ba=v.value.errors)==null?void 0:Ba.name}])},[o("label",SN,f(A(u)("Option name")),1),n(pt,{modelValue:v.value.group_id,"onUpdate:modelValue":ue[1]||(ue[1]=Ge=>v.value.group_id=Ge),filterable:"","allow-create":et.value,"default-first-option":"","filter-method":le,"popper-class":"fct-option-name-select",placeholder:A(u)("Select or type a new option"),onChange:ue[2]||(ue[2]=Ge=>be(Ge)),onVisibleChange:me},{default:d(()=>[(r(!0),h(O,null,ae(Ue(fa),Ge=>(r(),$(Ke,{key:Ge.id,label:Ge.title,value:Ge.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?k("",!0):(r(),h("div",FN,[n(mt,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:Ge=>we(fa)},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(We=v.value.errors)!=null&&We.name?(r(),h("div",$N,[n(ee,{name:"AlertIcon"}),o("span",null,f(v.value.errors.name),1)])):k("",!0)],2),o("div",{class:de(["fct-option-field",{"fct-option-field--error":(Yt=v.value.errors)==null?void 0:Yt.values}])},[o("label",EN,f(A(u)("Option values")),1),vt(v.value.group_id)==="options"?(r(),$(pt,{key:0,ref_for:!0,ref:Fl,modelValue:v.value.variants,"onUpdate:modelValue":ue[8]||(ue[8]=Ge=>v.value.variants=Ge),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":Ye,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:Zt(v.value),disabled:!v.value.group_id,loading:E.value,"loading-text":A(u)("Loading..."),onChange:ue[9]||(ue[9]=Ge=>ve(Ge)),onVisibleChange:He},{tag:d(()=>[n(Yi,{modelValue:v.value.variants,"onUpdate:modelValue":ue[3]||(ue[3]=Ge=>v.value.variants=Ge),terms:Pe(v.value.group_id),type:vt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:d(()=>[Pe(v.value.group_id).length>0?(r(),h("div",UN,[n(Vt,{"model-value":ht.value,indeterminate:At.value,onChange:Ft},null,8,["model-value","indeterminate"]),o("span",null,f(A(u)("Select all")),1)])):k("",!0)]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:ue[7]||(ue[7]=Ne(()=>{},["self","prevent"]))},[ul.value?(r(),h("div",DN,[n(ho,{term:da.value,"group-type":"options","show-remove-button":!1,"validation-errors":qa.value,"field-key":"terms.0",onSubmit:Ge=>Rt(fa),onRemove:st},null,8,["term","validation-errors","onSubmit"]),o("div",VN,[n(mt,{type:"primary",size:"small",loading:_e.value,disabled:!da.value.title.trim()||_e.value,onClick:Ge=>Rt(fa)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(mt,{size:"small",onClick:st},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(O,{key:0},[aa.value.trim()&&!Pe(v.value.group_id).some(function(Ge){return Ge.title.toLowerCase()===aa.value.trim().toLowerCase()})?(r(),$(mt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ue[6]||(ue[6]=Ge=>te(aa.value))},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',aa.value.trim())),1)]),_:1})):k("",!0)],64))],32)]),default:d(()=>[(r(!0),h(O,null,ae(bt.value,Ge=>(r(),$(Ke,{key:Ge.id,label:Ge.title,value:Ge.id},{default:d(()=>[o("div",IN,[n(Vt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,Ge.id)}),tabindex:"-1",onClick:ue[4]||(ue[4]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(Ge.id)},null,8,["model-value","onChange"]),o("span",null,f(Ge.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(O,null,ae(wt.value,Ge=>(r(),$(Ke,{key:Ge,label:Ge,value:Ge},{default:d(()=>[o("div",QN,[n(Vt,{"model-value":!0,tabindex:"-1",onClick:ue[5]||(ue[5]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(Ge)},null,8,["onChange"]),o("span",null,f(Ge),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):vt(v.value.group_id)==="color"?(r(),h("div",TN,[n(pt,{ref_for:!0,ref:Ae,modelValue:v.value.variants,"onUpdate:modelValue":ue[15]||(ue[15]=Ge=>v.value.variants=Ge),multiple:"",filterable:"","filter-method":Y,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:Zt(v.value),disabled:!v.value.group_id,loading:E.value,"loading-text":A(u)("Loading..."),onKeydownCapture:Ge=>Re(Ge,fa),onVisibleChange:La},{empty:d(()=>[o("div",MN,f(A(u)("No matching data")),1)]),header:d(()=>[Pe(v.value.group_id).length>0?(r(),h("div",LN,[n(Vt,{"model-value":ht.value,indeterminate:At.value,onChange:Ft},null,8,["model-value","indeterminate"]),o("span",null,f(A(u)("Select all")),1)])):k("",!0)]),tag:d(()=>[n(Yi,{modelValue:v.value.variants,"onUpdate:modelValue":ue[10]||(ue[10]=Ge=>v.value.variants=Ge),terms:Pe(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:ue[14]||(ue[14]=Ne(()=>{},["self","prevent"]))},[ul.value?(r(),h("div",ON,[n(ho,{term:da.value,"group-type":"color","show-remove-button":!1,"validation-errors":qa.value,"field-key":"terms.0",onSubmit:Ge=>Rt(fa),onRemove:st},null,8,["term","validation-errors","onSubmit"]),o("div",HN,[n(mt,{type:"primary",size:"small",loading:_e.value,disabled:!da.value.title.trim()||_e.value,onClick:Ge=>Rt(fa)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(mt,{size:"small",onClick:st},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(O,{key:0},[Kt.value.trim()&&!se.value.some(function(Ge){return Ge.title.toLowerCase()===Kt.value.trim().toLowerCase()})?(r(),$(mt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ue[12]||(ue[12]=Ge=>ye())},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',Kt.value.trim())),1)]),_:1})):(r(),$(mt,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ue[13]||(ue[13]=Ge=>te(""))},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(O,null,ae(se.value,Ge=>(r(),$(Ke,{key:Ge.id,label:Ge.title,value:Ge.id},{default:d(()=>[o("div",RN,[n(Vt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,Ge.id)}),tabindex:"-1",onClick:ue[11]||(ue[11]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(Ge.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:na({background:Ge.settings&&Ge.settings.color?Ge.settings.color:""})},null,4),R(" "+f(Ge.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):vt(v.value.group_id)==="image"?(r(),h("div",PN,[n(pt,{ref_for:!0,ref:Ae,modelValue:v.value.variants,"onUpdate:modelValue":ue[21]||(ue[21]=Ge=>v.value.variants=Ge),multiple:"",filterable:"","filter-method":Y,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:Zt(v.value),disabled:!v.value.group_id,loading:E.value,"loading-text":A(u)("Loading..."),onKeydownCapture:Ge=>Re(Ge,fa),onVisibleChange:La},{empty:d(()=>[o("div",NN,f(A(u)("No matching data")),1)]),header:d(()=>[Pe(v.value.group_id).length>0?(r(),h("div",KN,[n(Vt,{"model-value":ht.value,indeterminate:At.value,onChange:Ft},null,8,["model-value","indeterminate"]),o("span",null,f(A(u)("Select all")),1)])):k("",!0)]),tag:d(()=>[n(Yi,{modelValue:v.value.variants,"onUpdate:modelValue":ue[16]||(ue[16]=Ge=>v.value.variants=Ge),terms:Pe(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:ue[20]||(ue[20]=Ne(()=>{},["self","prevent"]))},[ul.value?(r(),h("div",zN,[n(ho,{term:da.value,"group-type":"image","show-remove-button":!1,"validation-errors":qa.value,"field-key":"terms.0",onSubmit:Ge=>Rt(fa),onRemove:st},null,8,["term","validation-errors","onSubmit"]),o("div",qN,[n(mt,{type:"primary",size:"small",loading:_e.value,disabled:!da.value.title.trim()||_e.value,onClick:Ge=>Rt(fa)},{default:d(()=>[R(f(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(mt,{size:"small",onClick:st},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1})])])):(r(),h(O,{key:0},[Kt.value.trim()&&!se.value.some(function(Ge){return Ge.title.toLowerCase()===Kt.value.trim().toLowerCase()})?(r(),$(mt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ue[18]||(ue[18]=Ge=>te(Kt.value))},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)('Add "%1$s" as new value',Kt.value.trim())),1)]),_:1})):(r(),$(mt,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:ue[19]||(ue[19]=Ge=>te(""))},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(O,null,ae(se.value,Ge=>(r(),$(Ke,{key:Ge.id,label:Ge.title,value:Ge.id},{default:d(()=>[o("div",GN,[n(Vt,{"model-value":v.value.variants.some(function(Tt){return Ee(Tt,Ge.id)}),tabindex:"-1",onClick:ue[17]||(ue[17]=Ne(()=>{},["stop"])),onChange:Tt=>Mt(Ge.id)},null,8,["model-value","onChange"]),o("img",{src:Ge.settings&&Ge.settings.image?Ge.settings.image:"",alt:""},null,8,jN),R(" "+f(Ge.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):k("",!0),(Na=v.value.errors)!=null&&Na.values?(r(),h("div",YN,[n(ee,{name:"AlertIcon"}),o("span",null,f(v.value.errors.values),1)])):k("",!0)],2),o("div",WN,[n(mt,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:Ge=>X(fa)},{default:d(()=>[R(f(A(u)("Delete")),1)]),_:2},1032,["onClick"])])])):k("",!0)]}),_:2},1032,["visible"])]))),128))]),_:1},8,["modelValue","disabled"])):k("",!0),a.value.length>0?(r(),h("div",{key:4,class:de(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(mt,{class:de(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:q},{default:d(()=>[ue[28]||(ue[28]=o("svg",{fill:"currentColor",width:"14",height:"14",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},[o("path",{d:"M4.25 8a.75.75 0 0 1 .75-.75h2.25v-2.25a.75.75 0 0 1 1.5 0v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25h-2.25a.75.75 0 0 1-.75-.75"}),o("path",{"fill-rule":"evenodd",d:"M8 15a7 7 0 1 0 0-14 7 7 0 0 0 0 14m0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11"})],-1)),R(" "+f(l.value.length===0?A(u)("Add options like size or color"):A(u)("Add more")),1)]),_:1,__:[28]},8,["class"]),It.value>0?(r(),h("span",{key:0,class:"fct-adv-var-combinations-chip",title:A(u)("Variant combinations the current options will generate (max %1$s)",Ao)},f(A(u)("%1$s combinations",It.value)),9,XN)):k("",!0)],2)):k("",!0),(L.value||S.value)&&!i.value?(r(),h("div",JN,[o("span",ZN,f(U.value),1),o("div",eK,[n(mt,{size:"small",disabled:s.value,onClick:pe},{default:d(()=>[R(f(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(mt,{size:"small",type:"primary",loading:s.value,onClick:N},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading"])])])):k("",!0),Et.value||Ut.value||ct.value||Bt.value?(r(),h("div",tK,[Ut.value?(r(),h("div",aK,[o("span",null,f(A(u)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",Wi)),1)])):ct.value?(r(),h("div",lK,[o("span",null,f(A(u)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Et.value?(r(),h("div",sK,[o("span",null,f(A(u)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",Dt.value,Ao)),1)])):Bt.value?(r(),h("div",nK,[o("span",null,f(A(u)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",Xi)),1)])):k("",!0)])):k("",!0)]),l.value.some(Gt=>Gt.group_id&&Gt.variants&&Gt.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&((Ia=e.product.detail)==null?void 0:Ia.variation_type)==="advanced_variations"?(r(),$(nN,{key:0,product:e.product,productEditModel:e.productEditModel,attributeGroups:a.value,"external-busy":i.value||s.value||c.value},null,8,["product","productEditModel","attributeGroups","external-busy"])):k("",!0),n(ea,{"append-to-body":!0,modelValue:m.value,"onUpdate:modelValue":ue[23]||(ue[23]=Gt=>m.value=Gt),title:A(u)("Add new attribute term"),onClose:ue[24]||(ue[24]=Gt=>pa.value="")},{default:d(()=>[m.value&&_.value!==null&&v.value?(r(),$(cN,{key:0,"group-id":v.value.group_id,group:a.value.find(Gt=>Ee(Gt.id,v.value.group_id)),"initial-title":pa.value,onIsTermCreatingDone:Ie},null,8,["group-id","group","initial-title"])):k("",!0)]),_:1},8,["modelValue","title"]),n(ea,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":ue[25]||(ue[25]=Gt=>g.value=Gt),title:A(u)("Add new attribute group")},{default:d(()=>[g.value?(r(),$(Xf,{key:0,onWhenGroupCreateIsDone:Be})):k("",!0)]),_:1},8,["modelValue","title"])])}}},iK={class:"fct-product-pricing-wrap"},rK={class:"w-[150px] fct-select-gray"},dK={key:1,class:"fct-simple-product-actions"},uK={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,m;const t=e;V(!1);const a=V((m=(p=t.product)==null?void 0:p.detail)==null?void 0:m.variation_type),l=V(null),s=_=>{var v;const g=t.product.detail.variation_type,y=((v=t.product.variants)==null?void 0:v.length)??0;if(_==="advanced_variations"&&g==="simple_variations"){l.value=_,a.value=g,Fn.confirmDeleteWithInput("proceed",u("Switching to Advanced Variations will delete all current variations for this product and cannot be undone. You won't be able to switch back to Simple Variations.")).then(()=>{i()}).catch(()=>{l.value||(l.value=null)});return}_==="simple"&&g==="simple_variations"&&y>1?(l.value=_,a.value=g,Fn.confirmDeleteWithInput("proceed",u("Switching to 'Simple' will permanently delete all variations except the first one.")).then(()=>{i()}).catch(()=>{l.value||(l.value=null)})):c(_)},i=()=>{l.value&&c(l.value),l.value=null},c=_=>{const g=t.product.detail.variation_type;a.value=_;const y=t.productEditModel.updateVariationType("variation_type",_);Promise.resolve(y).catch(()=>{a.value=g})};return(_,g)=>{var C,b;const y=B("el-option"),v=B("el-select");return r(),h("div",iK,[n(xe,{class:de(((b=(C=e.product)==null?void 0:C.detail)==null?void 0:b.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var w,x;return[n(Ve,{title:_.$t("Pricing"),border_bottom:""},{action:d(()=>[o("div",rK,[e.product.detail?(r(),$(v,{key:0,size:"small",class:de(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=F=>a.value=F),placeholder:_.$t("Select Variation"),onChange:s},{default:d(()=>[(r(!0),h(O,null,ae(_.appVars.variation_types,(F,L)=>{var U,S;return r(),$(y,{key:L,label:F,value:L,disabled:((S=(U=e.product)==null?void 0:U.detail)==null?void 0:S.variation_type)==="advanced_variations"&&L!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):k("",!0)])]),_:1},8,["title"]),n(ke,{class:de(((x=(w=e.product)==null?void 0:w.detail)==null?void 0:x.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var F,L,U,S,M,I,T,Q,E,D,H,P,G,J,oe,Z,W;return[((L=(F=e.product)==null?void 0:F.detail)==null?void 0:L.variation_type)==="simple"?(r(),$(Bd,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):k("",!0),((S=(U=e.product)==null?void 0:U.detail)==null?void 0:S.variation_type)==="simple"&&((I=(M=e.product)==null?void 0:M.variants[0])!=null&&I.id)?(r(),h("div",dK,[n(Fa,{class:"fct-copy-wrap-inline",text:String(e.product.variants[0].id),showMode:"icon_with_text",buttonText:_.$t("Copy Variation ID")},null,8,["text","buttonText"]),((Q=(T=e.product)==null?void 0:T.detail)==null?void 0:Q.variation_type)==="simple"&&(((E=e.product)==null?void 0:E.post_status)==="publish"||((D=e.product)==null?void 0:D.post_status)==="private")&&((P=(H=e.product)==null?void 0:H.variants[0])!=null&&P.id)?(r(),$(Fa,{key:0,class:"fct-copy-wrap-inline mt-3",text:((G=_.appVars)==null?void 0:G.frontend_url)+"=instant_checkout&item_id="+e.product.variants[0].id+"&quantity=1",showMode:"icon_with_text",placement:"top",buttonText:_.$t("Direct Checkout"),tooltipContent:_.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):k("",!0)])):k("",!0),((oe=(J=e.product)==null?void 0:J.detail)==null?void 0:oe.variation_type)==="simple_variations"?(r(),$(cO,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):k("",!0),((W=(Z=e.product)==null?void 0:Z.detail)==null?void 0:W.variation_type)==="advanced_variations"?(r(),$(oK,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):k("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},cK={class:"fct-sku-input-wrap"},AK={class:"fct-sku-edit-actions"},Xu={__name:"SkuInput",props:{variant:{type:Object,required:!0},productTitle:{type:String,default:""}},emits:["saved"],setup(e,{emit:t}){const a=e,l=t,s=V(a.variant.sku||""),i=V(a.variant.sku||""),c=V(!1),p=V(!1),m=V(!1),_=()=>{c.value=!0},g=()=>{i.value=s.value,c.value=!1},y=()=>{p.value=!0,ce.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(C=>{s.value=i.value,l("saved",i.value),c.value=!1,z.success(C.message)}).catch(C=>{var b;C.status_code=="422"?z.validationErrors(C):z.error((b=C.data)==null?void 0:b.message)}).finally(()=>{p.value=!1})},v=()=>{m.value=!0,ce.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(C=>{i.value=C.sku,c.value=!0}).catch(C=>{var b;z.error((b=C.data)==null?void 0:b.message)}).finally(()=>{m.value=!1})};return(C,b)=>{const w=B("el-input"),x=B("el-button");return r(),h("div",cK,[n(w,{modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=F=>i.value=F),size:"small",placeholder:A(u)("No SKU"),onInput:_,onKeydown:[b[1]||(b[1]=$a(Ne(F=>c.value&&y(),["prevent"]),["enter"])),$a(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",AK,[c.value?(r(),h(O,{key:0},[n(x,{size:"small",type:"primary",title:A(u)("Save SKU"),"aria-label":A(u)("Save SKU"),loading:p.value,onClick:y},{default:d(()=>[n(ee,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),n(x,{size:"small",type:"danger",title:A(u)("Discard changes"),"aria-label":A(u)("Discard changes"),onClick:g},{default:d(()=>[n(ee,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),$(x,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:m.value,title:A(u)("Generate SKU"),onClick:v},{default:d(()=>[n(ee,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},pK={key:0,class:"fct-product-inventory-wrap"},fK={class:"fct-product-inventory-inner-wrap hide-on-mobile"},mK={key:0,class:"fct-variant-badge fct-variant-badge--light"},hK={class:"fct-inventory-cell-text pl-5"},_K={class:"fct-inventory-cell-text pl-5"},vK={class:"fct-inventory-cell-text pl-5"},gK={class:"fct-product-inventory-inner-wrap-mobile"},yK={class:"fct-product-inventory-mobile-col"},bK={class:"title"},wK={class:"fct-product-inventory-mobile-col"},CK={class:"fct-product-inventory-mobile-col"},BK={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=ze.get("modules_settings.stock_management.active"),s=V([]),i=V({}),c=(y,v)=>{y&&(i.value[v]=y.scrollWidth>y.clientWidth)};Qe(()=>{a.product.variants.forEach(y=>{y.new_stock=y.total_stock,y.adjusted_quantity=0})});const p=y=>a.product.detail.variation_type==="simple_variations"&&y.row.manage_stock==0?"disable_inventory_row":"",m=y=>a.product.detail.variation_type==="simple_variations"&&y.manage_stock==0?"disable_inventory_row":"",_=y=>{let v=parseInt(a.product.variants[y].new_stock);a.product.variants[y].total_stock=v<0?0:v;let C=parseInt(a.product.variants[y].total_stock)-parseInt(a.product.variants[y].committed)-parseInt(a.product.variants[y].on_hold);a.product.variants[y].available=C<0?0:C,a.product.variants[y].adjusted_quantity=0,a.product.variants[y].new_stock=a.product.variants[y].total_stock,ce.put(`products/${a.product.ID}/update-inventory/${a.product.variants[y].id}`,{total_stock:a.product.variants[y].total_stock,available:a.product.variants[y].available}).then(b=>{z.success(b.message)}).catch(b=>{var w;b.status_code=="422"?z.validationErrors(b):z.error((w=b.data)==null?void 0:w.message)})},g=y=>{ce.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{z.success(v.message),a.product.variants.forEach(C=>{C.manage_stock=y})}).catch(v=>{var C;v.status_code=="422"?z.validationErrors(v):z.error((C=v.data)==null?void 0:C.message)})};return(y,v)=>{const C=B("el-switch"),b=B("el-tooltip"),w=B("el-table-column"),x=B("el-input"),F=B("el-table");return A(l)==="yes"?(r(),h("div",pK,[n(xe,{class:"overflow-hidden"},{default:d(()=>{var L,U;return[n(Ve,{class:de(((L=e.product.detail)==null?void 0:L.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var S;return[(S=e.product.detail)!=null&&S.manage_stock?(r(),$(C,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=M=>e.product.detail.manage_stock=M),onChange:g,"active-value":"1","inactive-value":"0","active-text":A(u)("Inventory Management")},null,8,["modelValue","active-text"])):k("",!0)]}),_:1},8,["class"]),n(_a,{visible:((U=e.product.detail)==null?void 0:U.manage_stock.toString())==="1",accordion:""},{default:d(()=>[n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",fK,[n(F,{data:e.product.variants,"row-class-name":p},{default:d(()=>[n(w,{label:A(u)("Title"),width:"180"},{default:d(S=>{var M,I;return[o("div",{class:de(["relative",{"fct-inventory-title-cell--has-badge":((M=S.row.other_info)==null?void 0:M.payment_type)==="subscription"}])},[n(b,{content:S.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${S.$index}`]},{default:d(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:T=>c(T,`title_${S.$index}`)},f(S.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((I=S.row.other_info)==null?void 0:I.payment_type)==="subscription"?(r(),h("span",mK,f(S.row.other_info.repeat_interval),1)):k("",!0)],2)]}),_:1},8,["label"]),n(w,{label:A(u)("SKU"),width:"220"},{default:d(S=>[n(Xu,{variant:S.row,"product-title":e.product.post_title,onSaved:M=>S.row.sku=M},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(w,{label:A(u)("Total Stock"),width:"120"},{default:d(S=>[o("div",null,[n(x,{modelValue:S.row.total_stock,"onUpdate:modelValue":M=>S.row.total_stock=M,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:M=>{var I;return(I=s.value[S.$index])==null?void 0:I.toggle()}},{append:d(()=>[n(Ir,{ref:M=>s.value[S.$index]=M,variant:S.row,"field-key":S.$index,"product-edit-model":e.productEditModel,onSave:M=>_(S.$index),onClick:v[1]||(v[1]=Ne(()=>{},["stop"]))},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue","onClick"])])]),_:1},8,["label"]),n(w,{label:A(u)("Available"),width:"100"},{default:d(S=>[o("span",hK,f(A(u)(S.row.available)),1)]),_:1},8,["label"]),n(w,{label:A(u)("On hold"),width:"100"},{default:d(S=>[o("span",_K,f(A(u)(S.row.on_hold)),1)]),_:1},8,["label"]),n(w,{label:A(u)("Delivered"),width:"100"},{default:d(S=>[o("span",vK,f(A(u)(S.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",gK,[(r(!0),h(O,null,ae(e.product.variants,(S,M)=>(r(),h("div",{key:M,class:de(["fct-product-inventory-mobile-row",m(S)])},[o("div",yK,[o("div",bK,f(S.variation_title||"--"),1),n(Xu,{variant:S,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:I=>S.sku=I},null,8,["variant","product-title","onSaved"])]),o("div",wK,[n(x,{modelValue:S.total_stock,"onUpdate:modelValue":I=>S.total_stock=I,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Ir,{variant:S,"field-key":M,"product-edit-model":e.productEditModel,onSave:I=>_(M)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",CK,[o("ul",null,[o("li",null,[o("span",null,f(A(u)("Available"))+":",1),R(" "+f(S.available.toString()),1)]),o("li",null,[o("span",null,f(A(u)("On Hold"))+":",1),R(" "+f(S.on_hold.toString()),1)]),o("li",null,[o("span",null,f(A(u)("Delivered"))+":",1),R(" "+f(S.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):k("",!0)}}},kK={class:"el-form el-form--default el-form--label-top"},Qp={__name:"SingleFileForm",props:{product:Object,file:Object,index:Number,productDownloadableModel:Object,singleMode:{type:Boolean,default:!1},isEditing:{type:Boolean,default:!1}},setup(e){const t=e,a=K(()=>Oo(t.product));return Ss(()=>{var l;if(t.file&&typeof t.file.product_variation_id=="string")try{t.file.product_variation_id=JSON.parse(t.file.product_variation_id),t.file.product_variation_id=t.file.product_variation_id.map(s=>parseInt(s))}catch{}if(t.file&&Array.isArray(t.file.product_variation_id)&&((l=t.product)!=null&&l.variants)){const s=Array.isArray(t.product.variants)?t.product.variants:[],i=new Set(s.map(p=>parseInt(p.id,10))),c=t.file.product_variation_id.filter(p=>i.has(parseInt(p,10)));c.length!==t.file.product_variation_id.length&&(t.file.product_variation_id=c)}}),(l,s)=>{const i=B("el-option"),c=B("el-select"),p=B("el-form-item"),m=B("el-input");return r(),h("div",kK,[n(p,{label:l.$t("Choose variant")},{default:d(()=>[n(c,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":s[0]||(s[0]=_=>e.file.product_variation_id=_),multiple:"",id:`downloadable_files.${e.index}.product_variation_id`,placeholder:l.$t("Keep empty for all"),"popper-class":"fct-choose-variant-popover","collapse-tags":"","collapse-tags-tooltip":""},{default:d(()=>[(r(!0),h(O,null,ae(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),$(i,{key:_.id,label:A(Qn)(_,a.value),value:_.id},{default:d(()=>[n(Ho,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),n(la,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.product_variation_id`},null,8,["validation-errors","field-key"])]),_:1},8,["label"]),e.isEditing||e.productDownloadableModel.insertableFiles.length===1?(r(),$(p,{key:0},{default:d(()=>[n(Pc,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const g=e.index,y=_;y.forEach((v,C)=>{e.isEditing?(y[C].serial=g+1,y[C].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[C].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[C].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[C]):(y[C].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[C].file_name,e.file.file_path=y[C].file_path,e.file.file_size=y[C].file_size,e.file.file_url=y[C].file_url,e.file.title=y[C].title,e.file.type=y[C].type,e.file.settings=y[C].settings)):(y[C].serial=g+1,y[C].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[C].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[C].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+C]=y[C]):(y[C].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[C]))})})},null,8,["isMultiple"]),n(la,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):k("",!0),e.file.title?(r(),$(p,{key:1,label:l.$t("File Title")},{default:d(()=>[o("p",null,f(e.file.title),1),k("",!0),n(la,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):k("",!0),e.file.driver?(r(),$(p,{key:2},{default:d(()=>[o("p",null,f(A(u)("Driver: %s",e.file.driver)),1)]),_:1})):k("",!0)])}}},xK={key:0,class:"text-right"},SK={key:1,class:"px-6 py-3"},FK={class:"fct-product-download-inner-wrap flex flex-col gap-4"},$K={class:"fct-product-download-form-box"},EK={key:1},UK={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=K(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=B("el-button"),i=B("el-drawer");return r(),h(O,null,[o("div",{class:de(["add-download-btn",e.productDownloadableModel.hasVariationOption(e.product)?"px-6 py-3 border border-solid border-gray-divider border-x-0 border-b-0 dark:border-dark-400":""])},[e.productDownloadableModel.hasVariationOption(e.product)?(r(),h("div",xK,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(a.$t("Add")),1)]),_:1})])):(r(),h("div",SK,f(a.$t("No pricing added yet")),1))],2),n(i,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":l[4]||(l[4]=c=>e.productDownloadableModel.data.addModal.isModalOpen=c),size:t.value,onClose:l[5]||(l[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:l[6]||(l[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:d(()=>[n(ca,{title:a.$t("Add Downloadable Asset(s)"),content:a.$t("Attach the WordPress-supported digital files that customers will receive after purchasing this product. If this downloadable file is only for a specific product variation (e.g., 'eBook Version' or 'Audiobook Version'), please select that variant. Otherwise, you may leave the 'Choose variant' field empty to make the file available for all variants of this product. Please note that any additional files added after any sell will be accessible to both existing and new orders."),placement:"bottom"},null,8,["title","content"])]),footer:d(()=>[o("div",null,[n(s,{onClick:l[2]||(l[2]=c=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:d(()=>[R(f(a.$t("Cancel")),1)]),_:1}),n(s,{type:"primary",onClick:l[3]||(l[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:d(()=>[R(f(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:d(()=>[o("div",FK,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(O,{key:0},ae(e.productDownloadableModel.insertableFiles,(c,p)=>(r(),h("div",$K,[e.productDownloadableModel.insertableFiles.length>1?(r(),$(s,{key:0,onClick:m=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])):k("",!0),n(Qp,{product:e.product,file:c,index:p,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):k("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),h("div",EK,[n(Pc,{uploadBtnText:A(u)("Add More Files"),onOnFileSelected:l[1]||(l[1]=c=>{const p=e.productDownloadableModel.insertableFiles.length-1,m=c;m.value.forEach((_,g)=>{m.value[g].serial=p+1,m.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,m.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,m.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(m.value[g])})})},null,8,["uploadBtnText"])])):k("",!0),(r(!0),h(O,null,ae(e.product.variants,(c,p)=>(r(),h("div",{key:p},[n(la,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},IK={class:"fct-product-download-form-wrap"},QK={class:"fct-product-download-form-box"},DK={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=K(()=>window.innerWidth<=768?"90%":"40%"),l=V({...t.productDownloadable}),s=t.productDownloadableModel.data.editModal.states;return Ss(()=>{s[t.index]={},s[t.index].visible=!1}),(i,c)=>{const p=B("el-button"),m=B("el-drawer");return r(),h(O,null,[n(m,{"append-to-body":"",modelValue:A(s)[e.index].visible,"onUpdate:modelValue":c[1]||(c[1]=_=>A(s)[e.index].visible=_),size:a.value,title:A(u)("Edit Downloadable Asset"),onClose:c[2]||(c[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:d(()=>[n(p,{type:"primary",loading:e.productDownloadableModel.saving,onClick:c[0]||(c[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:d(()=>[R(f(A(u)("Update")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",IK,[o("div",QK,[n(Qp,{product:e.product,file:l.value,index:e.index,productDownloadableModel:e.productDownloadableModel,singleMode:!0,"is-editing":""},null,8,["product","file","index","productDownloadableModel"])])])]),_:1},8,["modelValue","size","title"]),o("div",{class:"el-dropdown-menu__item w-full",onClick:c[3]||(c[3]=Ne(()=>{A(s)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,l.value)},["prevent"]))},[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)])],64)}}},VK={class:"fct-product-download-wrap"},TK={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},MK={class:"fct-media-content-list"},LK={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},RK={class:"product-details"},OK={class:"product-details-content-row"},HK={class:"product-details-content-first"},PK={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},NK={key:0,class:"font-normal text-system-mid"},KK={class:"product-variation-title inline-flex"},GK={key:1,class:"product-variation-title"},jK={class:"product-details-content-second"},zK={class:"more-btn"},qK={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(s){ce.get(`products/getDownloadableUrl/${s.id}`).then(i=>{Yl.copy(i.url)}).catch(i=>{z.error({title:u("Error"),message:u("Failed to copy file URL")})})},l=s=>{s.action==="copy-download-link"?a(s.data):s.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(s.data.id,s.idx)};return(s,i)=>{const c=B("el-switch"),p=B("el-popover"),m=B("el-dropdown-item"),_=B("el-dropdown-menu"),g=B("el-dropdown");return r(),h("div",VK,[n(xe,null,{default:d(()=>{var y;return[n(Ve,{class:"pb-5"},{action:d(()=>[e.product.detail?(r(),$(c,{key:0,modelValue:e.product.detail.manage_downloadable,"onUpdate:modelValue":i[0]||(i[0]=v=>e.product.detail.manage_downloadable=v),"active-value":"1","inactive-value":"0","active-text":s.$t("Downloadable Asset(s)"),onChange:i[1]||(i[1]=v=>{(v.toString()==="0"||e.productDownloadableModel.hasDownloadableFiles())&&e.productEditModel.setHasChange(!0)})},null,8,["modelValue","active-text"])):k("",!0)]),_:1}),n(_a,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:d(()=>[n(ke,{class:"p-0"},{default:d(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",TK,[o("div",MK,[(r(!0),h(O,null,ae(e.productDownloadableModel.downloadableFiles,(v,C)=>(r(),h("div",{class:"fct-media-content-list-item",key:C},[o("div",LK,f(v.type),1),o("div",RK,[o("div",OK,[o("div",HK,[o("div",PK,[R(f(v.title)+" ",1),v.driver!=="local"?(r(),h("span",NK," - "+f(v.driver),1)):k("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),$(p,{key:0,placement:"top",trigger:"hover",width:200},{reference:d(()=>[o("div",KK," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:d(()=>[(r(!0),h(O,null,ae(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(b,w)=>(r(),h("div",{style:{"margin-top":"4px"},key:w},f(b),1))),128))]),_:2},1024)):(r(),h("div",GK," – "+f(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",jK,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:d(()=>[n(_,null,{default:d(()=>[n(m,{class:"item-link"},{default:d(()=>[n(DK,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:C},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(m,{command:{action:"copy-download-link",data:v}},{default:d(()=>[n(ee,{name:"Copy"}),R(" "+f(A(u)("Copy Download Link")),1)]),_:2},1032,["command"]),n(m,{command:{action:"delete",data:v,idx:C},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",zK,[n(ee,{name:"More"})])]),_:2},1024)])])])]))),128))])])):k("",!0),n(UK,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},YK={class:"fct-product-status-wrap"},WK={class:"fct-admin-summary-item-list"},XK={class:"fct-admin-summary-item"},JK={class:"fct-admin-summary-item-title"},ZK={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},eG={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},tG={key:0,style:{"margin-top":"20px"}},aG={class:"title"},lG={key:1},sG={class:"text-sm text-gray-500 mt-4"},nG={class:"capitalize"},oG={key:1},iG={class:"fct-admin-summary-item"},rG={class:"fct-admin-summary-item-title flex items-center gap-1"},dG=["href"],uG={class:"fct-product-url-slug-container"},cG={class:"filter-popover-item fct-admin-summary-popover-item"},AG={class:"filter-popover-title"},pG={class:"filter-popover-input-group"},fG={class:"fct-product-url-label"},mG=["href"],hG={class:"fct-product-url-slug"},_G={key:0,class:"fct-admin-summary-item"},vG={class:"fct-admin-summary-item-title"},gG={class:"fct-admin-summary-item-select"},yG={key:1,class:"fct-admin-summary-item"},bG={class:"fct-admin-summary-item-title"},wG={key:0,class:"fct-admin-summary-item-select"},CG={key:0,class:"mt-4 pt-4"},Ju={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V(""),l=V(""),s=V(""),i=V(!1),c=v=>Qn(v,Oo(t.product))||v.variation_title;Ce(()=>{var v,C,b;return[(C=(v=t.product)==null?void 0:v.detail)==null?void 0:C.default_variation_id,(b=t.product)==null?void 0:b.variants]},([v,C])=>{var x;if(!v||!((x=t.product)!=null&&x.detail))return;(Array.isArray(C)?C:[]).some(F=>String(F.id)===String(v))||(t.product.detail.default_variation_id="",t.productEditModel&&typeof t.productEditModel.onChangeInputField=="function"&&t.productEditModel.onChangeInputField("default_variation_id",""))},{immediate:!0,deep:!1});const p=u("Customize the product's URL ending. Remember, this will affect SEO and readability. The URL will be activated when publish. Check Google's %s Structure Best Practices.",'<a href="https://developers.google.com/search/docs/crawling-indexing/url-structure">'+u("URL")+"</a>"),m=()=>t.product.variants.filter(C=>C.created_at).length>0,_=v=>{t.productEditModel.onChangeInputField("post_status",v),(v==="draft"||v==="publish")&&(i.value=!1)},g=()=>u("Status controls the product's visibility on the public page and its purchasability. 'Publish' indicates that it is live and can be purchased, 'Draft' signifies that it is in private editing, and 'Schedule' means it will be publish on a specified date. 'Private' means, Only visible to adminstrators but can be purchased via direct purchase link. The status can only be changed once pricing is set."),y={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no"};return Ce(()=>t.product.detail,v=>{v&&(!v.other_info||Object.keys(v.other_info).length===0)&&(t.product.detail.other_info={...y})},{immediate:!0}),Qe(()=>{a.value=window.location.protocol,l.value=window.location.hostname,s.value=`${a.value}//${l.value}`}),(v,C)=>{const b=B("el-radio"),w=B("el-radio-group"),x=B("el-date-picker"),F=B("el-button"),L=B("el-popover"),U=B("el-input"),S=B("el-option"),M=B("el-select"),I=B("el-checkbox");return r(),h("div",YK,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>{var T,Q;return[o("ul",WK,[o("li",XK,[o("span",JK,[n(ca,{title:A(u)("Status"),content:g()},null,8,["title","content"])]),o("div",ZK,[m()?(r(),$(L,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[m()?(r(),$(F,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",nG,f(e.product.post_status==="future"?A(u)("Scheduled"):e.product.post_status),1),n(ee,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",oG,f(A(oa).headline(e.product.post_status)),1))]),default:d(()=>[o("div",eG,[n(w,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":C[0]||(C[0]=E=>e.product.post_status=E),onChange:_},{default:d(()=>[n(b,{value:"draft"},{default:d(()=>[R(f(A(u)("Draft")),1)]),_:1}),n(b,{value:"future"},{default:d(()=>[R(f(A(u)("Scheduled")),1)]),_:1}),n(b,{value:"private"},{default:d(()=>[R(f(A(u)("Private (Invisible except Admin)")),1)]),_:1}),n(b,{value:"publish"},{default:d(()=>[R(f(A(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",tG,[o("h3",aG,f(A(u)("Scheduled Date")),1),n(x,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":C[1]||(C[1]=E=>e.product.post_date=E),type:"datetime",placeholder:A(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:C[2]||(C[2]=E=>{e.productEditModel.onChangeInputField("post_date",E)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",lG,[o("p",sG,f(A(u)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):k("",!0)])]),_:1})):k("",!0)])]),o("li",iG,[o("span",rG,[R(f(A(u)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[n(ee,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,dG)]),o("div",uG,[n(L,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:d(()=>[n(F,{type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",null,f(e.product.post_name),1),n(ee,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[o("div",cG,[o("h3",AG,f(A(u)("URL")),1),o("div",pG,[n(ca,{title:A(u)("Permalink"),content:A(p),hideAfter:300},null,8,["title","content"]),n(U,{placeholder:A(u)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":C[3]||(C[3]=E=>e.product.post_name=E),onInput:C[4]||(C[4]=E=>{e.productEditModel.onChangeInputField("post_name",E)})},null,8,["placeholder","modelValue"])]),o("div",fG,f(A(u)("View Product")),1),o("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[o("span",hG,f(e.product.view_url),1),n(Fa,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:A(u)("Copy Link")},null,8,["text","tooltipText"])],8,mG)])]),_:1})])]),((T=e.product.detail)==null?void 0:T.variation_type)==="simple_variations"||((Q=e.product.detail)==null?void 0:Q.variation_type)==="advanced_variations"?(r(),h("li",_G,[o("span",vG,[n(ca,{title:A(u)("Default Variant"),content:A(u)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),o("div",gG,[n(M,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":C[5]||(C[5]=E=>e.product.detail.default_variation_id=E),placeholder:A(u)("Select Default Variant"),onChange:C[6]||(C[6]=E=>{e.productEditModel.onChangeInputField("default_variation_id",E)}),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(e.product.variants,E=>(r(),$(S,{key:E.id,label:c(E),value:E.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):k("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),h("li",yG,[o("span",bG,[n(ca,{title:A(u)("Pricing Table Layout"),content:A(u)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),h("div",wG,[n(M,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":C[7]||(C[7]=E=>e.product.detail.other_info.group_pricing_by=E),placeholder:A(u)("Pricing Table Layout"),onChange:C[8]||(C[8]=E=>{e.productEditModel.onChangeInputField("group_pricing_by",E)})},{default:d(()=>[n(S,{label:A(u)("Payment Term"),value:"payment_type"},null,8,["label"]),n(S,{label:A(u)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(S,{label:A(u)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):k("",!0)])):k("",!0)]),e.product.detail?(r(),h("div",CG,[n(I,{onChange:C[9]||(C[9]=E=>{e.productEditModel.onChangeInputField("sold_individually",E)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":C[10]||(C[10]=E=>e.product.detail.other_info.sold_individually=E),"true-value":"yes","false-value":"no"},{default:d(()=>[R(f(A(u)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):k("",!0)]}),_:1})]),_:1})])}}},BG={class:"fct-product-media-wrap"},kG={class:"fct-admin-summary-item"},Zu={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",BG,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",kG,[n(hl,{modelValue:e.product.gallery,"onUpdate:modelValue":a[0]||(a[0]=l=>e.product.gallery=l),compact:!1,title:t.$t("Product Gallery"),onChange:a[1]||(a[1]=l=>e.productEditModel.updateMedia("gallery",l))},null,8,["modelValue","title"])])]),_:1})]),_:1})]))}},xG={class:"fct-term-input-item"},SG={class:"el-tag__content"},FG=["innerHTML"],$G=["innerHTML"],EG={class:"pt-1.5 text-right"},UG={class:"relative w-3 h-3"},IG={class:"fct-term-add-input-wrap"},QG={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){zt().ctx;const a=e,l=t,s=V([]),i=V(!1),c=V(),p=V(""),m=V([]),_=V(""),g=V(!1);Qe(()=>{s.value=a.modelValue,m.value=a.taxonomy.terms,Ce(()=>a.taxonomy.terms,(M,I)=>{m.value=M}),Ce(()=>a.modelValue,(M,I)=>{g.value=!0,s.value=M})});const y=M=>{M.stopPropagation(),M.preventDefault(),x()},v=()=>{g.value&&ce.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(M=>{z.success(M.message),l("update:modelValue",s.value)}).catch(M=>{var I;M.status_code=="422"?z.validationErrors(M):z.error((I=M.data)==null?void 0:I.message)}).finally(()=>{g.value=!1})},C=ed.debounce(M=>{w(M)},1200),b=()=>{l("update:modelValue",s.value)},w=M=>{g.value=!1,ce.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:M}).then(I=>{Xs(I.message),l("update:modelValue",s.value)}).catch(I=>{var T;I.status_code=="422"?z.validationErrors(I):z.error((T=I.data)==null?void 0:T.message)}).finally(()=>{g.value=!1})};[...s.value];const x=()=>{g.value=!0,ce.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(M=>{i.value=!1,p.value="",M.term_ids.forEach(function(I,T){m.value.push({value:I,label:M.names[T]}),s.value.push(I)}),v()}).catch(M=>{})},F=()=>{i.value=!i.value,i.value&&Se(()=>{c.value.focus()})},L={categories:"Category",types:"Type"};K(()=>{let M=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(L).forEach(I=>{M.toLowerCase().includes(I)&&(M=M.replace(new RegExp(I,"i"),L[I]))}),M});const U=M=>{const I=s.value.indexOf(M);I>-1&&s.value.splice(I,1),g.value=!1,C(M)},S=M=>{const I=T=>{for(const Q of T){if(Q.value==M)return Q.label;if(Q.children&&Q.children.length>0){const E=I(Q.children);if(E)return E}}return null};return I(m.value)};return(M,I)=>{const T=B("el-tag"),Q=B("el-tree-select"),E=B("el-button"),D=B("el-input");return r(),h("div",xG,[n(Q,{modelValue:s.value,"onUpdate:modelValue":I[0]||(I[0]=H=>s.value=H),data:m.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:I[1]||(I[1]=()=>{g.value=!0}),onBlur:v,onChange:b,onRemoveTag:I[2]||(I[2]=H=>{g.value=!1,A(C)(H)})},{tag:d(()=>[(r(!0),h(O,null,ae(s.value,(H,P)=>(r(),$(T,{key:P,closable:"",onClose:G=>U(H)},{default:d(()=>[o("span",SG,[o("span",{class:"el-select__tags-text",innerHTML:S(H)},null,8,FG)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:H})=>[o("span",{innerHTML:H.label},null,8,$G)]),_:1},8,["modelValue","data"]),o("div",EG,[n(E,{text:"",onClick:F,size:"small"},{default:d(()=>[o("span",UG,[n(_a,{visible:i.value,fade:""},{default:d(()=>[n(ee,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(_a,{visible:!i.value,fade:""},{default:d(()=>[n(ee,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+f(A(u)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),n(_a,{visible:i.value,accordion:""},{default:d(()=>[o("div",IG,[n(D,{modelValue:p.value,"onUpdate:modelValue":I[3]||(I[3]=H=>p.value=H),ref_key:"inputRef",ref:c,onKeydown:$a(y,["enter"])},null,8,["modelValue"]),n(E,{type:"info",plain:"",onClick:x,class:"el-button--x-small"},{default:d(()=>[R(f(A(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},DG={class:"fct-product-simple-wrap"},VG={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",DG,[n(xe,null,{default:d(()=>[n(Ve,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[(r(!0),h(O,null,ae(e.product.taxonomies,l=>(r(),h("div",{class:"fct-admin-summary-item",key:l.id},[o("h4",null,f(l.labels.name),1),n(QG,{product_id:e.product.ID,taxonomy:l,modelValue:e.product.product_terms[l.name],"onUpdate:modelValue":s=>e.product.product_terms[l.name]=s},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class TG extends sl{constructor(){super(...arguments);Oe(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Oe(this,"generateDownloadableVariationName",(a,l)=>{if(!a)return u("For all variants");let s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{}else typeof a=="object"&&(s=Object.values(a));if(s.length===0)return u("For all variants");const i=Oo(l),c=l.variants.reduce((m,_)=>(m[_.id]=Qn(_,i),m),{}),p=s.map(m=>c[m]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});Oe(this,"deleteDownloadableFile",(a,l)=>{Fn.ofDelete(u("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{ce.delete(`products/${a}/delete`).then(()=>{z.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{z.error(u("Failed To Delete"))})}).catch(()=>{})});Oe(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(l=>Object.values(l).every(s=>s!=null&&s!=="")),Object.values(this.generateVariantOptions(a)).forEach(l=>{l.id>0&&this.addDummyInsertableFile(l.id)})});Oe(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Oe(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Oe(this,"attachInsertableFiles",a=>{this.setSaving(!0),ce.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(l=>{this.setDownloadableFiles(l.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),z.success(u("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):z.error(u("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Oe(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Oe(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Oe(this,"openEditModal",(a,l)=>{this.data.editModal.isCurrentlyEditing=!0,this.data.editModal.states[a].visible=!0,this.data.editModal.states[a].file=l,this.data.editModal.currentIndex=a});Oe(this,"closeEditModal",a=>{this.data.editModal.isCurrentlyEditing=!1,this.data.editModal.states[a].visible=!1,this.data.editModal.states[a].file=null,this.data.editModal.currentIndex=-1,this.resetValidationError()});Oe(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Oe(this,"setValidationError",a=>{this.data.validationErrors=a});Oe(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Oe(this,"clearValidationError",()=>{this.data.validationErrors={}});Oe(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,l=null){a=a.map(s=>{if(typeof s.settings=="string")try{s.settings=JSON.parse(s.settings)}catch{}return s}),this.data.downloadableFiles=a,l&&(this.data.sourceProduct=l)}syncToSourceProduct(){this.data.sourceProduct&&Array.isArray(this.data.downloadableFiles)&&(this.data.sourceProduct.downloadable_files=[...this.data.downloadableFiles])}get downloadableFiles(){return this.data.downloadableFiles}get saving(){return this.data.saving}setSaving(a){this.data.saving=a}hasDownloadableFiles(){return Array.isArray(this.data.downloadableFiles)&&this.data.downloadableFiles.length>0}getHiddenVariationNames(a,l){if(!a)return[];let s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{return[]}else typeof a=="object"&&(s=Object.values(a));const i=Oo(l),c=l.variants.reduce((m,_)=>(m[_.id]=Qn(_,i),m),{});return s.map(m=>c[m]).filter(Boolean).slice(1)}generateVariantOptions(a){return[...a.variants.filter(s=>s.created_at)]}hasVariationOption(a){return Object.values(this.generateVariantOptions(a)).length>0}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",file_size:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}setInsertableFiles(a){this.data.addModal.files=a}get insertableFiles(){return this.data.addModal.files}addDummyInsertableFile(a=null){const l=this.downloadableFileSchema;a&&(l.product_variation_id=[a]),this.data.addModal.files.push(l)}getCurrentEditableIndex(){return this.data.editModal.currentIndex}getCurrentEditableFile(){var a;return((a=this.data.editModal.states[this.getCurrentEditableIndex()])==null?void 0:a.file)??null}updateDownloadableFile(){const a=this.getCurrentEditableFile(),l=this.getCurrentEditableIndex();!a||l<0||(this.setSaving(!0),ce.put("products/"+a.id+"/update",a).then(s=>{this.closeEditModal(l),z.success(s.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?z.error(s.message):z.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function MG(){return TG.init()}const LG={class:"fct-product-simple-wrap"},RG={class:"flex items-center gap-1 justify-between w-full"},OG={class:"fct-shipping-class-select-wrap relative"},HG={class:"fct-select-option-with-leftright-value"},PG={class:"text-sm text-gray-500"},NG={class:"pt-1.5 text-right"},KG={key:0},GG={class:"mb-0 mt-2"},jG={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=V(rt.get(t,"product.detail.other_info.shipping_class")),l=V(),s=V(!1),i=V(!1),c=V([]),p=ze.get("admin_url")+"settings/shipping/shipping_classes",m=(b="")=>{i.value=!0,c.value=[],ce.get("shipping/classes",{search:b}).then(w=>{c.value=w.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=b=>{m(),b.id&&(a.value=b.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const b=rt.where(c.value,"id",a.value);l.value=rt.get(b,"0")},y=()=>{s.value=!0},v=()=>{a.value&&ce.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(b=>{z.success(b.message)}).catch(b=>{var w;b.status_code=="422"?z.validationErrors(b):z.error((w=b.data)==null?void 0:w.message)})},C=()=>{ce.post("products/"+t.product.ID+"/shipping-class/remove").then(b=>{z.success(b.message)}).catch(b=>{var w;b.status_code=="422"?z.validationErrors(b):z.error((w=b.data)==null?void 0:w.message)})};return Qe(()=>{m()}),(b,w)=>{const x=B("el-option"),F=B("el-select"),L=B("el-button");return r(),h("div",LG,[n(xe,null,{default:d(()=>[n(Ve,{border_bottom:""},{default:d(()=>[o("div",RG,[n(ca,{title:A(u)("Shipping Class"),content:A(u)("Use a shipping class to group products with similar shipping requirements. This allows you to set specific shipping rates for different types of items, such as 'Bulky Items', 'Fragile Goods'. Select an existing class from the search box or click + Add to create a new one. If no class is assigned, the product will use your store's default shipping rates.")},null,8,["title","content"]),o("a",{href:p,class:"focus:outline-none focus:shadow-none w-4 h-4 inline-flex items-center justify-center",target:"_blank"},[n(ee,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(ke,null,{default:d(()=>[o("div",OG,[n(F,{modelValue:a.value,"onUpdate:modelValue":w[0]||(w[0]=U=>a.value=U),remote:"",placeholder:A(u)("Search Shipping Class"),"remote-method":m,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:C,"popper-class":"fct-shipping-class-select"},{default:d(()=>[(r(!0),h(O,null,ae(c.value,U=>(r(),$(x,{key:U.id,label:U.name,value:U.id},{default:d(()=>[o("div",HG,[R(f(U.name)+" ",1),o("span",PG,f(U.type==="percentage"?U.cost+"%":A(Je).formatNumber(U.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",NG,[n(L,{onClick:Ne(y,["stop"]),size:"small",text:""},{default:d(()=>[n(ee,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",KG,[o("p",GG,f(A(u)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":A(Je).formatNumber(l.value.cost*100,!0))),1)])):k("",!0)]),_:1})]),_:1}),n(qf,{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=U=>s.value=U),onSaved:_},null,8,["modelValue"])])}}},zG={key:0,class:"fct-product-inventory-wrap"},qG={class:"fct-product-inventory-inner-wrap hide-on-mobile"},YG={class:"space-x-5"},WG={key:0,class:"fct-variant-badge bg-white border border-solid border-gray-outline text-primary-500 rounded-xs dark:bg-primary-700 dark:text-gray-50 dark:border-primary-500"},XG={key:1},JG={class:"fct-card-header-title"},ZG={class:"fct-product-inventory-pro-text"},ej={class:"m-0"},tj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=ze.get("app_config.isProActive"),s=V([]);Qe(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(m,_)=>{ce.post(`products/save-bundle-info/${m}`,{bundle_child_ids:_}).then(g=>{z.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?z.validationErrors(g):z.error(g==null?void 0:g.message)})},c=V(!0),p=()=>{c.value=!0,ce.get(`products/get-bundle-info/${a.product.ID}`).then(m=>{s.value=m,c.value=!1})};return(m,_)=>{const g=B("el-table-column"),y=B("el-table");return A(l)?(r(),h("div",zG,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Map bundle items")},null,8,["title"]),n(_a,{visible:!0,accordion:""},{default:d(()=>[n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",qG,[c.value?k("",!0):(r(),$(y,{key:0,data:s.value},{default:d(()=>[e.product.detail.variation_type!=="simple"?(r(),$(g,{key:0,label:A(u)("Title"),width:"140"},{default:d(v=>{var C;return[o("div",YG,[o("span",null,f(v.row.variation_title),1),((C=v.row.other_info)==null?void 0:C.payment_type)==="subscription"?(r(),h("span",WG,f(v.row.other_info.repeat_interval),1)):k("",!0)])]}),_:1},8,["label"])):k("",!0),n(g,{label:A(u)("Bundle Items"),width:"140"},{default:d(v=>[n(Hc,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":C=>v.row.bundle_child_ids=C,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:C=>{C||i(v.row.id,v.row.bundle_child_ids)},scopes:["nonBundle"]},null,8,["modelValue","onUpdate:modelValue","onVisibleChange"])]),_:1},8,["label"])]),_:1},8,["data"]))])]),_:1})]),_:1})]),_:1})])):(r(),h("div",XG,[n(xe,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h2",JG,[R(f(A(u)("Map bundle items"))+" ",1),n(ee,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(ke,null,{default:d(()=>[o("div",ZG,[o("p",ej,f(A(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},aj={class:"fct-edit-product-wrapper fct-layout-width"},lj={class:"fct-btn-group sm"},sj={class:"hide-on-mobile"},nj={class:"show-on-mobile"},oj=["href"],ij={key:1,class:"single-page-body"},rj=["innerHTML"],dj={class:"fct-product-edit"},uj={class:"fct-product-main"},cj={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},Aj={class:"fct-product-aside"},pj={class:"el-form el-form--default el-form--label-top"},fj={key:1},mj={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=V(),l=YT();let s=null;const i=MG();l.setProductDownloadableModel(i);const c=V(!1),p=C=>{var b,w;c.value=!1,l.setProduct(C),s=l.data.product,i.setDownloadableFiles(C.downloadable_files,C),s.gallery=((w=(b=s==null?void 0:s.detail)==null?void 0:b.gallery_image)==null?void 0:w.meta_value)??[],s.taxonomies=t.taxonomies,s.product_terms={},Object.keys(s.taxonomies).map(x=>{s.product_terms[x]=s[x]??[]}),l.saveSnapshot(),c.value=!0};WT().onSave(()=>{var C;l.data.metaValue=(C=a.value)==null?void 0:C.getFormStates(),l.update()});const _=ps();_.bind(["mod+s"],C=>{var b;C.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(b=a.value)==null?void 0:b.getFormStates(),l.update()))});const g=()=>{l.setHasChange(!0)},y=C=>{C==="delete"&&l.delete()};Nr("triggerChange",g);const v=Pr("reload");return Ce(()=>t.product,(C,b)=>{C!==b&&p(C)}),Qe(()=>{p(t.product),l.setReloader(v);const C=document.querySelector(".fct-admin-product-header");C&&document.querySelector("#fluent_cart_plugin_app").prepend(C),l.addOnProductUpdatedListener("formreset",function(){var b;(b=a.value)==null||b.resetForms()})}),kc(()=>{_.unbind("mod+s")}),(C,b)=>{const w=B("el-button"),x=B("el-dropdown-item"),F=B("el-dropdown-menu"),L=B("el-dropdown");return r(),h("div",aj,[(r(),$(Xo,{to:"#fct-admin-product-header-buttons"},[o("div",lj,[n(L,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[n(F,null,{default:d(()=>[n(x,{command:"preview",class:"item-link"},{default:d(()=>[o("a",{href:A(l).viewUrl(),target:"_blank"},[n(ee,{name:"Eye"}),R(" "+f(A(u)("Preview")),1)],8,oj)]),_:1}),n(x,{command:"delete",class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[n(w,null,{default:d(()=>[o("span",sj,[R(f(A(u)("More Actions"))+" ",1),n(ee,{name:"ChevronDown"})]),o("span",nj,[n(ee,{name:"More"})])]),_:1})]),_:1})])])),c.value?(r(),$(an,{key:0,isActive:A(l).data.hasChange?"is-active":"",loading:A(l).data.saving,onDiscard:A(l).discard,onSave:b[0]||(b[0]=()=>{var U;A(l).data.metaValue=(U=a.value)==null?void 0:U.getFormStates(),A(l).update()}),saveButtonText:A(u)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):k("",!0),c.value?(r(),h("div",ij,[A(l).shouldShowShippingMethodAlert()?(r(),$(Za,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("This Product has physical variants. Please %s",'<a href="'+A(l).shippingSettingsUrl()+'" target="_blank">'+A(u)("Add Shipping")+"</a>")},null,8,rj)]),_:1})):k("",!0),A(l).isInDraft()?(r(),$(Za,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:A(u)("This product is currently in draft and cannot be sold to customers. Please publish the product to make it available for purchase.")},null,8,["content"])):k("",!0),o("div",dj,[o("div",uj,[n(vM,{product:A(s),productEditModel:A(l),reload:A(v)},null,8,["product","productEditModel","reload"]),o("div",cj,[(r(),$(Ju,{key:A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(Zu,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])]),n(uK,{product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(BK,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).isBundleProduct()?(r(),$(tj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):k("",!0),A(l).isBundleProduct()?k("",!0):(r(),$(qK,{key:1,product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",Aj,[o("div",pj,[(r(),$(Ju,{class:"fct-hide-on-tablet",key:"aside-"+A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(Zu,{class:"fct-hide-on-tablet",product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),n(VG,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).hasPhysicalVariation()?(r(),$(jG,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):k("",!0),A(s)?(r(),h("div",fj,[n(nn,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:A(s).ID},data:{editableProduct:A(s)}},null,8,["widgets-query","data"])])):k("",!0)])])])])):k("",!0)])}}},hj={class:"fct-upgrade-path-drawer-content"},_j={class:"fct-form-group"},vj={class:"fct-form-group"},gj={class:"fct-form-group"},yj={class:"fct-form-group"},bj={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=V(!1),c=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},m=V({...p}),_=V({}),g=ze.get("shop.currency_sign"),y=()=>{_.value={};const b={...m.value};(!Array.isArray(b.to_variants)||b.to_variants.length===0)&&(b.to_variants=[]),ce.post(`products/${l.productId}/upgrade-path`,{...b}).then(w=>{z.success(w.message),m.value={...p},i.value=!1,s("pathGenerated")}).catch(w=>{if(_.value=w,w.message)return z.error(w.message)})},v=()=>m.value.from_variant?l.allVariants.filter(b=>{var w,x;return!((w=l.existingUpgradePathMap[m.value.from_variant])!=null&&w.includes(b.id)||(x=l.existingUpgradePathMap[m.value.from_variant])!=null&&x.includes(b.id.toString()))&&b.id!==m.value.from_variant}):[],C=b=>{let w=b==null?void 0:b.toString().replace(/^0+(?=\d)/,"");w===""&&(w="0"),parseInt(w)<0&&(w="0"),m.value.discount_amount=w};return t({openModal:c}),(b,w)=>{const x=B("el-option"),F=B("el-select"),L=B("el-checkbox"),U=B("el-input"),S=B("el-button"),M=B("el-drawer");return r(),$(M,{title:A(u)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":w[5]||(w[5]=I=>i.value=I),onClosed:w[6]||(w[6]=()=>{i.value=!1,m.value={...p}}),"append-to-body":"",class:de(A(Te).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[n(S,{onClick:w[4]||(w[4]=I=>i.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(S,{onClick:y,type:"primary"},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1})]),default:d(()=>[o("div",hj,[o("div",_j,[o("label",null,f(A(u)("From Plan")),1),n(F,{modelValue:m.value.from_variant,"onUpdate:modelValue":w[0]||(w[0]=I=>m.value.from_variant=I),placeholder:A(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(O,null,ae(e.pathOptions,I=>(r(),$(x,{key:I.id,label:I.variation_title,value:I.id,disabled:m.value.to_variants.includes(I.id)},{default:d(()=>[n(Ho,{variant:I},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),$(la,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):k("",!0)]),o("div",vj,[o("label",null,f(A(u)("To Plan(s)")),1),n(F,{disabled:!m.value.from_variant,modelValue:m.value.to_variants,"onUpdate:modelValue":w[1]||(w[1]=I=>m.value.to_variants=I),multiple:"",placeholder:A(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(O,null,ae(v(),I=>(r(),$(x,{key:I.id,label:I.variation_title,value:I.id,disabled:I.id==m.value.from_variant},{default:d(()=>[n(Ho,{variant:I},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),$(la,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):k("",!0)]),o("div",gj,[n(L,{"true-value":"1","false-value":"0",modelValue:m.value.is_prorate,"onUpdate:modelValue":w[2]||(w[2]=I=>m.value.is_prorate=I)},{default:d(()=>[R(f(A(u)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",yj,[o("label",null,f(A(u)("Discount Amount")),1),n(U,{modelValue:m.value.discount_amount,"onUpdate:modelValue":w[3]||(w[3]=I=>m.value.discount_amount=I),type:"number",min:0,onInput:C},{prepend:d(()=>[R(f(A(g)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),$(la,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):k("",!0)])])]),_:1},8,["title","modelValue","class"])}}},wj={class:"fct-upgrade-path-drawer-content"},Cj={class:"fct-form-group"},Bj={class:"text"},kj={class:"fct-form-group"},xj={class:"fct-form-group"},Sj={class:"fct-form-group"},ec={__name:"EditModal",props:{fromName:String,preSelectedFromVariant:{type:[String,Number]},preSelectedToVariants:{type:Array},preSelectedIsProrate:{type:[String,Number]},preSelectedDiscountAmount:{type:[String,Number]},pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,pathId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{emit:t}){const a=e,l=V({...a.existingUpgradePathMap}),s=t,i=V(!1),c={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=V({...c}),m=V({}),_=()=>{m.value={};const C={...p.value};(!Array.isArray(C.to_variants)||C.to_variants.length===0)&&(C.to_variants=[]),ce.post(`products/upgrade-path/${a.pathId}/update`,{...C}).then(b=>{z.success(b.message),p.value={...c},i.value=!1,s("pathGenerated")}).catch(b=>{if(m.value=b,b.message)return z.error(b.message)})},g=()=>p.value.from_variant?a.allVariants.filter(C=>{var b,w;return!((b=l[p.value.from_variant])!=null&&b.includes(C.id)||(w=l[p.value.from_variant])!=null&&w.includes(C.id.toString()))&&C.id.toString()!==p.value.from_variant.toString()}):[],y=()=>{p.value.from_variant=a.preSelectedFromVariant,p.value.is_prorate=a.preSelectedIsProrate,p.value.discount_amount=a.preSelectedDiscountAmount,p.value.to_variants=[];for(const C of a.preSelectedToVariants)p.value.to_variants.push(parseInt(C))},v=C=>{let b=C==null?void 0:C.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),p.value.discount_amount=b};return Ss(()=>{y()}),(C,b)=>{const w=B("el-option"),x=B("el-select"),F=B("el-checkbox"),L=B("el-input"),U=B("el-button"),S=B("el-drawer");return r(),h(O,null,[n(Xe,{size:"x-small",tag:"button",onClick:b[0]||(b[0]=()=>{i.value=!0})},{default:d(()=>[n(ee,{name:"Edit"})]),_:1}),n(S,{modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=M=>i.value=M),title:C.$t("Update Upgrade Path"),onClosed:b[6]||(b[6]=()=>{i.value=!1,p.value={...c}}),onOpen:y,"append-to-body":""},{footer:d(()=>[n(U,{onClick:b[4]||(b[4]=M=>i.value=!1),size:"small"},{default:d(()=>[R(f(C.$t("Cancel")),1)]),_:1}),n(U,{onClick:_,size:"small",type:"primary"},{default:d(()=>[R(f(C.$t("Update")),1)]),_:1})]),default:d(()=>[o("div",wj,[o("div",Cj,[o("label",null,f(C.$t("From Plan")),1),o("div",Bj,f(e.fromName),1)]),o("div",kj,[o("label",null,f(C.$t("To Plan(s)")),1),n(x,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=M=>p.value.to_variants=M),multiple:"",placeholder:"Select",clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(g(),M=>(r(),$(w,{key:M.id,label:M.variation_title,value:M.id,disabled:M.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue"]),m.value.hasOwnProperty("to_variants")?(r(),$(la,{key:0,"validation-errors":m.value,"field-key":"to_variants"},null,8,["validation-errors"])):k("",!0)]),o("div",xj,[n(F,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=M=>p.value.is_prorate=M)},{default:d(()=>[n(ca,{class:"flex items-center",title:C.$t("Prorate"),content:`The prorated amount, based on the remaining days, will be credited to the new plan. Upgrading from one-time payment, the full amount will be credited. | |
| 153 | - `},null,8,["title"])]),_:1},8,["modelValue"])]),o("div",Sj,[o("label",null,f(C.$t("Discount Amount")),1),n(L,{modelValue:p.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=M=>p.value.discount_amount=M),type:"number",min:"0",onInput:v},null,8,["modelValue"]),m.value.hasOwnProperty("discount_amount")?(r(),$(la,{key:0,"validation-errors":m.value,"field-key":"discount_amount"},null,8,["validation-errors"])):k("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},Fj={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton"),i=B("el-table-column"),c=B("el-table");return r(),$(c,{data:[1,2,3,4,5]},{default:d(()=>[n(i,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("To Plan"),width:200},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Discount Amount"),width:110},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Is Prorate"),width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},$j={class:"fct-upgrade-paths-wrap fct-layout-width"},Ej={class:"grid gap-1"},Uj={class:"text-system-dark dark:text-gray-50"},Ij={class:"text-xs text-system-mid dark:text-gray-300"},Qj={class:"flex gap-1 flex-wrap"},Dj={key:0},Vj={key:1},Tj={class:"fct-btn-group sm"},Mj={key:2,class:"fct-upgrade-paths-mobile"},Lj={class:"from-plan"},Rj={class:"title"},Oj={class:"plan-title"},Hj={key:0,class:"plan-billing-summary"},Pj={class:"to-plan"},Nj={class:"title"},Kj={class:"discount-amount"},Gj={class:"title"},jj={key:0},zj={key:1},qj={class:"is-prorate"},Yj={class:"title"},Wj={class:"path-actions"},Xj={class:"title"},Jj={class:"fct-btn-group sm mt-3"},Zj={key:0,class:"py-6 text-center"},ez={key:1},tz={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},az={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},lz={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=K(()=>rt.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=V(!1),s=V(null);V([]),V({status:"yes",paths:{}});const i=ze.get("app_config.isProActive"),c=V([]),p=K(()=>t.product.variants.filter(x=>{var L;return(((L=C.value[x.id])==null?void 0:L.length)||0)<v.value-1})),m=x=>{_()},_=async()=>{l.value=!0,ce.get(`products/${t.product_id}/upgrade-paths`).then(function(x){c.value=x.data,b()}).catch(function(x){}).finally(()=>{l.value=!1})},g=V({}),y=V({}),v=V(rt.get(t.product,"variants",[]).length),C=V({}),b=()=>{t.product.variants.entries().forEach(([x,F])=>{g.value[F.id]=F.variation_title,y.value[F.id]=F.other_info.billing_summary}),C.value={},c.value.forEach(x=>{C.value.hasOwnProperty(x.object_id)?(C.value[x.object_id]=[...C.value[x.object_id].concat([...x.meta_value.to_variants])],C.value[x.object_id]=[...new Set(C.value[x.object_id])]):C.value[x.object_id]=[...x.meta_value.to_variants]})},w=x=>{ce.delete(`products/upgrade-path/${x}/delete`).then(function(F){_(),z.success(F.message)}).catch(function(F){})};return Qe(()=>{_();const x=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");x&&document.querySelector("#fluent_cart_plugin_app").prepend(x)}),(x,F)=>{const L=B("el-table-column"),U=B("el-tag"),S=B("el-table"),M=B("el-button");return r(),h(O,null,[o("div",$j,[n(A(xe),null,{default:d(()=>[n(A(Ve),{title:A(u)("Upgrade Paths")},null,8,["title"]),A(i)&&!a.value?(r(),h(O,{key:0},[n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),$(Fj,{key:0})):k("",!0),l.value?k("",!0):(r(),$(S,{key:1,class:"hide-on-mobile",data:c.value},{empty:d(()=>[R(f(A(u)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:d(()=>[n(L,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(I=>[o("div",Ej,[o("div",Uj,f(A(rt).get(g.value,I.row.object_id,"")),1),o("div",Ij,f(A(rt).get(y.value,I.row.object_id,"")),1)])]),_:1},8,["label"]),n(L,{label:A(u)("To Plan"),width:200},{default:d(I=>[o("div",Qj,[(r(!0),h(O,null,ae(A(rt).get(I.row,"meta_value.to_variants",[]),T=>(r(),h(O,{key:T},[A(rt).get(g.value,T)?(r(),$(U,{key:0},{default:d(()=>[R(f(A(rt).get(g.value,T)),1)]),_:2},1024)):k("",!0)],64))),128))])]),_:1},8,["label"]),n(L,{label:A(u)("Discount Amount"),width:110},{default:d(I=>[I.row.meta_value.discount_amount>0?(r(),h("span",Dj,f(A(rt).get(I.row,"meta_value.discount_amount","0")),1)):(r(),h("span",Vj,"--"))]),_:1},8,["label"]),n(L,{label:A(u)("Is Prorate"),width:100},{default:d(I=>[R(f(A(rt).get(I.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),n(L,{width:100},{default:d(I=>[o("div",Tj,[n(ec,{pathId:I.row.id,preSelectedToVariants:A(rt).get(I.row,"meta_value.to_variants",[]),preSelectedIsProrate:A(rt).get(I.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(rt).get(I.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:A(rt).get(g.value,I.row.object_id,""),preSelectedFromVariant:I.row.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Xe,{size:"x-small",tag:"button",outline:"",onClick:()=>w(I.row.id)},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?k("",!0):(r(),h("div",Mj,[(r(!0),h(O,null,ae(c.value,(I,T)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:T},[o("div",Lj,[o("div",Rj,f(A(u)("From Plan"))+": ",1),o("div",null,[o("div",Oj,f(A(rt).get(g.value,I.object_id,"")),1),A(rt).get(y.value,I.object_id,"")?(r(),h("div",Hj,f(A(rt).get(y.value,I.object_id,"")),1)):k("",!0)])]),o("div",Pj,[o("div",Nj,f(A(u)("To Plan"))+": ",1),(r(!0),h(O,null,ae(A(rt).get(I,"meta_value.to_variants",[]),Q=>(r(),h(O,{key:Q},[A(rt).get(g.value,Q)?(r(),$(U,{key:0},{default:d(()=>[R(f(A(rt).get(g.value,Q)),1)]),_:2},1024)):k("",!0)],64))),128))]),o("div",Kj,[o("div",Gj,f(A(u)("Discount Amount"))+": ",1),I.meta_value.discount_amount>0?(r(),h("span",jj,f(A(rt).get(I,"meta_value.discount_amount","0")),1)):(r(),h("span",zj,"--"))]),o("div",qj,[o("div",Yj,f(A(u)("Is Prorate"))+": ",1),o("span",null,f(A(rt).get(I,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",Wj,[o("div",Xj,f(A(u)("Actions"))+": ",1),o("div",Jj,[n(ec,{pathId:I.id,preSelectedToVariants:A(rt).get(I,"meta_value.to_variants",[]),preSelectedIsProrate:A(rt).get(I,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(rt).get(I,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value,fromName:A(rt).get(g.value,I.object_id,""),preSelectedFromVariant:I.object_id,onPathGenerated:m},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(Xe,{size:"x-small",tag:"button",outline:"",onClick:()=>w(I.id)},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),c.value.length==0?(r(),h("div",Zj,f(A(u)("No upgrade paths found.")),1)):k("",!0)]))]),_:1}),l.value?k("",!0):(r(),$(A(td),{key:0},{default:d(()=>[p.value.length?(r(),$(M,{key:0,text:"",onClick:F[0]||(F[0]=()=>{var I;return(I=s.value)==null?void 0:I.openModal()})},{default:d(()=>[n(ee,{name:"Plus"}),R(" "+f(A(u)("Add Path")),1)]),_:1})):(r(),h("span",ez,f(A(u)("No more upgrade paths available")),1))]),_:1}))],64)):A(i)?a.value?(r(),h("div",az,[n(_t,{icon:"Empty/WebPage",title:A(u)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:A(u)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):k("",!0):(r(),h("div",tz,[n(Vn,{class:"py-7.5",title:A(u)("Get access to this feature by Upgrading to FluentCart Pro"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?k("",!0):(r(),$(bj,{key:0,productId:e.product.ID,onPathGenerated:m,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:C.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},sz={name:"ProductIntegrations",components:{IconButton:Xe,Empty:_t,DynamicIcon:ee,CardFooter:td,CardBody:ke,CardHeader:Ve,CardContainer:xe},props:["product","product_id"],data(){return{product_id:this.product_id,selectedIntegrationType:"",integrationLists:[],showIntegrationDialog:!1,feeds:[],available_integrations:{},all_module_config_url:{},totalActiveModules:0,loading:!1}},computed:{Str(){return oa},hasActiveModules(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.fetchIntegrations();const e=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");e&&document.querySelector("#fluent_cart_plugin_app").prepend(e)},methods:{isEmpty:Zr,fetchIntegrations(){this.loading=!0,this.$get(`products/${this.product_id}/integrations`).then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.handleError(e.message||"Failed to load integrations")}).finally(()=>{this.loading=!1})},add(e){let t=this.available_integrations[e];if(!t.enabled){this.$confirm(t.configure_message,t.configure_title,{confirmButtonText:t.configure_button_text,cancelButtonText:"Cancel",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{window.location.href=t.global_configure_url});return}this.$router.push({name:"product_integration_feed_editor",params:{integration_id:0,integration_name:e}})},edit(e){this.$router.push({name:"product_integration_feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},handleActive(e){let t={status:e.enabled,notification_id:e.id};this.$post(`products/${this.product_id}/integrations/feed/change-status`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})},remove(e,t){let a=t.$index,l={integration_id:e};this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`products/${this.product_id}/integrations/${e}`,l).then(s=>{this.handleSuccess(s.message),this.feeds.splice(a,1)}).catch(()=>{})}).catch(()=>{})},handleSuccess(e){this.$notify({type:"success",message:e,offset:40})},handleError(e){this.$notify({type:"error",message:e,offset:40})}}},nz={class:"fct-integration-settings fct-layout-width"},oz={key:0,class:"integration-actions"},iz={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},rz={class:"text-sm"},dz={key:1,class:"fct-integrations-table-wrap"},uz={class:"fct-integration-logo-wrap"},cz=["src","alt"],Az={class:"text-xs text-gray-700"},pz=["onClick"],fz={class:"fct-event-triggers"},mz={class:"fct-event-triggers"},hz={class:"fct-btn-group sm"},_z={class:"fct-integration-table-footer"},vz=["href"],gz={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function yz(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-button"),m=B("el-dropdown-item"),_=B("el-dropdown-menu"),g=B("el-dropdown"),y=B("CardHeader"),v=B("el-skeleton"),C=B("el-switch"),b=B("el-table-column"),w=B("el-tag"),x=B("el-popover"),F=B("IconButton"),L=B("el-tooltip"),U=B("Empty"),S=B("el-table"),M=B("CardBody"),I=B("CardContainer"),T=Va("loading");return r(),h("div",nz,[n(I,null,{default:d(()=>[n(y,{title:e.$t("Product Integrations")},{action:d(()=>[i.hasActiveModules?(r(),h("div",oz,[n(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(!0),h(O,null,ae(s.available_integrations,(Q,E)=>(r(),$(m,{key:E,command:E},{default:d(()=>[R(f(Q.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(p,{type:"info",plain:"",size:"small"},{default:d(()=>[R(f(e.$t("Add Integration"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):k("",!0)]),_:1},8,["title"]),n(M,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(v,{class:"px-5 pb-5",loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?k("",!0):(r(),h(O,{key:0},[i.hasActiveModules?(r(),h("div",dz,[jt((r(),$(S,{data:s.feeds},{empty:d(()=>[n(U,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[n(b,{label:e.$t("Status"),width:90},{default:d(Q=>[n(C,{"active-value":"yes","inactive-value":"no",onChange:E=>i.handleActive(Q.row),modelValue:Q.row.enabled,"onUpdate:modelValue":E=>Q.row.enabled=E},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(b,{width:160,label:e.$t("Integration")},{default:d(Q=>{var E,D;return[o("div",uz,[(E=s.available_integrations[Q.row.provider])!=null&&E.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[Q.row.provider].logo,alt:Q.row.provider},null,8,cz)):k("",!0),o("span",Az,f(((D=s.available_integrations[Q.row.provider])==null?void 0:D.title)||Q.row.provider),1)])]}),_:1},8,["label"]),n(b,{"min-width":150,label:e.$t("Title")},{default:d(Q=>[o("a",{class:"fct-action-link-btn",onClick:Ne(E=>i.edit(Q.row),["prevent"]),href:"#"},f(Q.row.name),9,pz)]),_:1},8,["label"]),n(b,{"min-width":150,label:e.$t("Triggers")},{default:d(Q=>[o("div",fz,[(r(!0),h(O,null,ae((Q.row.feed.event_trigger||[]).slice(0,2),(E,D)=>(r(),$(w,{key:E},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+f(i.Str.headline(E)),1)]),_:2},1024))),128)),(Q.row.feed.event_trigger||[]).length>2?(r(),$(x,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(w,{type:"info"},{default:d(()=>[R(" +"+f((Q.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",mz,[(r(!0),h(O,null,ae((Q.row.feed.event_trigger||[]).slice(2),(E,D)=>(r(),$(w,{key:E+D},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+f(i.Str.headline(E)),1)]),_:2},1024))),128))])]),_:2},1024)):k("",!0)])]),_:1},8,["label"]),n(b,{width:90},{default:d(Q=>[o("div",hz,[n(L,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(F,{tag:"button",onClick:E=>i.edit(Q.row),size:"x-small",hover:"primary"},{default:d(()=>[n(c,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(L,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(F,{tag:"button",size:"x-small",onClick:E=>i.remove(Q.row.id,Q),hover:"danger"},{default:d(()=>[n(c,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[T,s.loading]])])):(r(),h("div",iz,[o("p",rz,f(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(p,{tag:"a",type:"primary",href:s.all_module_config_url},{default:d(()=>[R(f(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",_z,[o("a",{href:s.all_module_config_url},f(e.$t("Check Global Integration Settings")),9,vz),o("a",gz,f(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const tc=lt(sz,[["render",yz]]),bz={name:"SingleIntegration",components:{CardFooter:td,CardBody:ke,CardHeader:Ve,CardContainer:xe},props:["product","product_id","integration_id","integration_type"],data(){return{integration_id:this.integration_id,product_id:this.product_id,integration_type:this.integration_type||"",saving:!1,formData:{values:{name:"",integrationName:this.integration_type||"",description:""},fields:{integrationName:{type:"select",label:"Integration Type",placeholder:"Select Integration",options:[]}}}}},mounted(){this.fetchIntegrationData()},methods:{saveIntegration(){if(!this.formData.values.name){this.$notify({type:"error",message:"Integration name is required",offset:40});return}this.saving=!0;const e=this.integration_id?`products/${this.product_id}/integrations/${this.integration_id}`:`products/${this.product_id}/integrations`,t=this.integration_id?"put":"post";this[`$${t}`](e,{integration:this.formData.values}).then(a=>{this.saving=!1,this.$notify({type:"success",message:a.message||"Integration saved successfully",offset:40}),this.$router.push({name:"ProductIntegrations",params:{product_id:this.product_id}})}).catch(a=>{this.saving=!1,this.$notify({type:"error",message:(a==null?void 0:a.message)||"Failed to save integration",offset:40})})},fetchIntegrationData(){if(!this.integration_id){this.fetchIntegrationType();return}this.$get(`products/${this.product_id}/integrations/${this.integration_id}`).then(e=>{e.integration&&(this.formData.values={...e.integration},this.integration_type=e.integration.integrationName,this.fetchIntegrationType())}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration data",offset:40})})},fetchIntegrationType(){this.integration_type&&this.$get(`integration/settings?integration_name=${this.integration_type}`).then(e=>{e.settings_fields&&(this.formData.fields=e.settings_fields),Object.keys(this.formData.fields).forEach(t=>{this.formData.values[t]===void 0&&(this.formData.values[t]="")})}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration fields",offset:40})})},compare(e,t,a){switch(t){case"=":return e===a;case"!=":return e!==a;default:return!0}},dependancyPass(e){if(e.dependency){const a=e.dependency.depends_on.split("/").reduce((l,s)=>l[s],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},wz={class:"fct-integration-settings fct-layout-width"};function Cz(e,t,a,l,s,i){const c=B("el-button"),p=B("CardHeader"),m=B("el-input"),_=B("el-form-item"),g=B("el-option"),y=B("el-select"),v=B("el-form"),C=B("CardBody"),b=B("CardContainer");return r(),h("div",wz,[n(b,null,{default:d(()=>[n(p,{border_bottom:"",title:s.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:d(()=>[n(c,{onClick:i.saveIntegration,type:"primary",loading:s.saving},{default:d(()=>[R(f(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),n(C,null,{default:d(()=>[n(v,{"label-position":"top",model:s.formData.values,class:"integration-form"},{default:d(()=>[n(_,{label:e.$t("Integration Name"),required:""},{default:d(()=>[n(m,{modelValue:s.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=w=>s.formData.values.name=w),placeholder:"Enter a name for this integration"},null,8,["modelValue"])]),_:1},8,["label"]),s.integration_id?k("",!0):(r(),$(_,{key:0,label:e.$t("Integration Type")},{default:d(()=>[n(y,{modelValue:s.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=w=>s.formData.values.integrationName=w),disabled:"",class:"fct-select"},{default:d(()=>[(r(!0),h(O,null,ae(s.formData.fields.integrationName.options,w=>(r(),$(g,{key:w.value,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(O,null,ae(s.formData.fields,(w,x)=>(r(),h(O,{key:x},[x!=="integrationName"&&i.dependancyPass(w)?(r(),$(_,{key:0,label:w.label},{default:d(()=>[w.type==="text"?(r(),$(m,{key:0,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="select"?(r(),$(y,{key:1,modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:w.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(O,null,ae(w.options,F=>(r(),$(g,{key:F.value,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):w.type==="textarea"?(r(),$(m,{key:2,type:"textarea",modelValue:s.formData.values[x],"onUpdate:modelValue":F=>s.formData.values[x]=F,placeholder:w.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):k("",!0)]),_:2},1032,["label"])):k("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const Bz=lt(bz,[["render",Cz],["__scopeId","data-v-07be2edd"]]),kz={class:"fct-reason-dropdown-wrap"},xz={class:"fct-reason-label"},Dp=Object.assign({name:"ReasonDropdown"},{__name:"ReasonDropdown",props:{modelValue:{type:String,default:""}},emits:["update:modelValue","update:customReason"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=V(l.modelValue),c=V("");Ce(()=>l.modelValue,_=>{i.value=_});const p=()=>{s("update:modelValue",i.value),i.value==="other"&&s("update:customReason",c.value)},m=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>c.value,setValue:_=>m(_),setCustomReason:_=>{c.value=_}}),(_,g)=>{const y=B("el-option"),v=B("el-select"),C=B("el-input");return r(),h("div",kz,[o("label",xz,f(A(u)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=b=>i.value=b),placeholder:A(u)("Select reason"),class:"w-full",onChange:p},{default:d(()=>[n(y,{label:A(u)("Received Stock"),value:"received"},null,8,["label"]),n(y,{label:A(u)("Damage/Loss"),value:"damage"},null,8,["label"]),n(y,{label:A(u)("Return/Refund"),value:"return"},null,8,["label"]),n(y,{label:A(u)("Count Correction"),value:"correction"},null,8,["label"]),n(y,{label:A(u)("Inventory Transfer"),value:"transfer"},null,8,["label"]),n(y,{label:A(u)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),n(_a,{visible:i.value==="other",accordion:"",duration:300},{default:d(()=>[n(C,{modelValue:c.value,"onUpdate:modelValue":g[1]||(g[1]=b=>c.value=b),type:"textarea",rows:3,placeholder:A(u)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:p},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),Sz={class:"fct-adjust-by-wrap"},Fz={class:"fct-adjust-by-row"},$z={class:"fct-adjust-by-col"},Ez={class:"title"},Uz={class:"fct-adjust-by-col"},Iz={class:"title"},Qz={class:"fct-stock-info"},Dz={class:"fct-adjust-reason-wrap"},Vz={class:"fct-adjust-by-action"},Vp=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=V(!1),i=V(0),c=V(a.variant.total_stock),p=V(""),m=V(""),_=V(null),g=V(null);Ce(s,w=>{w&&Se(()=>{var x,F,L;(x=_.value)==null||x.focus(),(L=(F=_.value)==null?void 0:F.select)==null||L.call(F)})});const y=()=>{const w=i.value||0;let F=(parseInt(a.variant.total_stock)||0)+parseInt(w);c.value=F<0?0:F},v=()=>{const w=c.value||0,x=parseInt(a.variant.total_stock)||0;i.value=parseInt(w)-x},C=()=>{i.value=0,c.value=a.variant.total_stock,p.value="",m.value="",s.value=!1},b=()=>{l("save",{variant:a.variant,newStock:c.value,adjustedQuantity:i.value,reason:p.value,customReason:p.value==="other"?m.value:""}),s.value=!1,C()};return(w,x)=>{const F=B("el-input"),L=B("el-button"),U=B("el-popover");return r(),$(U,{visible:s.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{class:"fct-stock-adjuster-trigger",onClick:x[4]||(x[4]=S=>s.value=!s.value)},[n(ee,{name:"Configuration"})])]),default:d(()=>[o("div",Sz,[o("div",Fz,[o("div",$z,[o("span",Ez,f(A(u)("Adjust by")),1),n(F,{ref_key:"adjustByInput",ref:_,size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:i.value,"onUpdate:modelValue":x[0]||(x[0]=S=>i.value=S),modelModifiers:{number:!0},onInput:y},null,8,["placeholder","modelValue"])]),o("div",Uz,[o("span",Iz,f(A(u)("New Stock")),1),n(F,{size:"small",placeholder:A(u)("New Stock"),type:"number",modelValue:c.value,"onUpdate:modelValue":x[1]||(x[1]=S=>c.value=S),modelModifiers:{number:!0},onInput:v},null,8,["placeholder","modelValue"])])]),n(_a,{visible:!!i.value,accordion:""},{default:d(()=>[o("div",Qz,[x[5]||(x[5]=R(" (Original quantity: ",-1)),o("strong",null,f(e.variant.total_stock),1),x[6]||(x[6]=R(") ",-1))])]),_:1},8,["visible"]),o("div",Dz,[n(Dp,{ref_key:"reasonDropdownRef",ref:g,modelValue:p.value,"onUpdate:modelValue":x[2]||(x[2]=S=>p.value=S),"onUpdate:customReason":x[3]||(x[3]=S=>m.value=S)},null,8,["modelValue"])]),o("div",Vz,[n(L,{size:"small",type:"info",soft:"",onClick:C},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(L,{size:"small",type:"primary",onClick:b,disabled:!p.value},{default:d(()=>[R(f(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}}),Tz={class:"fct-inventory-row"},Mz={width:"50"},Lz={class:"flex items-center gap-1"},Rz=["src","alt"],Oz=["src","alt"],Hz={class:"fct-inventory-product-content"},Pz={class:"fct-inventory-product-title"},Nz={key:0},Kz={key:0},Gz={key:1,class:"text-system-mid dark:text-gray-300"},jz={key:1},zz={key:2},qz={key:3},Yz=Object.assign({name:"InventoryTableRow"},{__name:"InventoryTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0}},emits:["stock-save","open-history"],setup(e){return(t,a)=>{var i,c,p,m;const l=B("el-checkbox"),s=B("el-input");return r(),h("tr",Tz,[o("td",Mz,[o("div",Lz,[n(l,{"model-value":e.isRowSelected(e.row.variants[0]),onChange:a[0]||(a[0]=_=>e.toggleRowSelection(e.row.variants[0]))},null,8,["model-value"])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:a[1]||(a[1]=_=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,Rz)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,Oz)),o("div",Hz,[o("span",Pz,f(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",Nz,[e.row.variants[0].sku?(r(),h("span",Kz,f(e.row.variants[0].sku),1)):(r(),h("span",Gz,f(A(u)("No SKU")),1))])):k("",!0),o("td",null,[n(s,{modelValue:e.row.variants[0].total_stock,"onUpdate:modelValue":a[3]||(a[3]=_=>e.row.variants[0].total_stock=_),class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Vp,{variant:e.row.variants[0],onSave:a[2]||(a[2]=_=>t.$emit("stock-save",_))},null,8,["variant"])]),_:1},8,["modelValue"])]),(c=e.inventoryTable)!=null&&c.isColumnVisible("available")?(r(),h("td",jz,[o("span",null,f(e.row.variants[0].available),1)])):k("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",zz,[o("span",null,f(e.row.variants[0].on_hold),1)])):k("",!0),(m=e.inventoryTable)!=null&&m.isColumnVisible("committed")?(r(),h("td",qz,[o("span",null,f(e.row.variants[0].committed),1)])):k("",!0),o("td",null,[n(Xe,{tag:"button",size:"small",onClick:a[4]||(a[4]=_=>t.$emit("open-history",e.row.variants[0]))},{default:d(()=>a[5]||(a[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:1,__:[5]})])])}}}),Wz={class:"fct-inventory-row fct-inventory-parent-row"},Xz={width:"50"},Jz={class:"fct-inventory-row-selection"},Zz=["src","alt"],eq=["src","alt"],tq={class:"fct-inventory-product-content"},aq={class:"fct-inventory-product-title"},lq={key:0},sq={class:"!pl-5"},nq={key:1},oq={key:2},iq={key:3},rq={class:"fct-inventory-variant-item"},dq={class:"fct-inventory-product-info"},uq=["src","alt"],cq=["src","alt"],Aq={class:"fct-inventory-product-content"},pq={key:0},fq={key:1},mq={key:2},hq={key:3},_q=Object.assign({name:"InventoryParentTableRow"},{__name:"InventoryParentTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0},isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},expanded:{type:Boolean,default:!0}},emits:["stock-save","open-history"],setup(e){tl();const t=e,a=V(!0),l=K(()=>a.value);Ce(()=>t.expanded,C=>{a.value=C});const s=()=>{a.value=!a.value},i=()=>l.value,c=K(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,w)=>b+(w.total_stock||0),0))||0}),p=K(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,w)=>b+(w.available||0),0))||0}),m=K(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,w)=>b+(w.on_hold||0),0))||0}),_=K(()=>{var C;return((C=t.row.variants)==null?void 0:C.reduce((b,w)=>b+(w.committed||0),0))||0}),g=()=>{const C=t.row.variants||[];return C.length>0&&C.every(b=>t.isRowSelected(b))},y=()=>{const C=t.row.variants||[],b=C.filter(w=>t.isRowSelected(w)).length;return b>0&&b<C.length},v=C=>{var b;(b=t.row.variants)==null||b.forEach(w=>{C!==t.isRowSelected(w)&&t.toggleRowSelection(w)})};return(C,b)=>{var L,U,S,M;const w=B("el-checkbox"),x=B("router-link"),F=B("el-input");return r(),h(O,null,[o("tr",Wz,[o("td",Xz,[o("div",Jz,[n(w,{"model-value":g(),indeterminate:y(),onChange:v,onClick:b[0]||(b[0]=Ne(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:b[1]||(b[1]=I=>s()),class:"fct-inventory-row-toggle"},[n(ee,{name:i()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:b[2]||(b[2]=I=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,Zz)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,eq)),o("div",tq,[o("span",aq,f(e.row.post_title),1)])])]),(L=e.inventoryTable)!=null&&L.isColumnVisible("sku")?(r(),h("td",lq,[jt(o("span",null,"--",512),[[Vl,!i()]])])):k("",!0),o("td",sq,[jt(o("span",null,f(c.value),513),[[Vl,!i()]])]),(U=e.inventoryTable)!=null&&U.isColumnVisible("available")?(r(),h("td",nq,[jt(o("span",null,f(p.value),513),[[Vl,!i()]])])):k("",!0),(S=e.inventoryTable)!=null&&S.isColumnVisible("on_hand")?(r(),h("td",oq,[jt(o("span",null,f(m.value),513),[[Vl,!i()]])])):k("",!0),(M=e.inventoryTable)!=null&&M.isColumnVisible("committed")?(r(),h("td",iq,[jt(o("span",null,f(_.value),513),[[Vl,!i()]])])):k("",!0),b[4]||(b[4]=o("td",null,null,-1))]),(r(!0),h(O,null,ae(e.row.variants,I=>{var T,Q,E,D,H;return jt((r(),h("tr",{key:`child-${I.id}`,class:"fct-inventory-child-row"},[b[6]||(b[6]=o("td",null,null,-1)),o("td",null,[o("div",rq,[n(w,{"model-value":e.isRowSelected(I),onChange:P=>e.toggleRowSelection(I)},null,8,["model-value","onChange"]),o("div",dq,[I.thumbnail!==null?(r(),h("img",{key:0,src:I.thumbnail,alt:I.variation_title,class:"inventory-thumbnail"},null,8,uq)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:I.variation_title},null,8,cq)),o("div",Aq,[n(x,{to:`/products/${I.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[R(f(I.variation_title),1)]),_:2},1032,["to"])])])])]),(T=e.inventoryTable)!=null&&T.isColumnVisible("sku")?(r(),h("td",pq,f(I.sku),1)):k("",!0),o("td",null,[n(F,{modelValue:I.total_stock,"onUpdate:modelValue":P=>I.total_stock=P,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Vp,{variant:I,onSave:b[3]||(b[3]=P=>C.$emit("stock-save",P))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(Q=e.inventoryTable)!=null&&Q.isColumnVisible("available")?(r(),h("td",fq,f(I.available),1)):k("",!0),(E=e.inventoryTable)!=null&&E.isColumnVisible("on_hand")?(r(),h("td",mq,f(I.on_hold),1)):k("",!0),(D=e.inventoryTable)!=null&&D.isColumnVisible("committed")?(r(),h("td",hq,f(I.committed),1)):k("",!0),o("td",null,[n(Xe,{tag:"button",size:"small",onClick:P=>C.$emit("open-history",I)},{default:d(()=>b[5]||(b[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:2,__:[5]},1032,["onClick"])])])),[[Vl,((H=e.row.variants)==null?void 0:H.length)>0&&i()]])}),128))],64)}}}),vq={class:"fct-adjustment-header"},gq={class:"fct-adjustment-product-name"},yq={key:0,class:"fct-adjustment-timeline-wrap"},bq={key:0,class:"fct-adjustment-timeline"},wq={class:"fct-timeline-node"},Cq={class:"fct-timeline-content"},Bq={class:"fct-timeline-header"},kq={class:"fct-timeline-time"},xq={class:"fct-stock-flow"},Sq={class:"fct-stock-flow-item"},Fq={class:"fct-stock-entry"},$q={class:"fct-stock-label"},Eq={class:"fct-stock-value"},Uq={class:"fct-stock-entry new-stock-entry"},Iq={class:"fct-stock-label"},Qq={class:"fct-stock-value"},Dq={class:"fct-stock-flow-item"},Vq={class:"fct-stock-label"},Tq={key:0,class:"fct-custom-reason-section"},Mq={class:"fct-stock-label"},Lq={class:"fct-custom-reason-text"},Rq={key:1,class:"fct-timeline-empty"},Oq={key:1,class:"fct-timeline-loading"},Hq=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=V(!1),l=V(!1),s=V({id:null,name:""}),i=V([]),c=()=>{a.value=!1,i.value=[]},p=y=>{s.value=y,a.value=!0,m(y.id)},m=y=>{y&&(l.value=!0,ce.get("inventory/adjustment-history",{variant_id:y}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{z.error(u("Failed to load adjustment history"))}).finally(()=>{l.value=!1}))},_=y=>y>0?"positive":y<0?"negative":"",g=y=>y>0?`+${y}`:`${y}`;return t({openHistory:p}),(y,v)=>{const C=B("el-drawer");return r(),$(C,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=b=>a.value=b),title:A(u)("Stock Adjustment History"),onClose:c},{default:d(()=>[o("div",vq,[o("h3",gq,f(s.value.name),1)]),l.value?(r(),h("div",Oq,[o("p",null,f(A(u)("Loading adjustment history...")),1)])):(r(),h("div",yq,[i.value.length>0?(r(),h("div",bq,[(r(!0),h(O,null,ae(i.value,(b,w)=>(r(),h("div",{key:w,class:"fct-timeline-item"},[o("div",wq,[o("span",{class:de(["fct-node-dot",`node-${b.reason}`])},null,2)]),o("div",Cq,[o("div",Bq,[o("span",kq,[n(Pa,{"date-time":b.created_at},null,8,["date-time"]),R(" (by "+f(b.user_name)+") ",1)]),o("span",{class:de(["fct-timeline-reason-badge",`badge-${b.reason}`])},f(b.reason_label),3)]),o("div",xq,[o("div",Sq,[o("div",Fq,[o("span",$q,f(A(u)("Previous Stock:")),1),o("span",Eq,f(b.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",Uq,[o("span",Iq,f(A(u)("New Stock:")),1),o("span",Qq,f(b.new_stock),1)])]),o("div",Dq,[o("span",Vq,f(A(u)("Change:")),1),o("span",{class:de(["fct-stock-value fct-stock-change",_(b.change)])},f(g(b.change))+" "+f(A(u)("units")),3)]),b.reason==="other"&&b.custom_reason?(r(),h("div",Tq,[o("span",Mq,f(A(u)("Details:")),1),o("p",Lq,f(b.custom_reason),1)])):k("",!0)])])]))),128))])):(r(),h("div",Rq,[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),Pq={class:"fct-bulk-modal-content"},Nq={class:"fct-inventory-mode-selection"},Kq={class:"fct-inventory-input-section"},Gq={key:0,class:"fct-inventory-mode-hint"},jq={class:"fct-inventory-selected-items"},zq={class:"fct-inventory-selected-items-count"},qq={key:0,class:"fct-inventory-selected-items-preview"},Yq={class:"fct-inventory-selected-item-header"},Wq={class:"variant-title"},Xq={class:"total-stock"},Jq={class:"fct-inventory-selected-item-list"},Zq={class:"fct-inventory-selected-item-info"},eY={class:"fct-inventory-selected-item-title"},tY=["innerHTML"],aY={class:"fct-inventory-selected-item-stock-action"},lY={class:"total-stock"},sY={class:"stock-arrow"},nY={class:"bulk-stock-value"},oY={class:"fct-inventory-adjustment-reason"},iY={class:"dialog-footer"},rY=Object.assign({name:"InventoryBulkAdjustModal"},{__name:"InventoryBulkAdjustModal",props:{selectedItems:{type:Array,required:!0}},emits:["bulk-update-success","close"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=V(!1),c=V("add"),p=V(null),m=V(""),_=V(""),g=x=>c.value==="add"?x.total_stock+p.value:p.value,y=x=>p.value!==null&&p.value!==""&&g(x)!==x.total_stock,v=()=>{b(),i.value=!1},C=()=>{const x={mode:c.value,value:p.value,reason:m.value,customReason:m.value==="other"?_.value:"",items:l.selectedItems.map(F=>({id:F.id,post_id:F.post_id}))};ce.post("inventory/bulk-update",x).then(()=>{z.success(u("Stock updated successfully")),b(),i.value=!1,s("bulk-update-success")}).catch(F=>{var L;F.status_code===422?z.validationErrors(F):z.error(((L=F.data)==null?void 0:L.message)||u("Failed to update stock"))})},b=()=>{p.value=null,c.value="add",m.value="",_.value=""};return t({openModal:()=>{b(),i.value=!0}}),(x,F)=>{const L=B("el-radio"),U=B("el-radio-group"),S=B("el-input"),M=B("el-button"),I=B("el-dialog");return r(),$(I,{modelValue:i.value,"onUpdate:modelValue":F[4]||(F[4]=T=>i.value=T),title:A(u)("Update Stocks")},{default:d(()=>{var T;return[o("div",Pq,[o("div",Nq,[n(U,{modelValue:c.value,"onUpdate:modelValue":F[0]||(F[0]=Q=>c.value=Q),class:"fct-mode-radio-group"},{default:d(()=>[n(L,{value:"add"},{default:d(()=>[R(f(A(u)("Increase Stock")),1)]),_:1}),n(L,{value:"set"},{default:d(()=>[R(f(A(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",Kq,[n(ca,{title:c.value==="add"?A(u)("Increase Stock by"):A(u)("Exact new stock"),content:c.value==="add"?A(u)("Increase stock by value (e.g. 10 + 5 = 15)"):A(u)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),n(S,{modelValue:p.value,"onUpdate:modelValue":F[1]||(F[1]=Q=>p.value=Q),modelModifiers:{number:!0},type:"number",placeholder:c.value==="add"?A(u)("Enter amount to add"):A(u)("Enter exact stock value")},null,8,["modelValue","placeholder"]),c.value==="set"?(r(),h("div",Gq,[n(ee,{name:"Warning"}),R(" "+f(A(u)("Replaces current inventory")),1)])):k("",!0)]),o("div",jq,[o("div",zq,f(e.selectedItems.length)+" "+f(A(u)("variants will be changed:")),1),(T=e.selectedItems)!=null&&T.length?(r(),h("div",qq,[o("div",Yq,[o("span",Wq,f(A(u)("Variant")),1),o("span",Xq,f(A(u)("Stock Change")),1)]),o("ul",Jq,[(r(!0),h(O,null,ae(e.selectedItems,Q=>(r(),h("li",{key:Q.id},[o("div",Zq,[o("span",eY,f(Q.variation_title),1),o("span",{class:"fct-inventory-selected-item-price",innerHTML:Q.formatted_total},null,8,tY)]),o("div",aY,[o("span",lY,f(Q.total_stock),1),y(Q)?(r(),h(O,{key:0},[o("span",sY,[n(ee,{name:"ArrowRight"})]),o("span",nY,f(g(Q)),1)],64)):k("",!0)])]))),128))])])):k("",!0)]),o("div",oY,[n(Dp,{modelValue:m.value,"onUpdate:modelValue":F[2]||(F[2]=Q=>m.value=Q),"onUpdate:customReason":F[3]||(F[3]=Q=>_.value=Q)},null,8,["modelValue"])]),o("div",iY,[n(M,{onClick:v},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(M,{type:"primary",onClick:C,disabled:!m.value},{default:d(()=>[R(f(A(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),dY={class:"fct-advanced-inventory-table"},uY={class:"fct-inventory-toolbar-wrap"},cY={key:0,class:"fct-inventory-toolbar-selected"},AY={class:"fct-inventory-toolbar-actions ml-auto"},pY={key:0,class:"fct-advanced-inventory-table-wrap"},fY={class:"fct-advanced-inventory-table"},mY={key:0,width:"150"},hY={key:1,width:"100"},_Y={key:2,width:"100"},vY={key:3,width:"100"},gY={width:"50"},yY={key:0},bY={key:1},wY={key:2},CY={key:3},ac=Object.assign({name:"InventoryTable"},{__name:"InventoryTable",props:{data:{type:Array,default:()=>[]},inventoryTable:Object},emits:["stock-save","bulk-update-success","selection-changed"],setup(e,{emit:t}){const a=tl(),l=e,s=t,i=V([]),c=V(!1),p=V(!1),m=V(null),_=V(null),g=V(!0);Ce(i,I=>{s("selection-changed",{selectedItems:I,count:I.length})},{deep:!0});const y=I=>I.post_id?`variant-${I.id}`:`product-${I.id}`,v=I=>{a.push({name:"product_edit",params:{product_id:I}})},C=()=>{_.value&&_.value.openModal()},b=()=>{i.value=[],U(),s("bulk-update-success")},w=()=>l.data.flatMap(I=>I.variants&&I.variants.length>0?I.variants:[I]),x=I=>{I?i.value=w():i.value=[],U()},F=I=>{const T=i.value.findIndex(Q=>Q.id===I.id);T>-1?i.value.splice(T,1):i.value.push(I),U()},L=I=>i.value.some(T=>T.id===I.id),U=()=>{const I=w(),T=i.value.length;T===0?(c.value=!1,p.value=!1):T===I.length?(c.value=!0,p.value=!1):(c.value=!1,p.value=!0)},S=I=>{m.value&&m.value.openHistory({id:I.id,name:I.variation_title||I.post_title})},M=()=>{g.value=!g.value};return(I,T)=>{var D,H,P,G,J,oe,Z,W;const Q=B("el-button"),E=B("el-checkbox");return r(),h("div",dY,[o("div",uY,[i.value.length>0?(r(),h("div",cY,f(i.value.length)+" "+f(A(u)("selected")),1)):k("",!0),o("div",AY,[i.value.length>0?(r(),$(Q,{key:0,type:"primary",size:"small",onClick:C},{default:d(()=>[R(f(A(u)("Update Stocks")),1)]),_:1})):k("",!0),n(Q,{class:"fct-expand-row-button",size:"small",onClick:M},{default:d(()=>[n(ee,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+f(g.value?A(u)("Collapse All"):A(u)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",pY,[o("table",fY,[o("colgroup",null,[T[3]||(T[3]=o("col",{width:"50"},null,-1)),T[4]||(T[4]=o("col",null,null,-1)),(D=e.inventoryTable)!=null&&D.isColumnVisible("sku")?(r(),h("col",mY)):k("",!0),T[5]||(T[5]=o("col",{width:"160"},null,-1)),(H=e.inventoryTable)!=null&&H.isColumnVisible("available")?(r(),h("col",hY)):k("",!0),(P=e.inventoryTable)!=null&&P.isColumnVisible("on_hand")?(r(),h("col",_Y)):k("",!0),(G=e.inventoryTable)!=null&&G.isColumnVisible("committed")?(r(),h("col",vY)):k("",!0),T[6]||(T[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",gY,[n(E,{modelValue:c.value,"onUpdate:modelValue":T[0]||(T[0]=pe=>c.value=pe),indeterminate:p.value,onChange:x},null,8,["modelValue","indeterminate"])]),o("th",null,f(A(u)("Products")),1),(J=e.inventoryTable)!=null&&J.isColumnVisible("sku")?(r(),h("th",yY,f(A(u)("SKU")),1)):k("",!0),o("th",null,f(A(u)("Total Stock")),1),(oe=e.inventoryTable)!=null&&oe.isColumnVisible("available")?(r(),h("th",bY,f(A(u)("Available")),1)):k("",!0),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("on_hand")?(r(),h("th",wY,f(A(u)("On hold")),1)):k("",!0),(W=e.inventoryTable)!=null&&W.isColumnVisible("committed")?(r(),h("th",CY,f(A(u)("Delivered")),1)):k("",!0),T[7]||(T[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(O,null,ae(e.data,pe=>(r(),h(O,{key:y(pe)},[!pe.variants||pe.variants.length===1?(r(),$(Yz,{key:0,row:pe,"inventory-table":e.inventoryTable,"is-row-selected":L,"toggle-row-selection":F,"navigate-to-product":v,"get-placeholder-image":I.getPlaceholderImage,onStockSave:T[1]||(T[1]=N=>s("stock-save",N)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image"])):k("",!0),pe.variants&&pe.variants.length>1?(r(),$(_q,{key:1,row:pe,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":I.getPlaceholderImage,"is-row-selected":L,"toggle-row-selection":F,expanded:g.value,onStockSave:T[2]||(T[2]=N=>s("stock-save",N)),onOpenHistory:S},null,8,["row","inventory-table","get-placeholder-image","expanded"])):k("",!0)],64))),128))])])])):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No inventory data")},null,8,["text"])),n(rY,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:b},null,8,["selected-items"]),n(Hq,{ref_key:"historyRef",ref:m},null,512)])}}}),BY={class:"fct-advanced-inventory-table"},kY={class:"fct-inventory-toolbar-wrap"},xY={class:"fct-inventory-toolbar-actions ml-auto"},SY={class:"fct-advanced-inventory-table-wrap"},FY={class:"fct-advanced-inventory-table"},$Y={key:0,width:"150"},EY={key:1,width:"100"},UY={key:2,width:"100"},IY={key:3,width:"100"},QY={width:"50"},DY={key:0},VY={key:1},TY={key:2},MY={key:3},LY={class:"fct-product-info-card"},RY={class:"fct-product-info-media"},OY={class:"fct-product-info-details"},HY={key:0},PY={key:1},NY={key:2},KY={key:3},GY={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=K(()=>Array.from({length:t.nextPageCount/2},(l,s)=>s+1));return(l,s)=>{const i=B("el-skeleton-item"),c=B("el-skeleton");return r(),$(c,{animated:""},{template:d(()=>{var p,m,_,g,y,v,C,b;return[o("div",BY,[o("div",kY,[o("div",xY,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",SY,[o("table",FY,[o("colgroup",null,[s[0]||(s[0]=o("col",{width:"50"},null,-1)),s[1]||(s[1]=o("col",null,null,-1)),(p=e.inventoryTable)!=null&&p.isColumnVisible("sku")?(r(),h("col",$Y)):k("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(m=e.inventoryTable)!=null&&m.isColumnVisible("available")?(r(),h("col",EY)):k("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",UY)):k("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",IY)):k("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",QY,[n(i,{variant:"p",class:"w-4 h-4"})]),o("th",null,[n(i,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(r(),h("th",DY,[n(i,{variant:"p",class:"w-10"})])):k("",!0),o("th",null,[n(i,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),h("th",VY,[n(i,{variant:"p",class:"w-20"})])):k("",!0),(C=e.inventoryTable)!=null&&C.isColumnVisible("on_hand")?(r(),h("th",TY,[n(i,{variant:"p",class:"w-16"})])):k("",!0),(b=e.inventoryTable)!=null&&b.isColumnVisible("committed")?(r(),h("th",MY,[n(i,{variant:"p",class:"w-20"})])):k("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(O,null,ae(a.value,w=>{var x,F,L,U;return r(),h("tr",{key:w},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",LY,[o("div",RY,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",OY,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(x=e.inventoryTable)!=null&&x.isColumnVisible("sku")?(r(),h("td",HY,[n(i,{variant:"p",class:"w-20"})])):k("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),(F=e.inventoryTable)!=null&&F.isColumnVisible("available")?(r(),h("td",PY,[n(i,{variant:"p",class:"w-10"})])):k("",!0),(L=e.inventoryTable)!=null&&L.isColumnVisible("on_hand")?(r(),h("td",NY,[n(i,{variant:"p",class:"w-10"})])):k("",!0),(U=e.inventoryTable)!=null&&U.isColumnVisible("committed")?(r(),h("td",KY,[n(i,{variant:"p",class:"w-10"})])):k("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},jY={class:"fct-module-disabled-notice"},zY={class:"fct-disabled-notice-title"},qY={class:"fct-disabled-notice-text"},YY=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=B("el-icon"),s=B("router-link");return r(),h("div",jY,[n(l,{class:"fct-disabled-notice-icon"},{default:d(()=>[n(A(Mf))]),_:1}),o("h3",zY,f(A(u)("Stock Management Inactive")),1),o("p",qY,[R(f(A(u)("Stock Management module is currently disabled. Please enable it in "))+" ",1),n(s,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(f(A(u)("module settings")),1)]),_:1}),R(" "+f(A(u)(" to use inventory features.")),1)])])}}});class WY extends Fs{getTabs(){return{all:u("All"),low_stock:u("Low Stock"),out_of_stock:u("Out of Stock")}}getToggleableColumns(){return[{label:u("SKU"),value:"sku"},{label:u("Available"),value:"available"},{label:u("On hold"),value:"on_hand"},{label:u("Committed"),value:"committed"}]}getSortableColumns(){return[{label:u("Product ID"),value:"id"},{label:u("Product Title"),value:"post_title"}]}getSearchHint(){return u("Search by product name, variation name or SKU")}getFetchUrl(){return"inventory"}parseResponse(t){return t.products||[]}getTableName(){return"inventory_table"}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}getSearchGuideOptions(){return{}}getCustomColumns(){return{}}with(){return["detail","variants"]}}function XY(e){return WY.init(e)}const JY={class:"fct-all-inventory-page fct-layout-width"},ZY={class:"fct-inventory-wrap"},eW={key:2,class:"py-10"},tW={class:"fct-pro-feature-text"},aW=Object.assign({name:"Inventory"},{__name:"Inventory",setup(e){const t=ze.get("app_config"),a=K(()=>t==null?void 0:t.isProActive),l=ze.get("modules_settings"),s=K(()=>{var C;return((C=l==null?void 0:l.stock_management)==null?void 0:C.active)==="yes"}),i=K(()=>{var C;return((C=l==null?void 0:l.stock_management)==null?void 0:C.enable_advanced_inventory)==="yes"}),c=K(()=>a.value&&s.value&&i.value),p=XY({instance:zt(),fetch:!1}),m=V(0),_=V([]),g=C=>{m.value=C.count,_.value=C.selectedItems||[]},y=()=>{p.fetch()},v=C=>{const{variant:b,newStock:w,reason:x,customReason:F}=C;let L=parseInt(w);b.total_stock=L<0?0:L;let U=parseInt(b.total_stock)-parseInt(b.committed)-parseInt(b.on_hold);b.available=U<0?0:U,ce.post("inventory/update-stock",{variant_id:b.id,post_id:b.post_id,new_stock:b.total_stock,reason:x,customReason:F||""}).then(S=>{z.success(u(S.message))}).catch(S=>{var M;S.status_code=="422"?z.validationErrors(S):z.error((M=S.data)==null?void 0:M.message)})};return Qe(()=>{c.value&&p.fetch()}),(C,b)=>{const w=B("router-link");return r(),h("div",JY,[n(ll,{title:A(u)("Inventory")},{action:d(()=>[n(Pt,{permission:"products/view"})]),_:1},8,["title"]),c.value?(r(),$(Pt,{key:0,permission:"products/view"},{default:d(()=>[o("div",ZY,[n($s,{table:A(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[n(ac,{data:A(p).getTableData(),"inventory-table":A(p),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:d(()=>[A(p).isLoading()?(r(),$(GY,{key:0,"next-page-count":A(p).nextPageCount,"inventory-table":A(p)},null,8,["next-page-count","inventory-table"])):(r(),$(ac,{key:1,data:A(p).getTableData(),"inventory-table":A(p),onStockSave:v,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),h("div",eW,[n(Vn,{title:A(u)("Advanced Inventory")},{default:d(()=>[o("p",tW,[R(f(A(u)("This feature is only available in FluentCart Pro with "))+" ",1),n(w,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(f(A(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),$(YY,{key:1}))])}}}),lW={class:"setting-wrap"},sW={class:"setting-wrap-inner"},nW={key:0,class:"fct-all-notification-table-wrap"},oW={class:"fct-card-header"},iW={class:"w-full pb-2"},rW={class:"flex items-center justify-between gap-2 pb-2"},dW={class:"flex-1"},uW={style:{width:"120px"}},cW={class:"flex items-center justify-between gap-3",style:{width:"220px"}},AW={key:1,class:"fct-all-notification-table-wrap"},pW=["id"],fW={class:"fct-card-header"},mW={class:"w-full pb-2"},hW={class:"flex items-center justify-between gap-2 pb-2"},_W={class:"m-0 text-sm font-semibold text-system-dark dark:text-gray-50"},vW={class:"text-xs text-system-mid dark:text-gray-300"},gW={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},yW={class:"m-0 mb-1"},bW={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},wW={class:"m-0 text-sm"},CW={class:"fct-all-notification-actions flex items-center justify-between gap-3"},BW={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},kW={class:"fct-btn-group sm flex-shrink-0"},xW={__name:"EmailNotificationSettings",setup(e){const t=al(),a=V(!0),l=V([]),s=K(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(m=>{const _=(m==null?void 0:m.group)||"other";p[_]||(p[_]={key:_,label:(m==null?void 0:m.group_label)||u("Other Actions"),items:[]}),p[_].items.push(m)}),Object.values(p)}),i=()=>{a.value=!0,ce.get("email-notification").then(p=>{l.value=Object.values(p.data)}).catch(p=>{}).finally(()=>{a.value=!1,Se(()=>{requestAnimationFrame(()=>Zs.scrollToHashSection(t.hash))})})},c=(p,m)=>{ce.post("email-notification/enable-notification/"+m,{active:p}).then(_=>{z.success(_.message)}).catch(_=>{var g;_.status_code=="422"?z.validationErrors(_):z.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Qe(()=>{i()}),(p,m)=>{const _=B("el-skeleton-item"),g=B("el-skeleton"),y=B("router-link"),v=B("el-table-column"),C=B("el-switch"),b=B("el-tooltip"),w=B("el-table");return r(),h("div",lW,[n(Ea,{heading:A(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",sW,[n(Ua),a.value?(r(),h("div",nW,[(r(),h(O,null,ae(2,x=>o("div",{key:x,class:"fct-card fct-notification-group mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[n(g,{animated:""},{template:d(()=>[o("div",oW,[o("div",iW,[o("div",rW,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(O,null,ae(4,F=>o("div",{key:F,class:"flex items-center gap-4 px-4 py-4 border-t border-solid border-x-0 border-b-0 border-gray-divider dark:border-dark-400"},[o("div",dW,[n(_,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),n(_,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),o("div",uW,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",cW,[n(_,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),n(_,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(r(),h("div",AW,[s.value.length?(r(!0),h(O,{key:0},ae(s.value,x=>(r(),h("div",{key:x.key,id:x.key,class:"fct-card fct-notification-group mx-5 mb-4 last:mb-0 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[o("div",fW,[o("div",mW,[o("div",hW,[o("h4",_W,f(x.label),1),o("span",vW,f(x.items.length)+" "+f(A(u)("Notifications")),1)]),x.key==="scheduler"?(r(),h("p",gW,[R(f(A(u)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),n(y,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:d(()=>[R(f(A(u)("reminder settings")),1)]),_:1})])):k("",!0)])]),n(w,{data:x.items,"show-header":!0},{default:d(()=>[n(v,{prop:"title",label:A(u)("Notification Name"),"min-width":"320"},{default:d(F=>[o("h4",yW,f(F.row.title),1),o("p",bW,f(F.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:A(u)("Recipient"),"min-width":"120"},{default:d(F=>[o("p",wW,f(A(oa).headline(F.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:A(u)("Enabled"),"min-width":"220"},{default:d(F=>{var L,U,S;return[o("div",CW,[((L=F.row)==null?void 0:L.manage_toggle)!=="no"?(r(),$(C,{key:0,onChange:M=>c(M,F.row.name),modelValue:F.row.settings.active,"onUpdate:modelValue":M=>F.row.settings.active=M,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):k("",!0),((U=F.row)==null?void 0:U.manage_toggle)==="no"?(r(),h("span",BW,f(((S=F.row)==null?void 0:S.toggle_label)||A(u)("Auto-enabled")),1)):k("",!0),o("div",kW,[n(b,{effect:"dark",content:A(u)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{to:{name:"email_notifications/edit",params:{name:F.row.name}},size:"x-small",hover:"primary"},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])],8,pW))),128)):(r(),$(_t,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:A(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},SW={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""}},setup(e){const t=e,a=ze.get("app_config.isProActive"),l=ze.get("app_config.proVersion"),s=a&&l&&l.localeCompare(t.minVersion,void 0,{numeric:!0})<0,i=u("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(c,p)=>{const m=B("el-alert");return A(a)&&!A(s)?Ca(c.$slots,"default",{key:0}):A(s)?(r(),$(m,{key:1,type:"warning","show-icon":"",closable:!1,title:A(u)("Update Required"),description:A(i)},null,8,["title","description"])):(r(),$(Vn,{key:2,title:e.featureTitle,text:e.featureText},null,8,["title","text"]))}}},FW={class:"setting-wrap fct-edit-email-notification-wrapper"},$W={class:"capitalize"},EW={class:"setting-wrap-inner"},UW={class:"mb-5"},IW={class:"setting-switcher flex items-center gap-3"},QW={class:"text-sm text-system-dark dark:text-gray-50"},DW={class:"fct-card p-6"},VW={class:"mb-5"},TW={class:"el-form-item__label block mb-2"},MW={class:"mb-5"},LW={class:"el-form-item__label block mb-2"},RW={class:"el-form-item__label block mb-2"},OW={class:"mb-5"},HW={key:0,class:"setting-switcher"},PW={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},NW={class:"fct-seg-wrap"},KW={key:0,class:"fct-default-template-preview"},GW={class:"el-form-item__label"},jW={key:1,class:"fct-default-template-frame"},zW=["srcdoc"],qW={key:2,class:"mb-4"},YW={class:"setting-save-action"},WW={key:0,style:{height:"300px"}},XW={class:"fct-preview-toolbar"},JW={class:"fct-preview-device-toggle"},ZW={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=ze.get("app_config.isProActive"),a=e,l=V(!1),s=V(!1),i=V(a.name),c=V({title:"",description:"",event:"",name:"",recipient:"",smartcode_groups:[],template_path:"",is_async:!1,settings:{active:"",is_default_body:"yes",email_body:"",subject:"",attach_pdf_template:""}}),p=V(null),m=V({}),_=V(!1),g=V(!1),y=V([]),v=V(!1),C=V(!1),b=V(""),w=V("desktop"),x=V(null),F=()=>{v.value=!0,C.value=!0,b.value="",ce.post("email-notification/preview",{notification_name:i.value,block_content:c.value.settings.email_body||""}).then(H=>{b.value=H.html,C.value=!1,Se(()=>L())}).catch(H=>{var P;z.error(((P=H.data)==null?void 0:P.message)||"Failed to generate preview"),v.value=!1,C.value=!1})},L=()=>{const H=x.value;if(!H||!b.value)return;const P=H.contentDocument||H.contentWindow&&H.contentWindow.document;P&&(P.open(),P.write(b.value),P.close())},U=()=>{Se(()=>{b.value&&L()})},S=()=>{v.value=!1,b.value="",w.value="desktop"},M=V(""),I=V(!1),T=()=>{var P;const H=(P=c.value)==null?void 0:P.template_path;!H||M.value||(I.value=!0,ce.post("email-notification/preview-default-template",{template:H}).then(G=>{var J;M.value=((J=G.data)==null?void 0:J.content)||""}).catch(()=>{}).finally(()=>{I.value=!1}))};Ce(()=>c.value.settings.is_default_body,H=>{H==="yes"&&!M.value&&T()});const Q=H=>{c.value.settings.subject+=H},E=()=>{l.value=!0,ce.get("email-notification/"+i.value).then(H=>{c.value=H.data,m.value=H.shortcodes,g.value=H.has_fluent_pdf||!1,y.value=H.pdf_templates||[],c.value.settings.is_default_body==="yes"&&T()}).catch(H=>{var P;H.status_code=="422"?z.validationErrors(H):z.error((P=H.data)==null?void 0:P.message)}).finally(()=>{l.value=!1})},D=()=>{s.value=!0;const H=JSON.parse(JSON.stringify(c.value));H.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),ce.put("email-notification/"+i.value,H).then(P=>{z.success(P.message)}).catch(P=>{var G;P.status_code=="422"?z.validationErrors(P):z.error((G=P.data)==null?void 0:G.message)}).finally(()=>{s.value=!1})};return Qe(()=>{E()}),(H,P)=>{var he;const G=B("el-breadcrumb-item"),J=B("el-breadcrumb"),oe=B("el-skeleton-item"),Z=B("el-skeleton"),W=B("el-switch"),pe=B("el-input"),N=B("el-form-item"),j=B("el-form"),q=B("el-option"),X=B("el-select"),ie=B("el-button"),ge=B("el-drawer"),fe=Va("loading");return r(),h("div",FW,[n(Ea,{loading:s.value,"loading-text":A(u)("Updating"),"save-button-text":A(u)("Update"),onOnSave:D},{heading:d(()=>[n(J,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[n(G,{to:{path:"/settings/email_notifications"}},{default:d(()=>[R(f(H.$t("Email Notifications")),1)]),_:1}),n(G,null,{default:d(()=>[o("span",$W,f(c.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",EW,[n(Ua),l.value?(r(),$(Z,{key:0,animated:""},{template:d(()=>[o("div",UW,[o("div",IW,[n(oe,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",QW,f(A(u)("Enable this email notification!")),1)])]),o("div",DW,[o("div",VW,[o("label",TW,f(A(u)("Email Subject")),1),n(oe,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",MW,[o("label",LW,f(A(u)("Email Body Type")),1),n(oe,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",RW,f(A(u)("Email Body")),1),n(sr)])])]),_:1})):k("",!0),l.value?k("",!0):(r(),h(O,{key:1},[o("div",OW,[((he=c.value)==null?void 0:he.manage_toggle)!=="no"?(r(),h("div",HW,[n(W,{modelValue:c.value.settings.active,"onUpdate:modelValue":P[0]||(P[0]=le=>c.value.settings.active=le),"active-value":"yes","inactive-value":"no","active-text":A(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",PW,f(A(u)("Auto-enabled for offline payments")),1))]),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(j,{"label-position":"top"},{default:d(()=>[n(N,{label:A(u)("Email Subject")},{default:d(()=>[n(pe,{modelValue:c.value.settings.subject,"onUpdate:modelValue":P[1]||(P[1]=le=>c.value.settings.subject=le),autocomplete:"rutjfkde",class:de({"is-focus":_.value}),onFocus:P[2]||(P[2]=le=>_.value=!0),onBlur:P[3]||(P[3]=le=>_.value=!1),label:A(u)("Email Subject")},{append:d(()=>[n(Rc,{data:m.value,onCommand:Q,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:d(()=>[R(f(A(u)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),n(N,{label:A(u)("Email Body Type")},{default:d(()=>[o("div",NW,[o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="yes"}]),onClick:P[4]||(P[4]=le=>c.value.settings.is_default_body="yes")},[P[13]||(P[13]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o("path",{d:"M9 9h6M9 13h6M9 17h4"})],-1)),R(" "+f(A(u)("Default Body")),1)],2),o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="no"}]),onClick:P[5]||(P[5]=le=>c.value.settings.is_default_body="no")},[P[14]||(P[14]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M12 20h9"}),o("path",{d:"M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),R(" "+f(A(u)("Customized Body"))+" ",1),A(t)?k("",!0):(r(),$(ee,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),c.value.settings.is_default_body==="yes"?(r(),h("div",KW,[o("label",GW,f(A(u)("Email Body")),1),I.value?(r(),$(sr,{key:0})):M.value?(r(),h("div",jW,[n(_o,{type:"warning",class:"mb-3","show-icon":"",description:A(u)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("iframe",{srcdoc:M.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,zW)])):k("",!0)])):k("",!0),c.value.settings.is_default_body==="no"&&!l.value?(r(),$(SW,{key:1,"min-version":"1.3.15","feature-title":A(u)("Custom Email Templates"),"feature-text":A(u)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:d(()=>[n(N,{label:A(u)("Email Body")},{default:d(()=>[n(_o,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),n(jc,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"template",campaign_title:c.value.settings.subject,bid:c.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:c.value.settings.subject,onTitleUpdated:P[6]||(P[6]=le=>{c.value.settings.subject=le}),onPreviewRequest:F,modelValue:c.value.settings.email_body,"onUpdate:modelValue":P[7]||(P[7]=le=>c.value.settings.email_body=le)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):k("",!0)]),_:1})]),_:1})]),_:1})],64)),g.value&&y.value.length?(r(),h("div",qW,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(j,{"label-position":"top"},{default:d(()=>[n(N,{label:A(u)("Attach PDF Template")},{default:d(()=>[n(X,{modelValue:c.value.settings.attach_pdf_template,"onUpdate:modelValue":P[8]||(P[8]=le=>c.value.settings.attach_pdf_template=le),placeholder:A(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(O,null,ae(y.value,le=>(r(),$(q,{key:le.id,label:le.title,value:le.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):k("",!0),o("div",YW,[n(ie,{onClick:D,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(f(A(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(ge,{modelValue:v.value,"onUpdate:modelValue":P[12]||(P[12]=le=>v.value=le),direction:"rtl",size:"70%",title:A(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:U},{footer:d(()=>[n(ie,{onClick:S},{default:d(()=>[R(f(A(u)("Close")),1)]),_:1})]),default:d(()=>[C.value?jt((r(),h("div",WW,null,512)),[[fe,!0]]):k("",!0),!C.value&&b.value?(r(),h(O,{key:1},[o("div",XW,[o("div",JW,[o("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="desktop"}]),onClick:P[9]||(P[9]=le=>w.value="desktop")},[P[15]||(P[15]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o("path",{d:"M8 21h8"}),o("path",{d:"M12 17v4"})],-1)),o("span",null,f(A(u)("Desktop")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="tablet"}]),onClick:P[10]||(P[10]=le=>w.value="tablet")},[P[16]||(P[16]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(A(u)("Tablet")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:w.value==="mobile"}]),onClick:P[11]||(P[11]=le=>w.value="mobile")},[P[17]||(P[17]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,f(A(u)("Mobile")),1)],2)])]),n(_o,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("div",{class:de(["fct-preview-stage","fct-preview-stage--"+w.value])},[o("div",{class:de(["fct-device-frame","fct-device-frame--"+w.value])},[o("iframe",{ref_key:"previewIframe",ref:x,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):k("",!0)]),_:1},8,["modelValue","title"])])}}},eX={name:"StorageSettings",components:{Badge:Aa,CardBody:ke,CardContainer:xe,SettingsHeader:Ea,AdminNotice:Ua},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:u,getLogo(e){return e},getDarkLogo(e){return e||null},getRowLabel(e){return`${this.translate("Manage storage provider")}: ${e.title}`},getToggleLabel(e){return`${this.translate("Toggle storage driver status")}: ${e.title}`},canToggle(e){return!e.has_bucket&&!e.requires_pro},canManage(e){return!!e.route||!!e.upgrade_url},handleDriverAction(e){if(e.upgrade_url&&!e.route){window.open(e.upgrade_url,"_blank","noopener,noreferrer");return}e.route&&this.$router.push({name:e.route})},toggleStatus(e){const t=e.is_active_input,a=t==="yes"?"no":"yes";e.saving=!0,this.$post("settings/storage-drivers/change-status",{driver:e.route,status:t}).then(l=>{e.status=t==="yes",this.$notify({type:"success",title:this.translate("Success"),message:l.message})}).catch(l=>{e.is_active_input=a,this.handleError(l)}).finally(()=>{e.saving=!1})},getStorageDrivers(){this.loading=!0,this.$get("settings/storage-drivers").then(e=>{this.availableDrivers=Object.values(e.drivers||{}).map(t=>({...t,is_active_input:t.status?"yes":"no",saving:!1}))}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})}}},tX={class:"setting-wrap"},aX={class:"setting-wrap-inner"},lX={key:0,class:"storage-setting-list fct-content-card-list"},sX=["role","tabindex","aria-label","onClick","onKeydown"],nX={class:"flex items-start gap-3"},oX=["src","alt"],iX=["src","alt"],rX={class:"flex-1 min-w-0 pl-15"},dX={class:"fct-content-card-list-head"},uX={class:"title-wrap"},cX={class:"fct-content-card-list-content"},AX=["src","alt"];function pX(e,t,a,l,s,i){const c=B("SettingsHeader"),p=B("AdminNotice"),m=B("el-skeleton"),_=B("Badge"),g=B("el-switch"),y=B("el-button"),v=B("CardBody"),C=B("CardContainer");return r(),h("div",tX,[n(c,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",aX,[n(p),n(C,null,{default:d(()=>[n(v,null,{default:d(()=>[n(m,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?k("",!0):(r(),h("div",lX,[(r(!0),h(O,null,ae(s.availableDrivers,(b,w)=>(r(),h("div",{key:b.route||w,class:de(["fct-content-card-list-item",i.canManage(b)?"cursor-pointer":""]),role:i.canManage(b)?"button":void 0,tabindex:i.canManage(b)?0:-1,"aria-label":i.getRowLabel(b),onClick:x=>i.handleDriverAction(b),onKeydown:[$a(Ne(x=>i.handleDriverAction(b),["prevent"]),["enter"]),$a(Ne(x=>i.handleDriverAction(b),["prevent"]),["space"])]},[o("div",nX,[o("div",{class:de(`fct-content-card-list-icon ${b.title.toLowerCase()}`)},[o("img",{class:de({"dark:hidden":i.getDarkLogo(b.dark_logo)}),src:i.getLogo(b.logo),alt:b.title},null,10,oX),i.getDarkLogo(b.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,iX)):k("",!0)],2),o("div",rX,[o("div",dX,[o("div",uX,[o("h6",null,f(b.title),1)]),n(_,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",cX,[o("p",null,f(b.description),1)])]),i.canToggle(b)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ne(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ne(()=>{},["stop"]))},[n(g,{modelValue:b.is_active_input,"onUpdate:modelValue":x=>b.is_active_input=x,"active-value":"yes","inactive-value":"no",loading:b.saving,"aria-label":i.getToggleLabel(b),onChange:x=>i.toggleStatus(b)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.canManage(b)?(r(),h("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=Ne(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Ne(()=>{},["stop"]))},[n(y,{class:"el-button--x-small",onClick:x=>i.handleDriverAction(b)},{default:d(()=>{var x;return[b.requires_pro?(r(),h("img",{key:0,src:((x=e.appVars)==null?void 0:x.asset_url)+"images/crown.svg",alt:i.translate("Pro feature"),class:"pro-feature-icon"},null,8,AX)):k("",!0),R(" "+f(i.translate("Manage")),1)]}),_:2},1032,["onClick"])],32)):k("",!0)])],42,sX))),128))]))]),_:1})]),_:1})])])}const fX=lt(eX,[["render",pX]]),mX={class:"fct-setting-header"},hX={key:0,class:"fct-setting-header-action"},_X={class:"setting-wrap-inner"},lc={__name:"GlobalStorageComponents",setup(e){const t=V({}),a=V(""),l=V({}),s=V(!1),i=V(!1),c=V(""),p=ud(),m=V({}),_=K(()=>!!a.value),g=al(),y=fs(),v=()=>{i.value=!0,ce.get("settings/storage-drivers/"+c.value).then(w=>{t.value=w.settings||{},a.value=w.template||"",l.value=w.template_payload||{},m.value={},w.template||p.setSchema(w.fields).setDefaults(w.settings).initForm()}).catch(w=>{var x;t.value={},a.value="",l.value={},m.value={},p.setSchema({}).setDefaults({}),z.error(((x=w==null?void 0:w.data)==null?void 0:x.message)||u("Failed to load storage settings."))}).finally(()=>{i.value=!1})},C=()=>{if(_.value)return;let w=p.values;s.value=!0,ce.post("settings/storage-drivers",{settings:{...w},driver:c.value}).then(x=>{var F;t.value.is_active=(F=x.data)==null?void 0:F.is_active,z.success(x.message||u("Storage Settings updated!")),p.values=x.data,x.data.shouldReload&&v()}).catch(x=>{var F;x.status_code=="422"?z.validationErrors(x):z.error((F=x.data)==null?void 0:F.message)}).finally(()=>{s.value=!1})},b=()=>{c.value=g.name};return Ce(g,(w,x)=>{b(),v()}),y.onSave(()=>{_.value||C()}),Qe(()=>{b(),v()}),(w,x)=>{const F=B("el-breadcrumb-item"),L=B("el-breadcrumb"),U=B("el-button"),S=B("el-skeleton");return r(),h("div",{class:de(["setting-wrap",c.value])},[o("div",mX,[n(L,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[n(F,{to:{name:"storage"}},{default:d(()=>[R(f(A(u)("Storage Providers")),1)]),_:1}),A(oa).headline(c.value)?(r(),$(F,{key:0},{default:d(()=>[R(f(A(oa).headline(c.value)),1)]),_:1})):k("",!0)]),_:1},8,["separator-icon"]),_.value?k("",!0):(r(),h("div",hX,[n(U,{type:"primary",onClick:C,loading:s.value,disabled:s.value||i.value,size:"small"},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",_X,[n(Ua),i.value?(r(),$(xe,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(S,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(O,{key:1},[_.value?(r(),$(Ap,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:c.value}},null,8,["widget","data"])):(r(),$(vi,{key:1,form:A(p),showSubmitButton:!1,loading:s.value,onOnChange:x[0]||(x[0]=M=>{}),"validation-errors":m.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},vX=["innerHTML"],gX={class:"fct-select-template-wrap"},yX={class:"fct-select-template-wrap flex gap-2 flex-row"},bX={class:"setting-save-action"},wX={__name:"AddEmailNotification",setup(e){const t=zt().ctx,a=V(),l=V(!0),s=V(!1),i=V({}),c=V(),p=V([{label:u("After Order Created"),value:"fluent_cart/order_created"},{label:u("After Order Updated"),value:"fluent_cart/order_updated"},{label:u("After Payment Paid"),value:"fluent_cart/order_paid"},{label:u("After User Created"),value:"fluent_cart/user_created"},{label:u("After Refund made"),value:"fluent_cart/order_refunded"}]),m=V({}),_=V([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=V({}),y=V({});tl(),al();let v=null;const C=V([]),b=V([]),w=V({});fs().onSave(()=>{S()});const F=D=>{const H=D;t.$post("email-notification/getTemplate/",{template:H}).then(P=>{var G;i.value.content=P.data.content,(G=a.value)==null||G.setContent(i.value.content)}).catch(P=>{}).finally(()=>{l.value=!1})},L=()=>{var D;(D=a.value)==null||D.setContent("")},U=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(D=>{m.value=D.data.shortcodes,g.value=D.data.email_templates,y.value=Object.keys(D.data.buttons).map(H=>({[H]:D.data.buttons[H]}))}).catch(D=>{}).finally(()=>{l.value=!1})},S=D=>{D&&D.preventDefault(),w.value={},l.value=!0,t.$post("email-notification/create",i.value).then(H=>{t.handleSuccess(H)}).catch(H=>{var P;H.status_code=="422"?(z.validationErrors(H),w.value=H.data):z.error((P=H.data)==null?void 0:P.message)}).finally(()=>{l.value=!1})},M=()=>{s.value=!0,c.value=i.value.content};Qe(()=>{U()});const I=D=>{v=D},T=D=>{w.value&&w.value.hasOwnProperty(D)&&delete w.value[D]},Q=()=>{i.value.to=C.value},E=()=>{i.value.from=b.value};return(D,H)=>{const P=B("el-dialog"),G=B("el-input"),J=B("el-form-item"),oe=B("el-option"),Z=B("el-select"),W=B("el-col"),pe=B("el-row"),N=B("el-tooltip"),j=B("el-button"),q=B("el-form");return r(),$(xe,null,{default:d(()=>[n(Ve,{title:i.value.title?i.value.title:A(u)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:d(()=>H[20]||(H[20]=[])),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(P,{modelValue:s.value,"onUpdate:modelValue":H[0]||(H[0]=X=>s.value=X),title:D.$t("Preview")},{default:d(()=>[o("div",{innerHTML:c.value},null,8,vX)]),_:1},8,["modelValue","title"]),n(q,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(J,{label:D.$t("Notification Name"),required:""},{default:d(()=>{var X,ie;return[n(G,{modelValue:i.value.title,"onUpdate:modelValue":H[1]||(H[1]=ge=>i.value.title=ge),onFocus:H[2]||(H[2]=ge=>T("title"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(X=w.value)==null?void 0:X.title)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(J,{label:D.$t("Select notification event"),required:""},{default:d(()=>{var X,ie;return[n(Z,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":H[3]||(H[3]=ge=>i.value.events=ge),placeholder:D.$t("Select Events"),onFocus:H[4]||(H[4]=ge=>T("events")),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(p.value,ge=>(r(),$(oe,{key:ge.value,label:ge.label,value:ge.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(X=w.value)==null?void 0:X.events)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(pe,{gutter:15},{default:d(()=>[n(W,{lg:12},{default:d(()=>[n(J,{label:D.$t("Mail From:"),required:""},{default:d(()=>{var X,ie;return[n(G,{modelValue:i.value.from,"onUpdate:modelValue":H[7]||(H[7]=ge=>i.value.from=ge),onFocus:H[8]||(H[8]=ge=>T("from")),placeholder:D.$t("Select a Field or Type Custom Value")},{append:d(()=>[n(Z,{modelValue:b.value,"onUpdate:modelValue":H[5]||(H[5]=ge=>b.value=ge),onChange:H[6]||(H[6]=ge=>E()),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(_.value,ge=>(r(),$(oe,{key:ge.value,label:ge.label,value:ge.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(fl,{"validation-errors":(ie=(X=w.value)==null?void 0:X.from)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(W,{lg:12},{default:d(()=>[n(J,{label:D.$t("Send Mail To:"),required:""},{default:d(()=>{var X,ie;return[n(G,{modelValue:i.value.to,"onUpdate:modelValue":H[11]||(H[11]=ge=>i.value.to=ge),onFocus:H[12]||(H[12]=ge=>T("to"))},{append:d(()=>[n(Z,{modelValue:C.value,"onUpdate:modelValue":H[9]||(H[9]=ge=>C.value=ge),onChange:H[10]||(H[10]=ge=>Q()),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(_.value,ge=>(r(),$(oe,{key:ge.value,label:ge.label,value:ge.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(fl,{"validation-errors":(ie=(X=w.value)==null?void 0:X.to)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(J,{label:D.$t("Cc:")},{default:d(()=>[n(G,{modelValue:i.value.cc,"onUpdate:modelValue":H[13]||(H[13]=X=>i.value.cc=X)},null,8,["modelValue"])]),_:1},8,["label"]),n(J,{label:D.$t("Mail Subject:"),required:""},{default:d(()=>{var X,ie;return[n(G,{modelValue:i.value.subject,"onUpdate:modelValue":H[14]||(H[14]=ge=>i.value.subject=ge),onFocus:H[15]||(H[15]=ge=>T("subject"))},null,8,["modelValue"]),n(fl,{"validation-errors":(ie=(X=w.value)==null?void 0:X.subject)==null?void 0:ie.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[n(Wl,{ref_key:"wpEditor",ref:a,"short-codes":m.value,buttons:y.value,onOnEditorReady:I,onUpdate:H[18]||(H[18]=X=>{i.value.content=X}),modelValue:i.value.content,"onUpdate:modelValue":H[19]||(H[19]=X=>i.value.content=X)},{action:d(()=>[o("div",gX,[n(Z,{onChange:H[16]||(H[16]=X=>{var ie;(ie=a.value)==null||ie.setContent(X)}),placeholder:D.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(y.value,(X,ie)=>(r(),$(oe,{key:ie,label:Object.keys(X)[0],value:Object.values(X)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",yX,[n(Z,{onChange:H[17]||(H[17]=X=>{F(X)}),placeholder:D.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(g.value,(X,ie)=>(r(),$(oe,{key:ie,label:X.label,value:X.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(N,{effect:"dark",content:D.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{onClick:Ne(L,["prevent"]),tag:"button"},{default:d(()=>[n(ee,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[A(v)!==null?(r(),$(N,{key:0,effect:"dark",content:D.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{onClick:Ne(M,["prevent"]),tag:"button"},{default:d(()=>[n(ee,{name:"Eye"})]),_:1})]),_:1},8,["content"])):k("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",bX,[n(j,{onClick:S,type:"primary",disabled:l.value,loading:l.value},{default:d(()=>[R(f(D.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class CX extends Fs{getTabs(){return{all:u("All"),success:u("Success"),warning:u("Warning"),error:u("Error"),failed:u("Failed"),info:u("Info"),api:u("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Created At"),value:"created_at"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"activity"}parseResponse(t){return t.activities}getTableName(){return"log_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}}function BX(e){return CX.init(e)}const kX={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},xX={class:"fct-table-mobile-header"},SX={class:"fct-table-date-col"},FX={class:"mark-read-unread-wrap"},$X=["onClick","title"],EX=["onClick","title"],UX=["title"],IX={class:"fct-table-mobile-body"},QX={key:0,class:"fct-table-title-col"},DX={key:1,class:"fct-table-content-col"},VX={class:"fct-table-mobile-footer"},TX={class:"fct-table-mobile-footer-row"},MX={class:"fct-table-status-col"},LX={class:"title"},RX={class:"fct-table-module-col"},OX={class:"title"},HX={class:"value"},PX={key:0,class:"fct-table-actions-col"},NX={class:"title"},KX={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,l=(s,i)=>{a("changeStatus",s,i)};return(s,i)=>{const c=B("el-icon"),p=B("router-link");return r(),h("div",kX,[(r(!0),h(O,null,ae(e.table.getTableData(),(m,_)=>(r(),h("div",{key:m.id,class:"fct-table-mobile-row"},[o("div",xX,[o("div",SX,[o("div",FX,[m.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(m,"unread"),title:A(u)("Mark as unread")},[n(c,null,{default:d(()=>[n(A(ko))]),_:1})],8,$X)):(r(),h("span",{key:1,onClick:g=>l(m,"read"),title:A(u)("Mark as read")},[n(c,null,{default:d(()=>[n(A(ti))]),_:1})],8,EX))]),o("div",{title:A(u)("Logs ID: %s",m.id),class:"invoice-no"}," #"+f(m.id),9,UX),e.table.isColumnVisible("date")?(r(),h(O,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Pa,{class:"date","date-time":m.created_at,"with-time":!0},null,8,["date-time"])],64)):k("",!0)])]),o("div",IX,[e.table.isColumnVisible("title")?(r(),h("div",QX,f(m.title),1)):k("",!0),e.table.isColumnVisible("content")?(r(),h("div",DX,f(m.content),1)):k("",!0)]),o("div",VX,[o("div",TX,[o("div",MX,[o("div",LX,f(A(u)("Status")),1),(r(),$(Aa,{status:m.status,size:"small",key:m.id},null,8,["status"]))]),o("div",RX,[o("div",OX,f(A(u)("Module")),1),o("div",HX,f(m.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",PX,[o("div",NX,f(A(u)("Actions")),1),m.module_id&&m.module_name.toLowerCase()==="order"?(r(),$(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:m.module_id}}},{default:d(()=>[R(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!0),m.module_id&&m.module_name.toLowerCase()==="subscription"?(r(),$(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:m.module_id}}},{default:d(()=>[R(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!0)])):k("",!0)])])]))),128))])}}},GX={},jX={class:"px-4 py-3"},zX={class:"grid grid-cols-3 gap-5 mt-5"};function qX(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),$(l,{animated:""},{template:d(()=>[o("div",jX,[(r(),h(O,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",zX,[(r(),h(O,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const YX=lt(GX,[["render",qX]]),WX={class:"table-cell"},XX={class:"table-cell"},JX={class:"table-cell"},ZX={class:"table-cell"},eJ={class:"table-cell"},tJ={class:"table-cell"},aJ={class:"table-cell"},lJ={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=B("el-skeleton-item"),c=B("el-skeleton"),p=B("el-table-column"),m=B("el-table");return r(),$(m,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(p,{width:100,label:A(u)("ID")},{default:d(()=>[o("div",WX,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),$(p,{key:0,label:A(u)("Date"),width:120},{default:d(()=>[o("div",XX,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.logTable.isColumnVisible("title")?(r(),$(p,{key:1,label:A(u)("Title"),width:200},{default:d(()=>[o("div",JX,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.logTable.isColumnVisible("content")?(r(),$(p,{key:2,label:A(u)("Content"),width:200},{default:d(()=>[o("div",ZX,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(p,{label:A(u)("Status"),width:100},{default:d(()=>[o("div",eJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Module"),width:100},{default:d(()=>[o("div",tJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),$(p,{key:3,label:A(u)("Actions"),width:100},{default:d(()=>[o("div",aJ,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},sJ={class:"fct-all-logs-page fct-layout-width"},nJ={key:1},oJ={class:"inline-flex items-center gap-1"},iJ=["onClick","title"],rJ=["onClick","title"],dJ={__name:"Logs",setup(e){const t=zt().ctx,a=BX(),l=V([]),s=(i,c)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:c}).then(p=>{l.value.find(m=>m.id===i.id).read_status=c,t.handleSuccess(p)}).catch(p=>{var m;p.status_code=="422"?z.validationErrors(p):z.error((m=p.data)==null?void 0:m.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,c)=>{const p=B("el-icon"),m=B("el-table-column"),_=B("el-button"),g=B("el-table");return r(),h("div",sJ,[n(ll,{title:A(u)("Logs")},null,8,["title"]),n($s,{table:A(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(a).isLoading()?(r(),$(YX,{key:0})):k("",!0),A(a).isLoading()?k("",!0):(r(),$(KX,{key:1,table:A(a),onChangeStatus:s},null,8,["table"]))]),default:d(()=>[A(a).isLoading()?(r(),$(lJ,{key:0,logTable:A(a),"next-page-count":A(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",nJ,[n(g,{class:"w-full",data:A(a).getTableData()},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any logs matching your filter.")},null,8,["text"])]),default:d(()=>[n(m,{label:A(u)("ID"),width:100},{default:d(y=>[o("div",oJ,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>s(y.row,"unread"),title:A(u)("Mark as unread"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(ko))]),_:1})],8,iJ)):(r(),h("span",{key:1,onClick:v=>s(y.row,"read"),title:A(u)("Mark as read"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(ti))]),_:1})],8,rJ)),R(" #"+f(A(Xt)(y.row.id)),1)])]),_:1},8,["label"]),A(a).isColumnVisible("date")?(r(),$(m,{key:0,label:A(u)("Date"),width:120},{default:d(y=>[n(Pa,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):k("",!0),A(a).isColumnVisible("title")?(r(),$(m,{key:1,label:A(u)("Title"),width:200},{default:d(y=>[R(f(y.row.title),1)]),_:1},8,["label"])):k("",!0),A(a).isColumnVisible("content")?(r(),$(m,{key:2,label:A(u)("Content"),width:200},{default:d(y=>[R(f(y.row.content),1)]),_:1},8,["label"])):k("",!0),n(m,{label:A(u)("Status"),width:100},{default:d(y=>[(r(),$(Aa,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),n(m,{label:A(u)("Module"),width:100},{default:d(y=>[R(f(y.row.module_name),1)]),_:1},8,["label"]),A(a).isColumnVisible("actions")?(r(),$(m,{key:3,label:A(u)("Actions"),width:80},{default:d(y=>[y.row.module_id&&y.row.module_name.toLowerCase()==="order"?(r(),$(_,{key:0,tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:y.row.module_id}}},{default:d(()=>[R(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!0),y.row.module_id&&y.row.module_name.toLowerCase()==="subscription"?(r(),$(_,{key:1,tag:"router-link",class:"el-button--x-small",to:{name:"view_subscription",params:{subscription_id:y.row.module_id}}},{default:d(()=>[R(f(A(u)("View")),1)]),_:2},1032,["to"])):k("",!0)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},uJ=["title"],cJ={__name:"RemoveButton",props:{filterKey:{type:String,required:!0},itemId:{type:[String,Number],default:null}},emits:["remove"],setup(e,{emit:t}){const a=e,l=t,s=()=>{l("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(i,c)=>(r(),h("button",{class:"fct-applied-filter-remove",onClick:s,title:i.$t("Remove")},[n(ee,{name:"Close"})],8,uJ))}},AJ={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(l,s)=>{const i=B("el-option"),c=B("el-select");return r(),$(c,{modelValue:A(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":s[0]||(s[0]=p=>A(a).data.selectedFilters[e.filterItemKey].value=p),placeholder:l.$t("Select Status"),filterable:"",onChange:A(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(O,null,ae(e.filterItem.options,p=>(r(),$(i,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])}}},Tp={__name:"DateRangeFilter",props:{modelValue:Array,type:{type:String,default:"daterange"},separator:{type:String,default:"-"},startPlaceholder:{type:String,default:""},endPlaceholder:{type:String,default:""},unlinkPanels:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placement:{type:String,default:"bottom-end"},showArrow:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},filterState:{type:[Object]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=V(null),c=K({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=K(()=>ze.get("app_config.isProActive"));function m(g){l("change",g)}function _(){s.data.dateRange=[ua.withTimezone(at().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ua.withTimezone(at().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return vl(()=>{}),(g,y)=>{const v=B("el-date-picker"),C=Va("translate-numbers");return r(),h("div",{class:de(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[jt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=b=>c.value=b),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||A(u)("Start date"),"end-placeholder":e.endPlaceholder||A(u)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:A(Lc),onChange:m,placement:e.placement,disabled:e.disabled||!p.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[C,"translate-numbers"]]),e.showArrow?(r(),$(ee,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):k("",!0),p.value&&e.clearable?(r(),$(ee,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):k("",!0)],2)}}},Mp={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=c=>{l("change",c)};return(c,p)=>{const m=B("el-option"),_=B("el-select");return r(),$(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),placeholder:c.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(O,null,ae(e.currencies,(g,y)=>(r(),$(m,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},pJ={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("button",{onClick:s[0]||(s[0]=(...i)=>A(a).resetFilters&&A(a).resetFilters(...i)),class:"reset-filters-btn"},f(l.$t("Reset Filters")),1))}},fJ={__name:"MultiselectFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const t=e,a=t.filterState,l=K({get:()=>{var s;return((s=a.data.selectedFilters[t.filterItemKey])==null?void 0:s.value)??[]},set:s=>{a.setMultiSelectChange(t.filterItemKey,s)}});return(s,i)=>{const c=B("el-option"),p=B("el-select");return r(),$(p,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=m=>l.value=m),placeholder:s.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:d(()=>[(r(!0),h(O,null,ae(e.filterItem.options,m=>(r(),$(c,{key:m.value,label:m.label,value:m},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},mJ={class:"fct-compare-to-filter"},hJ={class:"fct-applied-filter-label"},_J={class:"fct-applied-filter-actions"},vJ={class:"fct-compare-to-select"},gJ={class:"fct-compare-to-date"},yJ={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=K({get:()=>{var m;return((m=s.data.selectedFilters.compareType)==null?void 0:m.value)??s.data.compareType},set:m=>{s.setCompareTypeChange(m),l("selectChange",m)}}),c=K({get:()=>{var m;return((m=s.data.selectedFilters.compareDate)==null?void 0:m.value)??s.data.compareDate},set:m=>{s.setCompareDateChange(m),l("dateChange",m)}}),p=K(()=>ze.get("app_config.isProActive"));return(m,_)=>{const g=B("el-option"),y=B("el-select"),v=B("el-date-picker");return r(),h("div",mJ,[o("div",hJ,f(A(u)("Compare to")),1),o("div",_J,[o("div",vJ,[n(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=C=>i.value=C),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:d(()=>[n(g,{label:A(u)("Previous Period"),value:"previous_period"},null,8,["label"]),n(g,{label:A(u)("Previous Month"),value:"previous_month"},null,8,["label"]),n(g,{label:A(u)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),n(g,{label:A(u)("Previous Year"),value:"previous_year"},null,8,["label"]),n(g,{label:A(u)("Custom"),value:"custom"},null,8,["label"]),n(g,{label:A(u)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",gJ,[i.value==="custom"?(r(),$(v,{key:0,modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=C=>c.value=C),type:"date",size:"small",placeholder:A(u)("Select Date")},null,8,["modelValue","placeholder"])):k("",!0)])])])}}},bJ={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},wJ={key:0},Lp={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=V([]),s=V([]),i=V(!1),c=zt().ctx,p=v=>{const C=Lt.get("product_variations");if(C&&(l.value=C),l.value.length&&!v){s.value=[...l.value];return}if(v&&l.value.length){s.value=l.value.filter(b=>b.label.toLowerCase().includes(v.toLowerCase()));return}i.value=!0,c.$get("products/searchVariantByName",{name:v}).then(b=>{l.value=b,s.value=b,Lt.set("product_variations",b)}).catch(()=>{}).finally(()=>{i.value=!1})},m=(v,C)=>{const b=C.checkedNodes||[];a.setTreeSelectItem(b)},_=v=>{a.removeTreeSelectItem(v)},g=()=>{a.clearTreeSelect()},y=K(()=>{let v={},C={};s.value.forEach(w=>{v[w.label]=w.children,w.children.forEach(x=>{C[x.value]={productName:w.label,variationName:x.label}})});let b={};return a.data.variation_ids.forEach(w=>{if(C[w]){let x=C[w];b[x.productName]||(b[x.productName]=[]),b[x.productName].push(x.variationName)}else b.Unknown||(b.Unknown=[]),b.Unknown.push(w)}),Object.keys(b).forEach(w=>{var x;b[w].length===((x=v[w])==null?void 0:x.length)&&(b[w]=[])}),b});return Qe(()=>{const v=a.retrieveSavedReportFilters();v&&v.variation_ids&&(a.data.variation_ids=v.variation_ids),p("")}),(v,C)=>{const b=B("el-tag"),w=B("el-tree-select");return r(),$(w,{placeholder:v.$t("Select Products"),modelValue:A(a).data.variation_ids,"onUpdate:modelValue":C[0]||(C[0]=x=>A(a).data.variation_ids=x),data:s.value,"filter-method":A(ed).debounce(p),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:m,"popper-class":"fct-tooltip-long",onRemoveTag:_,onClear:g,size:"small"},{tag:d(()=>[o("div",bJ,[(r(!0),h(O,null,ae(y.value,(x,F)=>(r(),$(b,{style:{"margin-right":"4px"}},{default:d(()=>[R(f(F)+" ",1),x.length?(r(),h("span",wJ," | "+f(x.join(", ")),1)):k("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},CJ={class:"fct-applied-filters-wrap"},BJ={class:"fct-applied-filter-list"},kJ={class:"fct-applied-filter fct-applied-filter-date"},xJ={class:"fct-applied-filter-label"},SJ={class:"fct-applied-filter-value"},FJ={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},$J={class:"fct-applied-filter-label"},EJ={class:"fct-applied-filter-value"},UJ={key:2,class:"fct-applied-filter-clear-wrap"},IJ={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=al(),s=({filterKey:m,itemId:_})=>{a.removeFilter(m,_)},i=m=>!(["dateRange","compareType","compareDate"].includes(m)||l.name==="reports_customer"),c=K(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=K(()=>Object.keys(a.data.selectedFilters).filter(m=>!(m==="orderTypes"&&l.name==="reports_subscriptions")).reduce((m,_)=>(m[_]=a.data.selectedFilters[_],m),{}));return Ce(a.data.dateRange,m=>{}),(m,_)=>(r(),h("div",CJ,[o("ul",BJ,[o("li",kJ,[o("div",xJ,f(m.$t("Date:")),1),o("div",SJ,[n(Tp,{modelValue:A(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=g=>A(a).data.dateRange=g),placement:"bottom-start",reRenderDate:A(a).data.reRenderDate,showArrow:!0,size:"small",onChange:A(a).setDateRange,clearable:"",filterState:A(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),c.value?(r(),h("li",FJ,[n(yJ,{filterState:A(a)},null,8,["filterState"])])):k("",!0),Object.keys(p.value).length?(r(!0),h(O,{key:1},ae(p.value,(g,y)=>(r(),h(O,{key:y},[i(y)?(r(),h("li",{key:0,class:de(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",$J,f(g.label)+":",1),o("div",EJ,[g.type==="list"?(r(),$(AJ,{key:0,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):k("",!0),g.type==="multi-list"?(r(),$(fJ,{key:1,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),$(Lp,{key:2,"filter-state":A(a)},null,8,["filter-state"])):y==="currency"?(r(),$(Mp,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":_[1]||(_[1]=v=>A(a).data.currency=v),currencies:A(a).currencies,onChange:v=>{A(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):k("",!0)]),y!=="variation_ids"?(r(),$(cJ,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:s},null,8,["filterKey","itemId"])):k("",!0)],2)):k("",!0)],64))),128)):k("",!0),Object.keys(p.value).length?(r(),h("li",UJ,[n(pJ,{"filter-state":A(a)},null,8,["filter-state"])])):k("",!0)])]))}},QJ={class:"fct-filter-dropdown-header"},DJ={key:0,class:"fct-filter-back-wrapper"},VJ={class:"fct-filter-active-label"},TJ={key:1,class:"fct-filter-dropdown-search-input"},MJ={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=B("el-input");return r(),h("div",QJ,[A(a).data.activeFilter!=null?(r(),h("div",DJ,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=c=>A(a).selectActiveFilter(null))},[n(ee,{name:"ArrowLeft"})]),o("span",VJ,f(A(a).activeFilterOptions.label),1)])):(r(),h("div",TJ,[n(i,{modelValue:A(a).data.searchQuery,"onUpdate:modelValue":s[1]||(s[1]=c=>A(a).data.searchQuery=c),placeholder:l.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},LJ={class:"fct-filter-dropdown-active-filter-list"},RJ=["onClick"],OJ={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",LJ,[(r(!0),h(O,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelected(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOption(i)},f(i.label),9,RJ)],2))),128))]))}},HJ={class:"fct-filter-dropdown-active-filter-list is-multi-list"},PJ=["onClick"],NJ={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",HJ,[(r(!0),h(O,null,ae(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelectedMulti(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOptionMulti(i)},f(i.label),9,PJ)],2))),128))]))}},KJ={class:"fct-filter-dropdown-active-filter"},GJ={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",KJ,[A(a).activeFilterOptions.type==="list"?(r(),$(OJ,{key:0,"filter-state":A(a)},null,8,["filter-state"])):k("",!0),A(a).activeFilterOptions.type==="multi-list"?(r(),$(NJ,{key:1,"filter-state":A(a)},null,8,["filter-state"])):k("",!0),A(a).activeFilterOptions.type==="date"?(r(),$(Tp,{key:2,modelValue:A(a).data.dateRange,"onUpdate:modelValue":s[0]||(s[0]=i=>A(a).data.dateRange=i),onChange:A(a).setDateRange},null,8,["modelValue","onChange"])):k("",!0),A(a).activeFilterOptions.type==="currency"?(r(),$(Mp,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":s[1]||(s[1]=i=>A(a).data.currency=i),currencies:A(a).currencies,onChange:A(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):k("",!0),A(a).activeFilterOptions.type==="tree-select"?(r(),$(Lp,{key:4,"filter-state":A(a)},null,8,["filter-state"])):k("",!0)]))}},jJ={class:"fct-filter-dropdown-list"},zJ=["onClick"],qJ={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},YJ={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",jJ,[A(a).visibleFilters.length?(r(!0),h(O,{key:0},ae(A(a).visibleFilters,(i,c)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:c},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>A(a).selectActiveFilter(i)},[n(ee,{name:i.icon},null,8,["name"]),R(" "+f(i.label),1)],8,zJ)]))),128)):(r(),h("li",qJ,f(A(a).data.searchQuery?A(u)("No filter found"):A(u)("All filters selected")),1))]))}},WJ={key:0,class:"fct-filter-dropdown"},XJ={class:"fct-filter-dropdown-body"},JJ={key:1},ZJ={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=V(null),l=t.filterState,s=ze.get("app_config.isProActive"),i=[{label:u("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:u("All"),value:"all"},{label:u("One time"),value:"payment"},{label:u("Subscription"),value:"subscription"},{label:u("Renewal"),value:"renewal"}]},{label:u("Subscription Type"),icon:"Reload",type:"list",value:"subscriptionType",disableRoutes:["reports_revenue","reports_products","reports_customer","reports_sales","reports_refunds","reports_orders","reports_sales"],options:[{label:u("Active"),value:"subscription"},{label:u("Renewal"),value:"renewal"},{label:u("Expired"),value:"expired"},{label:u("Canceled"),value:"canceled"}]},{label:u("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:u("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];l.setFilterOption(i);const c=p=>{const m=a.value,_=p.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(_));m!=null&&m.contains(_)||y||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return Qe(()=>{document.addEventListener("click",c)}),vl(()=>{document.removeEventListener("click",c)}),(p,m)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:m[0]||(m[0]=Ne(()=>{},["stop"]))},[n(Xe,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:A(l).toggleDropdown},{default:d(()=>[n(ee,{name:"Filter"})]),_:1},8,["onClick"]),n(Gl,{name:"fade-scale","enter-active-class":"transition ease-out duration-200","leave-active-class":"transition ease-in duration-150","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:d(()=>[A(l).dropdownOpen?(r(),h("div",WJ,[A(s)?(r(),h(O,{key:0},[n(MJ,{"filter-state":A(l)},null,8,["filter-state"]),o("div",XJ,[A(l).data.activeFilter!=null?(r(),$(GJ,{key:0,"filter-state":A(l)},null,8,["filter-state"])):(r(),$(YJ,{key:1,"filter-state":A(l)},null,8,["filter-state"]))])],64)):(r(),h("div",JJ,[n(Vn,{class:"py-7.5",title:A(u)("Upgrade to Pro for filtering"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):k("",!0)]),_:1})],512))}},eZ={class:"fct-report-nav-links-wrap"},tZ={class:"fct-settings-nav-collapse-button-wrapper"},aZ={class:"fct-menu-collapse-button-text"},lZ=["onClick"],sZ={class:"fct-settings-nav-link-text"},nZ={class:"fct-settings-nav-child-list"},oZ=["onClick"],iZ={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=tl(),l=al(),s=[{route:"reports_overview",label:u("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:u("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:u("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:u("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:u("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:u("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:u("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:u("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:u("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:u("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:u("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:u("Sources"),url:"/reports/sources",icon:"Source"}],i=V(!1),c=V(!1),p=V(window.innerWidth>=1024),m=t,_=V(null),g=V(null),y=M=>!M.child||!(!U.value||S.value)?!1:v(M)||M.always_open,v=M=>{const I=l.path;return!!(M.child&&M.child.length&&M.child.some(Q=>I===Q.url||I.includes(Q.url))||I===M.url||I.includes(M.url))},C=(M,I,T)=>l.path===M.url,b=M=>{a.push({name:M.route}).catch(T=>{T.name});const I=document.querySelector("#fct-report-body");I&&(I.scrollTop=0)},w=()=>{if(!p.value){_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open");return}i.value=!i.value,c.value=!1},x=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},F=()=>{const M=window.innerWidth,I=p.value;p.value=M>=1024,!I&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),I&&!p.value&&(i.value=!1)};Ce([i,c,p],()=>{m("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:c.value,isDesktopView:p.value})},{immediate:!0});const U=K(()=>i.value),S=K(()=>p.value&&i.value&&c.value);return Qe(()=>{F(),window.addEventListener("resize",F)}),Ct(()=>{window.removeEventListener("resize",F)}),(M,I)=>{const T=B("el-button"),Q=B("el-tooltip");return r(),h("div",eZ,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:x},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:de(["fct-settings-nav-container",{"is-collapsed":U.value,"is-expanded":S.value}])},[o("div",tZ,[n(Q,{content:A(u)("Toggle reports"),placement:"right"},{default:d(()=>[n(T,{onClick:w},{default:d(()=>[n(ee,{name:"Window"}),o("span",aZ,f(A(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:I[0]||(I[0]=E=>p.value&&i.value&&(c.value=!0)),onMouseleave:I[1]||(I[1]=E=>c.value=!1)},[(r(),h(O,null,ae(s,(E,D)=>o("li",{key:D,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(E)}])},[o("div",{onClick:H=>b(E),class:"fct-settings-nav-link"},[E.icon?(r(),$(ee,{key:0,name:E.icon,class:"w-5 h-5"},null,8,["name"])):k("",!0),o("span",sZ,[R(f(E.label)+" ",1),n(ee,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,lZ),n(_a,{accordion:"",visible:y(E),class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",nZ,[(r(!0),h(O,null,ae(E.child,(H,P)=>(r(),h("li",{key:P,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":C(H,P,E)}])},[o("div",{onClick:G=>b(H),class:"fct-settings-nav-link"},f(H.label),9,oZ)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},rZ={class:"fct-reports-view-inner"},dZ={class:"fct-report-body",id:"fct-report-body"},uZ={key:0,class:"fct-report-filter-wrap"},cZ={key:1,class:"fct-report-filter-button"},AZ={class:"fct-report-body-inner"},pZ={__name:"ReportsView",setup(e){var v;const t=V({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=pp(),l=al(),s=V((v=l.meta)==null?void 0:v.title),i=K(()=>Wa.data);a.onFilterChanged(C=>{_(C)});const c=K(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=K(()=>["reports_overview","reports","future_renewals"].includes(l.name));let m=null;const _=C=>{Object.entries(C).forEach(([b,w])=>{let x=w.value;switch(w.type==="multi-list"&&(x=w.value.map(F=>F.value)),b){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Wa.data[b]=x;break;case"dateRange":Wa.data.dateRange=w.value,Wa.data.rangeKey=w.rangeKey;break;case"variation_ids":Wa.data[b]=Array.isArray(w.value)?w.value.map(F=>F.id):[];break}}),Wa.onFilterChange()},g=()=>{var b,w;const C=a.retrieveSavedFilters();C?(a.data.selectedFilters={...C},((w=(b=C.dateRange)==null?void 0:b.value)==null?void 0:w.length)===2&&(a.data.dateRange=[C.dateRange.value[0],C.dateRange.value[1]])):a.data.selectedFilters={}},y=C=>{t.value=C};return Ce(()=>l.name,(C,b)=>{var w;s.value=((w=l.meta)==null?void 0:w.title)||"Reports"}),Qe(()=>{Wa.fetchReportMeta(),g(),m=document.getElementById("fluent_cart_plugin_app"),m&&m.classList.add("fct_report_page_plugin_app_wrap")}),Ct(()=>{m&&m.classList.remove("fct_report_page_plugin_app_wrap")}),vl(()=>{Lt.remove("product_variations")}),(C,b)=>{const w=B("router-view");return r(),h("div",{class:de(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",rZ,[n(iZ,{"onUpdate:menuState":y}),o("div",dZ,[n(Ea,{heading:A(u)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||c.value?(r(),h("div",uZ,[p.value?k("",!0):(r(),$(IJ,{key:0,"filter-state":A(a)},null,8,["filter-state"])),!p.value&&c.value?(r(),h("div",cZ,[n(ZJ,{"filter-state":A(a)},null,8,["filter-state"])])):k("",!0)])):k("",!0),o("div",AZ,[n(Ua),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),$(Za,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:C.$t(`Your store is in ${i.value.storeMode} mode but you are watching data in ${i.value.filterMode} mode.`)},null,8,["content"])):k("",!0),n(w,null,{default:d(({Component:x})=>[(r(),$(Cl(x),{reportFilter:A(Wa)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},fZ=lt(pZ,[["__scopeId","data-v-15c60072"]]),mZ={__name:"lineChart",props:{xAxis:{type:Array,default:()=>[],required:!0},yAxis:{type:Array,default:()=>[],required:!0},lineColor:{type:String,default:"#42b983"},backgroundGradient:{type:Array,required:!0},chartTitle:{type:String,default:""},hasCurrency:{type:Boolean,default:!1}},setup(e){const t=e,a=V(null),l=(y,v,C,b)=>({name:y,type:v,data:C,smooth:!0,color:b,showSymbol:!0,areaStyle:{color:new lr(0,0,0,1,t.backgroundGradient.map(w=>({offset:w.offset,color:w.color})))}}),s=()=>{const y=[];return y.push(l("","line",t.yAxis,t.lineColor)),y},i=y=>{const v=y.split("-");if(v.length===3){const[C,b,w]=v;return`${Ha[parseInt(b)-1]} ${w}, ${C}`}else if(v.length===2){const[C,b]=v;return`${Ha[parseInt(b)-1]} ${C}`}else if(v.length===1){const[C]=v;return`${C}`}},c=K(()=>t.xAxis.map(y=>i(y)));let p=null;const m=()=>{if(a.value&&p==null){p=Jt(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?`${Je.scaled(v)}`:v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:c.value,axisLabel:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{show:!1},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},series:s()};p.setOption(y),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:s()})};Ce(()=>[t.xAxis,t.yAxis],()=>{Se(()=>{_()})});const g=()=>{_()};return Qe(()=>{window.addEventListener("fluentCartCurrencyChange",g),Se(()=>{m()})}),Ct(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},hZ=lt(mZ,[["__scopeId","data-v-e1491f3e"]]);function Rp(e){return Number(e)>0}function is(e){return Rp(e)?"text-red-500":""}function xl(e,t=null){return(t!==null?t:Rp(e))?`(${Je.scaled(e)})`:Je.scaled(e)}const _Z=["innerHTML"],Is={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=K(()=>t.title?t.title+" "+t.amount:t.amount);return(l,s)=>{const i=B("el-tooltip");return r(),$(i,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,f(a.value),1)]),default:d(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,_Z)]),_:1},8,["placement"])}}},ml={__name:"Fluctuation",props:{fluctuation:{type:[String,Number],required:!0},isLiability:{type:Boolean,default:!1},placement:{type:String,default:"top"},amount:{type:[String,Number],required:!1},title:{type:String,default:""},hasCurrency:{type:Boolean,default:!0},isPercentage:{type:Boolean,default:!1},fluctuationSuffix:{type:String,default:""}},setup(e){const t=e,a=K(()=>ia(t.fluctuation)),l=K(()=>(t.hasCurrency?Je.scaled:ia)(t.amount)),s=K(()=>(t.title?t.title:u("Previously"))+" "+l.value+(t.isPercentage?"%":"")),i=K(()=>{if(t.fluctuation===0)return"text-system-light";const p=t.fluctuation>0;return(t.isLiability?!p:p)?"text-success-500":"text-red-500"}),c=K(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(p,m)=>{const _=B("el-tooltip");return r(),h("div",{class:de(["percentage",i.value])},[e.fluctuation!==0?(r(),$(ee,{key:0,class:"w-2",name:c.value},null,8,["name"])):k("",!0),n(_,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,f(s.value),1)]),default:d(()=>[o("span",{class:de(["cursor-pointer",i.value])},[R(f(a.value)+"% ",1),e.fluctuationSuffix?(r(),h(O,{key:0},[R(f(e.fluctuationSuffix),1)],64)):k("",!0)],2)]),_:1},8,["placement"])],2)}}},vZ={class:"fct-report-result"},gZ={key:0,class:"fct-report-result-content"},yZ={key:1,class:"fct-report-result-content"},bZ={class:"title flex items-center gap-1"},wZ={class:"value"},CZ={class:"inline-flex"},BZ={key:2,class:"fct-report-result-chart"},kZ={key:3,class:"fct-report-result-chart"},xZ={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;K(()=>reportFilter.currentCurrencySign),K(()=>defaultReport.data.isBusy.salesReport);const a=(m,_)=>{const g=parseInt(m.replace("#",""),16),y=g>>16&255,v=g>>8&255,C=g&255;return`rgba(${y}, ${v}, ${C}, ${_})`},l=Te.colors.report,s=V([{title:u("Gross Sales"),key:"gross_sale",graph:"grossSaleGraph",lineColor:l.sea_green,backgroundGradient:[{offset:0,color:a(l.sea_green,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",graph:"refundsGraph",lineColor:l.medium_slate_blue,backgroundGradient:[{offset:0,color:a(l.medium_slate_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:u("Revenue"),key:"net_revenue",graph:"netRevenueGraph",lineColor:l.royal_blue,backgroundGradient:[{offset:0,color:a(l.royal_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Gross sales less refunds, taxes, shipping, fees.")},{title:u("Orders"),key:"order_count",graph:"orderGraph",lineColor:l.medium_turquoise,backgroundGradient:[{offset:0,color:a(l.medium_turquoise,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of orders placed in this period.")},{title:u("Items"),key:"total_item_count",graph:"itemsSoldGraph",lineColor:l.deep_sky_blue,backgroundGradient:[{offset:0,color:a(l.deep_sky_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of items sold in this period.")},{title:u("Total Refunds"),key:"total_refunded",graph:"refundCountGraph",lineColor:l.golden_rod,backgroundGradient:[{offset:0,color:a(l.golden_rod,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Total refunds count including partially refunds.")}]),i=K(()=>s.value.map(m=>({...m,value:t.defaultReport.summaryData[m.key]||0,fluctuation:t.defaultReport.fluctuations[m.key]||0,graph:t.defaultReport.data.graphs[m.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[m.graph]||!1,liability:m.liability||!1}))),c=m=>["net_revenue","total_refunded_amount","gross_sale"].includes(m),p=m=>c(m.key)?xl(m.value,m.liability):ia(m.value);return(m,_)=>{const g=B("el-skeleton"),y=B("el-tooltip"),v=B("el-skeleton-item"),C=B("el-col"),b=B("el-row");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[n(b,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(O,null,ae(i.value,(w,x)=>(r(),$(C,{lg:8,md:12,key:x},{default:d(()=>[n(Ln,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[o("div",vZ,[w.dataBusy?(r(),h("div",gZ,[n(g,{animated:"",rows:1})])):(r(),h("div",yZ,[o("div",bZ,[R(f(w.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:w.info,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",wZ,[o("div",CZ,[n(Is,{amount:p(w),title:w.title},null,8,["amount","title"])]),n(ml,{fluctuation:w.fluctuation,amount:e.defaultReport.data.previousSummary[w.key],"is-liability":w.liability,"has-currency":c(w.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),w.dataBusy?(r(),h("div",BZ,[n(g,{animated:"",class:"flex items-center justify-end"},{template:d(()=>[n(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):k("",!0),!w.dataBusy&&Object.keys(w.graph).length>0?(r(),h("div",kZ,[n(hZ,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(w.graph),yAxis:Object.values(w.graph),lineColor:w.lineColor,backgroundGradient:w.backgroundGradient,"has-currency":c(w.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):k("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const SZ={key:0,class:"fct-report-sold-product-list has-scroll"},FZ={class:"list-left-content"},$Z={class:"list-image"},EZ=["src","alt"],UZ=["src"],IZ={class:"list-title"},QZ={class:"list-title-inner"},DZ={class:"list-id"},VZ={class:"list-right-content"},TZ={class:"list-value"},MZ={class:"list-price"},LZ={class:"inline-flex"},RZ={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=El.data,a=K(()=>El.data.isBusy.topSoldVariants);return(l,s)=>{const i=B("el-skeleton"),c=B("router-link");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[n(Ln,{class:"top-sold-variants","card-options":{heading:A(u)("Top Sold Variants")}},{default:d(()=>{var p,m;return[a.value?(r(),$(i,{key:0,animated:"",rows:7})):(r(),h(O,{key:1},[((m=(p=A(t))==null?void 0:p.topSoldVariants)==null?void 0:m.length)>0?(r(),h("ul",SZ,[(r(!0),h(O,null,ae(A(t).topSoldVariants,_=>(r(),h("li",{key:_.product_id},[n(c,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:d(()=>{var g;return[o("div",FZ,[o("div",$Z,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,EZ)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,UZ))]),o("div",IZ,[o("div",QZ,f(_.variation_name),1),o("div",DZ,[o("strong",null,f(_.product_name),1)])])]),o("div",VZ,[o("div",TZ,f(_.quantity)+" "+f(A(u)(" Sold")),1),o("div",MZ,[o("div",LZ,f(A(Je).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},OZ={key:0,class:"flex items-center gap-2 justify-between"},HZ={class:"fct-btn-group sm"},PZ={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Te.colors,l=V(null),s=V(Te.isDark()),i=V("revenue"),c=V({}),p=F=>{const L=["#F6B51E","#855EF8","#47C2FF"],U=["#E6A819","#693EE0","#35ADE9"];return(s.value?U:L)[F]},m=K(()=>{if(typeof t.data.onetime_count===void 0)return[];if((t.data.onetime_count||0)===0&&(t.data.renewal_count||0)===0&&(t.data.subscription_count||0)===0)return[];const F={onetime:u("Onetime Payments"),renewal:u("Renewals"),subscription:u("Subscriptions")},L=t.data.order_count,U=[];return Object.keys(F).forEach((S,M)=>{U.push({name:F[S],value:t.data[S+"_count"]||0,count:t.data[S+"_count"]||0,gross:t.data[S+"_gross"]||0,net:t.data[S+"_net"]||0,percentage:L?(t.data[S+"_count"]/L*100).toFixed(2):0,color:p(M),visible:c.value[F[S]]!==!1})}),U}),_=K(()=>!m.value.length),g=K(()=>El.data.isBusy.salesReport),y=K(()=>m.value.filter(F=>c.value[F.name]!==!1).map((F,L)=>({value:i.value==="revenue"?F.net:F.count,count:F.count,name:F.name,gross:F.gross,net:F.net,itemStyle:{color:p(m.value.findIndex(U=>U.name===F.name))}})));let v=null;const C=()=>{v&&(v.dispose(),v=null),Se(()=>{l.value&&(v=Jt(l.value),b())})},b=()=>{if(!v)return;const F={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatterr:"{b}: {c} ({d}%)",formatter:function(L){const U=s.value?"#ffffff":"#565865";return` | |
| 150 | +`;CB(kB);xd.render=wB;xd.__scopeId="data-v-4ff796ae";var BB=(()=>{const e=xd;return e.install=t=>{t.component("ConfettiExplosion",e)},e})();lt.extend(Ai);lt.extend(pA);let ca=class{static withTimezone(t){const a=lt(t);return a.isValid()?a.format("YYYY-MM-DDTHH:mm:ssZ"):null}};class xB extends tl{constructor(){super(...arguments);Pe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],filterOptions:{},showDropdown:!1,activeFilter:null,searchQuery:"",selectedFilters:{},onFilterChanged:null,dateRange:[ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],currencies:[],currency:"",variation_ids:[],rangeKey:"",storageKey:"filter-state",reRenderDate:!1,compareType:"previous_period",compareDate:ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59")),subscriptionType:""})}get dropdownOpen(){return this.data.showDropdown}toggleDropdown(){this.data.showDropdown=!this.data.showDropdown}setFilterOption(a){this.data.filterOptions=a}get filters(){return this.data.filterOptions}get filteredFilters(){var l;const a=(l=this.data.searchQuery)==null?void 0:l.toLowerCase().trim();return this.filters.filter(s=>a?s.label.toLowerCase().includes(a)||s.value.toLowerCase().includes(a):!0)}get visibleFilters(){return this.filteredFilters.filter(a=>this.shouldRenderOption(a))}selectActiveFilter(a){this.data.activeFilter=a}get activeFilterOptions(){return this.data.activeFilter||null}selectFilterOption(a){const l=this.activeFilterOptions;l&&(this.data.selectedFilters[l.value]={label:l.label,value:a.value,type:l.type,options:l.options},this.data[l.value]=a.value,this.triggerFilterChanged())}selectFilterOptionMulti(a){const l=this.activeFilterOptions;if(!l)return;this.data.selectedFilters[l.value]||(this.data.selectedFilters[l.value]={label:l.label,value:[],type:l.type,options:l.options});let s=this.data.selectedFilters[l.value].value;if(a.value==="all")this.data.selectedFilters[l.value].value=[{label:a.label,value:a.value}],this.data[l.value]=["all"];else{const i=s.findIndex(p=>p.value===a.value);i>-1?s.splice(i,1):s.push({label:a.label,value:a.value});const c=s.findIndex(p=>p.value==="all");c>-1&&s.splice(c,1),this.data[l.value]=s.map(p=>p.value)}this.triggerFilterChanged()}setDateRange(a){const l=lt(a[0]),s=lt(a[1]);this.data.selectedFilters.dateRange={label:u("Date"),value:[l,s],type:"date"},this.triggerFilterChanged()}postSetDateRange(){this.data.dateRange=[Ka.data.dateRange[0],Ka.data.dateRange[1]],this.data.selectedFilters.dateRange={label:u("Date"),value:[ca.withTimezone(lt(this.data.dateRange[0])),ca.withTimezone(lt(this.data.dateRange[1]))],type:"date",rangeKey:this.data.rangeKey},this.data.reRenderDate=!0,this.triggerFilterChanged()}setSelectChange(a,l=null){const s=l||this.activeFilterOptions;s&&(this.data.selectedFilters[s.value]={label:s.label,value:a,type:s.type},this.triggerFilterChanged())}setTreeSelectItem(a){const l=a.filter(s=>!s.children||s.children.length===0).map(s=>({id:s.value,label:s.label,productName:s.productName}));this.handleTreeSelections(l),this.triggerFilterChanged()}removeTreeSelectItem(a){var i;const s=(((i=this.data.selectedFilters.variation_ids)==null?void 0:i.value)||[]).filter(c=>c.id!==a);this.handleTreeSelections(s),this.data.variation_ids=this.data.variation_ids.filter(c=>c!==a),this.triggerFilterChanged()}handleTreeSelections(a){a.length?(this.data.selectedFilters.variation_ids||(this.data.selectedFilters.variation_ids={label:u("Products"),type:"tree-select"}),this.data.selectedFilters.variation_ids.value=a):delete this.data.selectedFilters.variation_ids}clearTreeSelect(){delete this.data.selectedFilters.variation_ids,this.data.variation_ids=[],Ka.resetFilterToDefault("variation_ids"),this.triggerFilterChanged()}isFilterOptionSelected(a){const l=this.activeFilterOptions;if(!l)return!1;const s=this.data.selectedFilters[l.value];return s?s.value===a.value:this.data[l.value]===a.value}isFilterOptionSelectedMulti(a){const l=this.activeFilterOptions,s=this.data.selectedFilters[l==null?void 0:l.value];return s?s.value.some(c=>c.value===a.value):!1}setMultiSelectChange(a,l){this.data.selectedFilters[a]||(this.data.selectedFilters[a]={});const s=l.some(c=>c.value==="all"),i=this.data.selectedFilters[a].value||[];s?i.length===1&&i[0].value==="all"&&l.length>1?this.data.selectedFilters[a].value=l.filter(c=>c.value!=="all"):this.data.selectedFilters[a].value=[l.find(c=>c.value==="all")]:this.data.selectedFilters[a].value=l,this.triggerFilterChanged()}onFilterChanged(a){return this.data.onFilterChanged=a}setCompareTypeChange(a){this.data.compareType=a,this.data.selectedFilters.compareType={value:a},a!=="custom"&&this.triggerFilterChanged()}setCompareDateChange(a){this.data.compareDate=a,this.data.selectedFilters.compareDate={value:ca.withTimezone(lt(a))},this.triggerFilterChanged()}get currencies(){return Object.entries(Ka.data.currencies).map(([a,l])=>({label:a,value:a}))}shouldRenderOption(a){const l=a.disableRoutes||[],s=nl();return l.includes(s.name)?!1:a.value==="currency"?this.data.currencies&&this.data.currencies.length>1:!0}applyFilterChange(){this.triggerFilterChanged()}resetFilters(){this.data.selectedFilters={},this.data.currency="",this.data.variation_ids=[],this.data.dateRange=[ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],this.data.compareType="previous_period",this.data.compareDate=ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),Ka.resetFiltersToDefault(),this.triggerFilterChanged()}removeFilter(a,l){l!=null?(this.removeFilterItem(a,l),Ka.resetFilterToDefault(a),this.triggerFilterChanged()):(delete this.data.selectedFilters[a],Ka.resetFilterToDefault(a),this.triggerFilterChanged())}removeFilterItem(a,l){const s=this.data.selectedFilters[a];if(!s)return;const i=s.value.filter(c=>c.id!==l);i.length?this.data.selectedFilters[a].value=i:delete this.data.selectedFilters[a],a==="variation_ids"&&(this.data.variation_ids=this.data.variation_ids.filter(c=>c!==l)),this.triggerFilterChanged()}triggerFilterChanged(){this.storeSelectedFilters(),typeof this.data.onFilterChanged=="function"&&this.data.onFilterChanged(this.data.selectedFilters)}get activeFilters(){return this.data.selectedFilters}applicableFilters(){return Object.fromEntries(["orderStatus","orderTypes","compareDate","currency","compareType","subscriptionType","variation_ids","paymentStatus","rangeKey"].map(l=>[l,this.data[l]]))}storeSelectedFilters(){const a="report-filter",l=Vt.get(a)||{},s=this.applicableFilters(),i={...l,...s};Vt.set(a,i),Vt.set(this.data.storageKey,this.activeFilters)}retrieveSavedFilters(){return Vt.get(this.data.storageKey)}retrieveSavedReportFilters(){return Vt.get("report-filter")}}function Np(){return xB.init()}class SB extends tl{constructor(){super(...arguments);Pe(this,"filterState",null);Pe(this,"data",{orderStatus:["all"],orderTypes:["all"],paymentStatus:["all"],currencies:[],currency:"",currencySign:"",dateRange:[ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],rangeKey:"",dateDiff:0,minDate:"",variation_ids:[],active_tab:"",filterMode:"",storeMode:"",firstOrderDate:"",compareDate:ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59")),compareType:"previous_period",subscriptionType:""});Pe(this,"storageKey","report-filter");Pe(this,"currencyStorageKey",`${this.storageKey}_currencies`);Pe(this,"listeners",{})}beforeInit(){this.filterState=Np(),this.mergeWithStorage();const a=Vt.get(this.storageKey),l=Vt.get(this.currencyStorageKey);(!a||!l)&&this.fetchReportMeta()}mergeWithStorage(){const a=Vt.get(this.storageKey),l=Vt.get(this.currencyStorageKey);this.data.paymentStatus=a.paymentStatus??this.data.paymentStatus,this.data.orderStatus=a.orderStatus??this.data.orderStatus,this.data.orderTypes=a.orderTypes??this.data.orderTypes,this.data.compareType=a.compareType?a.compareType:this.data.compareType,this.data.compareDate=a.compareDate??this.data.compareDate,this.data.subscriptionType=a.subscriptionType??this.data.subscriptionType,this.data.currency=a.currency?this.data.currency:ze.get("shop.currency"),this.data.dateRange=[a.startDate??this.data.dateRange[0],a.endDate??this.data.dateRange[1]],this.data.currencies=l??this.data.currencies,this.data.rangeKey=a.rangeKey,this.data.variation_ids=a.variation_ids?a.variation_ids:this.data.variation_ids,this.data.filterMode=a.filterMode??this.data.filterMode,this.data.storeMode=a.storeMode??this.data.storeMode}fetchReportMeta(){Ae.get("reports/fetch-report-meta",this.applicableFilters).then(a=>{this.data.currencies=a.currencies,this.data.dateRange[0]=a.min_date;const[l,s]=Object.entries(a.currencies)[0];this.applicableFilters.params.currency===""&&(this.data.currency=l),this.data.currencySign=s,this.data.storeMode=a.storeMode,this.data.firstOrderDate=lt(a.first_order_date||lt().startOf("month")).format("YYYY-MM-DD 00:00:00"),this.syncStorage()}).catch(a=>{}).finally(()=>{this.data.loading=!1})}get currentCurrencySign(){return this.data.currencies&&this.data.currencies.hasOwnProperty(this.data.currency)?this.data.currencies[this.data.currency]:""}addListener(a,l){this.listeners[a]=l,this.data.active_tab=a}async onFilterChange(){this.syncStorage(),this.setDateDiff();for(let a in this.listeners)this.listeners[a](this.applicableFilters)}onModeChange(a){this.data.filterMode=a,this.syncStorage()}syncStorage(){Vt.set(this.storageKey,this.applicableFilters.params),Vt.set(this.currencyStorageKey,this.data.currencies)}removeListener(a){delete this.listeners[a],this.data.active_tab=""}get applicableFilters(){const a=cA.find(p=>p.text===this.data.rangeKey);let l,s;if(a){const[p,f]=a.value();l=this.data.rangeKey==="All Time"?ca.withTimezone(lt(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")):ca.withTimezone(lt(p).format("YYYY-MM-DD 00:00:00")),s=ca.withTimezone(lt(f).format("YYYY-MM-DD 23:59:59"))}else l=ca.withTimezone(lt(this.data.dateRange[0]).format("YYYY-MM-DD 00:00:00")),s=ca.withTimezone(lt(this.data.dateRange[1]).format("YYYY-MM-DD 23:59:59"));const i={orderStatus:this.data.orderStatus,paymentStatus:this.data.paymentStatus,currency:this.data.currency,startDate:ze.get("app_config.isProActive")?l:ca.withTimezone(lt().startOf("month").format("YYYY-MM-DD 00:00:00")),endDate:ze.get("app_config.isProActive")?s:ca.withTimezone(lt().endOf("month").format("YYYY-MM-DD 23:59:59")),rangeKey:this.data.rangeKey,variation_ids:this.data.variation_ids,filterMode:this.data.filterMode,storeMode:this.data.storeMode,firstOrderDate:this.data.firstOrderDate,compareType:this.data.compareType,compareDate:this.data.compareDate,subscriptionType:this.data.subscriptionType};let c=this.data.orderTypes;return c.includes("all")||(i.orderTypes=c),{params:i}}setDateDiff(){if(!this.data.dateRange||this.data.dateRange.length<2)return 0;const[a,l]=this.data.dateRange;this.data.dateDiff=lt(l).diff(lt(a),"days")}resetFiltersToDefault(){this.data.orderStatus=["all"],this.data.orderTypes=["all"],this.data.paymentStatus=["all"],this.data.compareType="previous_period",this.data.compareDate=ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59")),this.data.variation_ids=[],this.data.dateRange=[ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],this.data.subscriptionType=""}resetFilterToDefault(a){a==="compareType"&&(this.data.compareType="previous_period"),a==="compareDate"&&(this.data.compareDate=ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00"))),a==="subscriptionType"&&(this.data.subscriptionType=""),a==="orderTypes"&&(this.data.orderTypes=["all"]),(a==="orderStatus"||a==="paymentStatus")&&(this.data[a]=["all"]),a==="variation_ids"&&(this.data.variation_ids=[]),a==="dateRange"&&(this.data[a]=[ca.withTimezone(lt().startOf("month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))])}retrieveSavedFilters(){return Vt.get(this.data.storageKey)}}const Ka=SB.init();class FB extends tl{constructor(){super(...arguments);Pe(this,"data",{summaryData:{net_revenue:0,order_count:0,subscription_renewal_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,average_order_net:0,average_order_items:0,average_customer_orders:0,average_customer_ltv:0},previousSummary:{},fluctuations:{net_revenue:0,order_count:0,new_customers:0,total_item_count:0,total_refunded_amount:0,total_refunded:0,subscrition_renewal:0},graphs:{netRevenueGraph:{},orderGraph:{},itemsSoldGraph:{},refundCountGraph:{},refundsGraph:{},newCustomerGraph:{},subscriptionRenewalGraph:{}},topSoldProducts:[],failedOrders:[],topSoldVariants:[],isBusy:{graphs:{netRevenueGraph:!1,orderGraph:!1,itemsSoldGraph:!1,refundCountGraph:!1,refundsGraph:!1,newCustomerGraph:!1,subscriptionRenewalGraph:!1},summaryData:!1,topSoldProductsAndFailedOrders:!1,topSoldVariants:!0,topSoldProducts:!0,fluctuations:!1,salesReport:!0}})}get controllerKey(){return"DefaultReportController"}makeRequest(a,l,s,i){if(i&&i.startsWith("graphs.")){const p=i.split(".")[1];this.data.isBusy.graphs[p]=!0}else this.data.isBusy[i]=!0;let c;return typeof l=="object"?c=Ae.get("reports/"+a,l):c=Ae.get("reports/"+a),this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):dt.set(this.data,s,dt.get(i,l))}).catch(i=>{}).finally(()=>{if(s&&s.startsWith("graphs.")){const i=s.split(".")[1];this.data.isBusy.graphs[i]=!1}else this.data.isBusy[s]=!1})}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}getTopSoldVariants(a={}){return this.makeRequest("fetch-top-sold-variants",a,"topSoldVariants","topSoldVariants")}getSalesReport(a={}){return this.data.isBusy.salesReport=!0,this.makeRequest("sales-report",a,"salesReport").then(()=>this.data.isBusy.salesReport=!1)}}const Vl=FB.init(),$B={key:0,class:"fct-report-sold-product-list has-scroll"},EB={class:"list-left-content"},UB={class:"list-image"},IB=["src"],QB=["src"],DB={class:"list-title"},VB=["title"],TB={class:"list-id"},MB={class:"list-right-content"},LB={class:"list-value"},RB=["innerHTML"],Sd={__name:"TopSoldProducts",props:{data:{type:Array,required:!0},loading:{type:Boolean,required:!0}},setup(e){const t=e,a=K(()=>t.data);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[n(Gn,{class:"top-sold-products","card-options":{heading:A(u)("Top Sold Products"),linkButtonText:A(u)("View All"),linkButtonUrl:"products"}},{default:d(()=>[e.loading?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[a.value.length>0?(r(),h("ul",$B,[(r(!0),h(P,null,te(a.value,p=>(r(),h("li",{key:p.product_id},[n(c,{to:{name:"product_edit",params:{product_id:p.product_id}}},{default:d(()=>[o("div",EB,[o("div",UB,[p.media!==null?(r(),h("img",{key:0,src:p.media,alt:""},null,8,IB)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,QB))]),o("div",DB,[o("div",{class:"list-title-inner",title:p.product_name},m(p.product_name),9,VB),o("div",TB,"#"+m(A(sa)(p.product_id)),1)])]),o("div",MB,[o("div",LB,m(A(sa)(p.quantity_sold))+" "+m(A(u)(" Sold")),1),o("div",{class:"list-price",innerHTML:A(ft).scaled(p.total_amount)},null,8,RB)])]),_:2},1032,["to"])]))),128))])):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]),_:1},8,["card-options"])]),_:1})}}},OB={class:"fluent_dashboard fluent-cart-admin-pages fct-layout-width"},PB=["innerHTML"],HB={class:"fluent_cart_dashboard_inner"},NB={class:"fluent_cart_dashboard_main"},KB={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},GB={class:"fluent_cart_dashboard_aside"},zB={class:"fct-congrats-dialog-content"},jB={class:"fct-congrats-dialog-content-inner"},qB={class:"fct-confetti-wrap pointer-events-none fixed left-0 top-0 w-full h-full flex justify-center items-center"},YB=Object.assign({name:"Dashboard"},{__name:"Dashboard",setup(e){const t=T(!1),a=T([]),l=T(!1),s=T(ze.get("admin_url")+"settings/store-settings/pages_setup");ri("dashboardTogglePageNotification",(v,w="")=>{l.value=v,w&&(s.value=w)});const c=()=>{const[v,w]=[lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),lt().format("YYYY-MM-DD 23:59:59")],k={startDate:v,endDate:w,paymentStatus:"all"};rl.getSalesGrowthChart({params:{...k,groupKey:"daily"}})},p=()=>{rl.getRecentOrders({params:null})},f=()=>{const v={paymentStatus:"all"};rl.getCountryHeatMap({params:{...v,groupKey:"daily"}})},_=()=>{const[v,w]=[lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00"),lt().format("YYYY-MM-DD 23:59:59")],k={startDate:v,endDate:w};rl.getTopSoldProducts({params:{...k}})},g=()=>{nn.getVueParams(),Vt.get("onboarding_congratulations","no")!=="yes"&&ze.get("total_products_count")==0&&(Vt.set("onboarding_congratulations","yes"),t.value=!0)},y=()=>s.value;return Ie(()=>{window.addEventListener("getSalesGrowth",c),a.value=ze.get("dummy_product_info"),c(),f(),p(),g(),_()}),(v,w)=>{const k=C("el-col"),b=C("el-row"),S=C("el-button"),$=C("el-dialog");return r(),h("div",OB,[l.value?(r(),E(el,{key:0,class:"mb-5",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("Set up your pages first to get started %s",'<a href="'+y()+'" target="_blank">'+A(u)("Set up your pages")+"</a>")},null,8,PB)]),_:1})):x("",!0),o("div",HB,[o("div",NB,[n(w2),n(Ot,{permission:"dashboard_stats/view"},{default:d(()=>[o("div",KB,[n(Y,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+m(A(u)("Last %s Days",A(sa)(30))),1)]),n(cB)]),_:1}),n(Ot,{permission:"reports/view"},{default:d(()=>[n(dC,{chartData:A(rl).data.salesGrowthChart,loading:A(rl).isBusy.salesGrowthChart},null,8,["chartData","loading"])]),_:1}),n(b,{gutter:24},{default:d(()=>[n(Ot,{permission:"reports/view"},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(UC)]),_:1})]),_:1}),n(Ot,{permission:"reports/view"},{default:d(()=>[n(k,{lg:12,class:"mt-6 xl:mt-0"},{default:d(()=>[n(Sd,{data:A(rl).topSoldProducts,loading:A(rl).isBusy.topSoldProducts},null,8,["data","loading"])]),_:1})]),_:1}),n(Ot,{permission:"reports/view"},{default:d(()=>[n(k,{class:"mt-6"},{default:d(()=>[n(mC,{data:A(rl).data.countryHeatMap},null,8,["data"])]),_:1})]),_:1})]),_:1})]),o("div",GB,[n(i2)])]),n($,{class:"fct-congrats-dialog",modelValue:t.value,"onUpdate:modelValue":w[1]||(w[1]=D=>t.value=D),"append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fct-congrats-modal",width:"800"},{default:d(()=>[o("div",zB,[o("div",jB,[w[2]||(w[2]=o("div",{class:"icon"},"🎉",-1)),o("h3",null,m(A(u)("Congratulations!")),1),o("p",null,m(A(u)("You successfully finished your onboarding & your store is ready.")),1),n(S,{type:"primary",onClick:w[0]||(w[0]=D=>t.value=!1)},{default:d(()=>[R(m(A(u)("Let's go")),1)]),_:1})])]),o("div",qB,[n(A(BB),{particleCount:100,force:1})])]),_:1},8,["modelValue"])])}}}),WB={name:"FilterFields",props:{conditionals:{type:Object,required:!0,default:{}},fields:{type:Object,required:!0,default:{}},editorShortcodes:{type:Array,default:()=>[]},disabled:{type:Boolean,required:!0,default:!1},labels:{default:()=>({status_label:"Enable conditional logic",notification_if_start:"Send this notification if",notification_if_end:"of the following match:"})}},data(){return{defaultRules:{field:null,operator:"=",value:null},comingSoon:!1}},computed:{items(){return this.conditionals.conditions}},mounted(){this.conditionals.conditions.length||this.conditionals.conditions.push({...this.defaultRules})},methods:{add(e){this.items.splice(e+1,0,{...this.defaultRules})},remove(e){this.items.splice(e,1)}}},JB={key:2},XB=["onClick"],ZB=["onClick"];function e8(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),f=C("el-select"),_=C("el-col"),g=C("el-option-group"),y=C("el-input"),v=C("el-row");return r(),h("div",null,[a.disabled?(r(),E(c,{key:1,disabled:"",onClick:t[1]||(t[1]=w=>s.comingSoon=!0)},{default:d(()=>[R(m(a.labels.status_label),1)]),_:1})):(r(),E(c,{key:0,modelValue:a.conditionals.status,"onUpdate:modelValue":t[0]||(t[0]=w=>a.conditionals.status=w)},{default:d(()=>[R(m(a.labels.status_label),1)]),_:1},8,["modelValue"])),a.conditionals.status?(r(),h("div",JB,[R(m(a.labels.notification_if_start)+" ",1),n(f,{class:"fluent_cart_inline_small",modelValue:a.conditionals.type,"onUpdate:modelValue":t[2]||(t[2]=w=>a.conditionals.type=w)},{default:d(()=>[(r(),h(P,null,te({all:"All",any:"Any"},(w,k)=>n(p,{key:k,value:k},{default:d(()=>[R(m(w),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"]),R(" "+m(a.labels.notification_if_end)+" ",1),(r(!0),h(P,null,te(i.items,(w,k)=>(r(),E(v,{key:k,style:{"margin-top":"15px"},gutter:10},{default:d(()=>[n(_,{md:8},{default:d(()=>[n(f,{size:"default",modelValue:i.items[k].field,"onUpdate:modelValue":b=>i.items[k].field=b,style:{width:"100%"},onChange:b=>i.items[k].value=""},{default:d(()=>[(r(!0),h(P,null,te(a.fields,(b,S)=>(r(),E(p,{key:S,label:b.admin_label,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),n(_,{md:5},{default:d(()=>[n(f,{size:"default",modelValue:i.items[k].operator,"onUpdate:modelValue":b=>i.items[k].operator=b},{default:d(()=>[n(g,{label:"General Operators"},{default:d(()=>[n(p,{value:"=",label:"equals"}),n(p,{value:"!=",label:"not equal"}),a.fields[w.field]&&!Object.keys(a.fields[w.field].options).length?(r(),h(P,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1024),n(g,{label:"Advanced Operators"},{default:d(()=>[n(p,{value:"length_equal",label:"Equal to Data Length"}),n(p,{value:"length_less_than",label:"Less than to Data length"}),n(p,{value:"length_greater_than",label:"Greater than to Data Length"})]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1024),n(_,{md:8},{default:d(()=>[i.items[k].operator=="length_equal"||i.items[k].operator=="length_less_than"||i.items[k].operator=="length_greater_than"?(r(),E(y,{key:0,size:"default",type:"number",step:"1",placeholder:"Enter length in number",modelValue:i.items[k].value,"onUpdate:modelValue":b=>i.items[k].value=b},null,8,["modelValue","onUpdate:modelValue"])):(r(),h(P,{key:1},[a.fields[w.field]&&Object.keys(a.fields[w.field].options).length?(r(),E(f,{key:0,size:"default",modelValue:i.items[k].value,"onUpdate:modelValue":b=>i.items[k].value=b,style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(a.fields[w.field].options,(b,S)=>(r(),E(p,{key:S,label:b,value:S},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(y,{key:1,size:"default",placeholder:"Enter a value",modelValue:i.items[k].value,"onUpdate:modelValue":b=>i.items[k].value=b},null,8,["modelValue","onUpdate:modelValue"]))],64))]),_:2},1024),n(_,{md:3,class:"action-btns"},{default:d(()=>[o("i",{class:"el-icon-plus",onClick:b=>i.add(k)},null,8,XB),i.items.length>1?(r(),h("i",{key:0,class:"el-icon-minus",onClick:b=>i.remove(k)},null,8,ZB)):x("",!0)]),_:2},1024)]),_:2},1024))),128))])):x("",!0)])}const t8=nt(WB,[["render",e8]]),a8={name:"ErrorView",props:["field","errors"],computed:{Str(){return da}}},l8={key:0,class:"fct-inline-error ff"};function s8(e,t,a,l,s,i){return a.errors.has(a.field)?(r(),h("p",l8,m(a.errors.errors[a.field].required?i.Str.headline(a.errors.errors[a.field].required):a.errors.errors[a.field]),1)):x("",!0)}const qo=nt(a8,[["render",s8]]),n8={name:"InputPopover",components:{Popover:AA},props:{value:String,placeholder:{type:String,default:""},placement:{type:String,default:"bottom"},icon:{type:String,default:"el-icon-more"},fieldType:{type:String,default:"text"},data:Array,attrName:{type:String,default:"attribute_name"},defaultValue:{type:[String,Number,Boolean,Array],default:""}},data(){return{model:this.defaultValue}},watch:{model(){this.$emit("update:modelValue",this.model)}},methods:{insertShortcode(e){this.model==null&&(this.model=""),this.model+=e.replace(/param_name/,this.attrName)}}},o8={class:"flex-1"},i8={key:0,class:"input-textarea-value"};function r8(e,t,a,l,s,i){const c=C("el-input"),p=C("Popover");return r(),h("div",{class:de(["input-popover",a.fieldType=="textarea"?"input-popover-textarea":""])},[o("div",o8,[a.fieldType=="textarea"?(r(),h("div",i8,[n(c,{placeholder:a.placeholder,type:"textarea",modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=f=>s.model=f)},null,8,["placeholder","modelValue"])])):(r(),E(c,{key:1,placeholder:a.placeholder,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=f=>s.model=f),type:a.fieldType},null,8,["placeholder","modelValue","type"]))]),n(p,{class:de(["popover-wrapper",{"popover-wrapper-plaintext":!1}]),data:a.data[0],onCommand:i.insertShortcode,btnType:"info",plain:!0},null,8,["data","onCommand"])],2)}const d8=nt(n8,[["render",r8]]),u8={name:"FieldGeneral",components:{inputPopover:d8},props:{value:[String,Number,Boolean,Array],editorShortcodes:Array,field_type:{type:String,default:"text"},defaultValue:{type:[String,Number],default:""}},data(){return{fieldValue:this.defaultValue}},watch:{fieldValue(){this.$emit("update:modelValue",this.fieldValue)}},methods:{onValueUpdated(e){this.fieldValue=e,this.$emit("onValueUpdated",this.fieldValue)}}},c8={class:"fct-field-general"};function A8(e,t,a,l,s,i){const c=C("input-popover");return r(),h("div",c8,[n(c,{fieldType:a.field_type,placeholder:e.$t("Select a Field or Type Custom value"),modelValue:s.fieldValue,"onUpdate:modelValue":t[0]||(t[0]=p=>s.fieldValue=p),icon:"el-icon-arrow-down",data:a.editorShortcodes,onOnValueUpdated:t[1]||(t[1]=function(p){i.onValueUpdated(p)}),defaultValue:s.fieldValue},null,8,["fieldType","placeholder","modelValue","data","defaultValue"])])}const ts=nt(u8,[["render",A8]]),p8={key:0,class:"fct-merge-fields"},f8={class:"fct-merge-fields-container"},m8={key:3},h8={name:"FieldMaps",components:{ErrorView:qo,FieldGeneral:ts},props:["settings","merge_fields","field","errors","merge_model","inputs","editorShortcodes"],data(){return{appReady:!1}},mounted(){(Array.isArray(this.merge_model)||!this.merge_model)&&this.$emit("setMergeModelObj"),this.appReady=!0},methods:{onValueUpdated(e,t){this.merge_model[t]=e}}},_8=Object.assign(h8,{setup(e){return(t,a)=>{const l=C("el-option"),s=C("el-select"),i=C("el-form-item");return t.appReady?(r(),h("div",p8,[o("div",f8,[(r(!0),h(P,null,te(e.field.primary_fileds,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c.label,required:c.required},{default:d(()=>[c.input_options==="emails"?(r(),E(s,{key:0,modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f,placeholder:t.$t("Select a Field"),clearable:"",class:de(e.errors.errors[c.key]?"is-error":"")},{default:d(()=>[(r(!0),h(P,null,te(e.inputs,(f,_)=>(r(),h(P,{key:_},[(f==null?void 0:f.attributes.type)==="email"?(r(),E(l,{key:0,value:f==null?void 0:f.attributes.code,label:f==null?void 0:f.attributes.name},null,8,["value","label"])):x("",!0)],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"])):c.input_options==="all"?(r(),E(s,{key:1,modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f,placeholder:t.$t("Select a Field"),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(e.inputs,(f,_)=>(r(),E(l,{key:_,value:f.attributes.name,label:f.admin_label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):(r(),E(ts,{key:2,editorShortcodes:e.editorShortcodes,defaultValue:e.settings[c.key],modelValue:e.settings[c.key],"onUpdate:modelValue":f=>e.settings[c.key]=f},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])),c.help_text?(r(),h("div",m8,m(c.help_text),1)):x("",!0),n(qo,{field:"fieldEmailAddress",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)),e.field.default_fields?(r(!0),h(P,{key:0},te(e.field.default_fields,c=>(r(),h("div",{class:"fct-merge-fields-item",key:c.name},[n(i,{label:c.label,required:c.required},{default:d(()=>[n(ts,{editorShortcodes:e.editorShortcodes,defaultValue:e.settings[t.primary_field.key],modelValue:e.settings.default_fields[c.name],"onUpdate:modelValue":p=>e.settings.default_fields[c.name]=p},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"]),n(qo,{field:"default_fields",errors:e.errors},null,8,["errors"])]),_:2},1032,["label","required"])]))),128)):x("",!0),(r(!0),h(P,null,te(e.merge_fields,(c,p)=>(r(),h("div",{class:"fct-merge-fields-item",key:p},[n(i,{label:c},{default:d(()=>[n(ts,{editorShortcodes:e.editorShortcodes,defaultValue:e.merge_model[p],onOnValueUpdated:function(f){t.onValueUpdated(f,p)}},null,8,["editorShortcodes","defaultValue","onOnValueUpdated"])]),_:2},1032,["label"])]))),128))])])):x("",!0)}}}),v8={name:"ListSelectFilter",props:["settings","field"],computed:{listItems(){let e=this.settings[this.field.filter_by];this.field.parsedType=="number"&&(e=parseInt(e));let t=[];return Tn(this.field.options,a=>{a.lists.indexOf(e)!=-1&&t.push({label:a.label,value:a.value})}),t}}},g8={class:"fluent_cart_list_select_filter"};function y8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select");return r(),h("div",g8,[n(p,{clearable:"",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[0]||(t[0]=f=>a.settings[a.field.key]=f),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(P,null,te(i.listItems,f=>(r(),E(c,{key:f.label,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])}const b8=nt(v8,[["render",y8]]),w8={name:"DropdownLabelRepeater",components:{FieldGeneral:ts},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{loading:!1}},methods:{addItemAfter(e){this.loading=!0,this.settings[this.field.key].splice(e+1,0,{item_value:"",label:""}),this.$nextTick(()=>{this.loading=!1})},removeItem(e){this.loading=!0,this.settings[this.field.key].splice(e,1),this.$nextTick(()=>{this.loading=!1})}}},C8={class:"dropdown_label_repeater"},k8={key:0,class:"fluent_cart-table"};function B8(e,t,a,l,s,i){const c=C("el-input"),p=C("FieldGeneral"),f=C("el-button"),_=C("el-button-group");return r(),h("div",C8,[s.loading?x("",!0):(r(),h("table",k8,[o("thead",null,[o("tr",null,[o("th",null,m(a.field.field_label||"Field Label"),1),o("th",null,m(a.field.value_label||"Field Value"),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,te(a.settings[a.field.key],(g,y)=>(r(),h("tr",{key:"item_"+y},[o("td",null,[n(c,{placeholder:a.field.field_label||"Field Label",modelValue:g.label,"onUpdate:modelValue":v=>g.label=v},null,8,["placeholder","modelValue","onUpdate:modelValue"])]),o("td",null,[n(p,{editorShortcodes:a.editorShortcodes,modelValue:g.item_value,"onUpdate:modelValue":v=>g.item_value=v},null,8,["editorShortcodes","modelValue","onUpdate:modelValue"])]),o("td",null,[n(_,null,{default:d(()=>[n(f,{type:"success",onClick:v=>i.addItemAfter(y)},{default:d(()=>t[1]||(t[1]=[R("+",-1)])),_:2,__:[1]},1032,["onClick"]),n(f,{type:"danger",disabled:a.settings[a.field.key].length==1,onClick:v=>i.removeItem(y)},{default:d(()=>t[2]||(t[2]=[R("-",-1)])),_:2,__:[2]},1032,["disabled","onClick"])]),_:2},1024)])]))),128))])]))])}const x8=nt(w8,[["render",B8]]),S8={name:"DropdownManyFields",components:{FieldGeneral:ts,DynamicIcon:Y,IconButton:at},props:["settings","field","inputs","errors","editorShortcodes"],data(){return{test:"null",rendered_labels:{remote_text:this.field.remote_text||"Field Label",local_text:this.field.local_text||"Field Value"}}},mounted(){(!this.settings[this.field.key]||!this.settings[this.field.key].length)&&(this.settings[this.field.key]=[{item_value:this.field,label:""}])},methods:{addNewItem(){this.settings[this.field.key].push({item_value:"",label:""})},removeItem(e){this.settings[this.field.key].length!==1&&this.settings[this.field.key].splice(e,1)}}},F8={class:"dropdown_label_repeater w-full"},$8={class:"fluent_cart-table w-full text-left"},E8={class:"action-btns"},U8={class:"dropdown_label_repeater_footer"};function I8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("FieldGeneral"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-button");return r(),h("div",F8,[o("table",$8,[t[1]||(t[1]=o("colgroup",null,[o("col",{width:"25%"}),o("col",{width:"70%"}),o("col",{width:"10%"})],-1)),o("thead",null,[o("tr",null,[o("th",null,m(s.rendered_labels.remote_text),1),o("th",null,m(s.rendered_labels.local_text),1),t[0]||(t[0]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,te(a.settings[a.field.key],(v,w)=>(r(),h("tr",{key:"item_"+w},[o("td",null,[n(p,{modelValue:v.label,"onUpdate:modelValue":k=>v.label=k},{default:d(()=>[(r(!0),h(P,null,te(a.field.options,(k,b)=>(r(),E(c,{key:b,label:k,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[n(f,{editorShortcodes:a.editorShortcodes,defaultValue:typeof v.item_value=="object"?"":v.item_value,modelValue:v.item_value,"onUpdate:modelValue":k=>v.item_value=k},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])]),o("td",null,[o("div",E8,[n(g,{size:"x-small",tag:"button",onClick:Ge(k=>i.removeItem(w),["prevent"]),disabled:a.settings[a.field.key].length===1,class:"border-none"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick","disabled"])])])]))),128))])]),o("div",U8,[n(y,{text:"",onClick:Ge(i.addNewItem,["prevent"])},{default:d(()=>[n(_,{name:"Plus"}),R(" "+m(e.$t("Add More")),1)]),_:1},8,["onClick"])])])}const Q8=nt(S8,[["render",I8]]),D8={name:"ChainedFields",props:["settings","field","value"],data(){return{loading:!1,app_ready:!1,categories:[],subcategories:[],chained_settings:{category:"",sub_category:""},selected_subcategory:""}},computed:{listItems(){}},watch:{"settings.list_id"(){this.field.require_list&&this.fetchSettings()}},mounted(){this.settings[this.field.key]?this.chained_settings=this.settings[this.field.key]:this.settings[this.field.key]=this.chained_settings,this.app_ready=!0,this.fetchSettings()},methods:{fetchSettings(){this.loading=!0,this.$post("integration/feed/chained",{route:this.field.remote_url,settings:this.settings}).then(e=>{this.loading=!1,this.categories=e.data.categories,this.subcategories=e.data.subcategories,e.data.reset_values&&(this.chained_settings={category:"",sub_category:""})}).catch(e=>{})},handleCategoryChange(){this.$set(this.settings,this.field.key.category,this.selected_category),this.fetchSettings()}}},V8={class:"fluent_cart_chained_filter"};function T8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=Va("loading");return Wt((r(),h("div",V8,[n(p,{onChange:t[0]||(t[0]=_=>i.handleCategoryChange()),clearable:"",modelValue:s.chained_settings.category,"onUpdate:modelValue":t[1]||(t[1]=_=>s.chained_settings.category=_),placeholder:a.field.category_label},{default:d(()=>[(r(!0),h(P,null,te(s.categories,_=>(r(),E(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),Wt(n(p,{modelValue:s.chained_settings.sub_category,"onUpdate:modelValue":t[2]||(t[2]=_=>s.chained_settings.sub_category=_),clearable:"",placeholder:a.field.subcategory_label},{default:d(()=>[(r(!0),h(P,null,te(s.subcategories,_=>(r(),E(c,{key:_.value,label:_.label,value:_.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),[[Tl,s.chained_settings.category]])])),[[f,s.loading]])}const M8=nt(D8,[["render",T8]]),L8={name:"ChainedSelects",props:["settings","field","value"],data(){return{app_ready:!1,loading:!1}},mounted(){this.fetchSettings(),this.app_ready=!0},methods:{fetchSettings(){this.loading=!0,this.$get(this.field.remote_url,{settings:this.settings}).then(e=>{this.loading=!1;let t=e.data;Tn(t,(a,l)=>{this.$set(this.field,l,a)})}).catch(e=>{})},handleSlectChange(e){e===this.field.primary_key&&(this.fetchSettings(),Tn(this.value,(t,a)=>{a!=e&&(this.field.options_labels[a].type=="multi-select"?this.value[a]=[]:this.value[a]="")}))}}},R8={class:"fluent_cart_chained_filter"};function O8(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("el-col"),_=C("el-row"),g=Va("loading");return Wt((r(),h("div",R8,[n(_,{gutter:0},{default:d(()=>[(r(!0),h(P,null,te(a.field.fields_options,(y,v)=>(r(),E(f,{span:12,key:v,class:"fluent_carteach_filter"},{default:d(()=>[o("label",null,m(a.field.options_labels[v].label),1),n(p,{onChange:w=>i.handleSlectChange(v),filterable:"",clearable:"",placeholder:a.field.options_labels[v].placeholder,multiple:a.field.options_labels[v].type=="multi-select",modelValue:a.value[v],"onUpdate:modelValue":w=>a.value[v]=w},{default:d(()=>[(r(!0),h(P,null,te(y,(w,k)=>(r(),E(c,{key:k,value:k,label:w},null,8,["value","label"]))),128))]),_:2},1032,["onChange","placeholder","multiple","modelValue","onUpdate:modelValue"])]),_:2},1024))),128))]),_:1})])),[[g,s.loading]])}const P8=nt(L8,[["render",O8]]),H8={name:"RoutingFilterFields",components:{DynamicIcon:Y,IconButton:at,FieldGeneral:ts},props:{routings:{type:Array,required:!0,default(){return[]}},fields:{type:Object,required:!0,default(){return{}}},disabled:{type:Boolean,required:!1,default:!1},labels:{default:()=>({input_label:"Send To",input_placeholder:"Email Address"})},input_type:{type:String,default:"text"},input_options:{type:Object,required:!1,default(){return{}}},editorShortcodes:{type:Object}},data(){return{defaultRules:{input_value:"",field:"",operator:"=",value:null},comingSoon:!1}},mounted(){(!this.routings||!this.routings.length)&&this.routings.push({...this.defaultRules})},methods:{add(e){this.routings.splice(e+1,0,{...this.defaultRules})},remove(e){this.routings.splice(e,1)}}},N8={class:"fluent_cart_routing_fields"},K8={key:0,class:"fluent_cart_routing_table"},G8={class:"fluent_cart_inline"},z8={class:"action-btns"};function j8(e,t,a,l,s,i){const c=C("el-input"),p=C("el-option"),f=C("el-select"),_=C("FieldGeneral"),g=C("DynamicIcon"),y=C("IconButton");return r(),h("div",N8,[a.disabled?x("",!0):(r(),h("table",K8,[o("tbody",null,[(r(!0),h(P,null,te(a.routings,(v,w)=>(r(),h("tr",{key:w},[o("td",null,[o("label",G8,m(a.labels.input_label),1),a.input_type=="text"?(r(),E(c,{key:0,placeholder:a.labels.input_placeholder,modelValue:v.input_value,"onUpdate:modelValue":k=>v.input_value=k},null,8,["placeholder","modelValue","onUpdate:modelValue"])):a.input_type=="select"?(r(),E(f,{key:1,modelValue:v.input_value,"onUpdate:modelValue":k=>v.input_value=k,placeholder:a.labels.input_placeholder},{default:d(()=>[(r(!0),h(P,null,te(a.input_options,(k,b)=>(r(),E(p,{key:b,label:k,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),t[0]||(t[0]=o("td",null,"If",-1)),o("td",null,[n(_,{editorShortcodes:a.editorShortcodes,modelValue:v.field,"onUpdate:modelValue":k=>v.field=k,defaultValue:v.field,onChange:k=>v.value=""},null,8,["editorShortcodes","modelValue","onUpdate:modelValue","defaultValue","onChange"])]),o("td",null,[n(f,{modelValue:v.operator,"onUpdate:modelValue":k=>v.operator=k,class:"w-[100px]"},{default:d(()=>[n(p,{value:"=",label:"equal"}),n(p,{value:"!=",label:"not equal"}),n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),a.fields[v.field]&&!Object.keys(a.fields[v.field].options).length?(r(),h(P,{key:0},[n(p,{value:">",label:"greater than"}),n(p,{value:"<",label:"less than"}),n(p,{value:">=",label:"greater than or equal"}),n(p,{value:"<=",label:"less than or equal"}),n(p,{value:"contains",label:"contains"}),n(p,{value:"doNotContains",label:"do not contains"}),n(p,{value:"startsWith",label:"starts with"}),n(p,{value:"endsWith",label:"ends with"})],64)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("td",null,[a.fields[v.field]&&Object.keys(a.fields[v.field].options).length?(r(),E(f,{key:0,modelValue:v.value,"onUpdate:modelValue":k=>v.value=k,style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(a.fields[v.field].options,(k,b)=>(r(),E(p,{key:b,label:k,value:b},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),E(c,{key:1,placeholder:e.$t("Enter a value"),modelValue:v.value,"onUpdate:modelValue":k=>v.value=k},null,8,["placeholder","modelValue","onUpdate:modelValue"]))]),o("td",null,[o("div",z8,[n(y,{size:"x-small",tag:"button",onClick:Ge(k=>i.add(w),["prevent"])},{default:d(()=>[n(g,{name:"Plus"})]),_:2},1032,["onClick"]),a.routings.length>1?(r(),E(y,{key:0,size:"x-small",tag:"button",onClick:Ge(k=>i.remove(w),["prevent"])},{default:d(()=>[n(g,{name:"Minus"})]),_:2},1032,["onClick"])):x("",!0)])])]))),128))])]))])}const q8=nt(H8,[["render",j8]]),Y8={name:"SelectionRouting",components:{RoutingFilterFields:q8,FiledGeneral:ts},props:["field","settings","inputs","editorShortcodes"]},W8={class:"fluent_cart_field_routing"},J8={class:"mb-4"},X8={key:3};function Z8(e,t,a,l,s,i){const c=C("el-checkbox"),p=C("el-option"),f=C("el-select"),_=C("el-input"),g=C("FiledGeneral"),y=C("RoutingFilterFields");return r(),h("div",W8,[o("div",J8,[n(c,{modelValue:a.settings[a.field.routing_key],"onUpdate:modelValue":t[0]||(t[0]=v=>a.settings[a.field.routing_key]=v),"true-value":"routing","false-value":"simple"},{default:d(()=>[R(m(a.field.labels.choice_label),1)]),_:1},8,["modelValue"])]),o("div",null,[a.field.simple_component=="select"?(r(),E(f,{key:0,disabled:a.settings[a.field.routing_key]!="simple",filterable:"",clearable:"",multiple:a.field.is_multiple,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[1]||(t[1]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},{default:d(()=>[(r(!0),h(P,null,te(a.field.options,(v,w)=>(r(),E(p,{key:w,value:w,label:v},null,8,["value","label"]))),128))]),_:1},8,["disabled","multiple","modelValue","placeholder"])):a.field.simple_component=="text"?(r(),E(_,{key:1,disabled:a.settings[a.field.routing_key]!="simple",modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[2]||(t[2]=v=>a.settings[a.field.key]=v),placeholder:a.field.placeholder},null,8,["disabled","modelValue","placeholder"])):a.field.simple_component=="value_text"&&a.settings[a.field.routing_key]=="simple"?(r(),E(g,{key:2,editorShortcodes:a.editorShortcodes,modelValue:a.settings[a.field.key],"onUpdate:modelValue":t[3]||(t[3]=v=>a.settings[a.field.key]=v)},null,8,["editorShortcodes","modelValue"])):x("",!0),a.settings[a.field.routing_key]=="simple"&&a.field.inline_tip?(r(),h("p",X8,m(a.field.inline_tip),1)):x("",!0)]),a.settings[a.field.routing_key]=="routing"?(r(),E(y,{key:0,routings:a.settings[a.field.settings_key],input_type:a.field.routing_input_type,fields:a.inputs,labels:a.field.labels,input_options:a.field.options,editorShortcodes:a.editorShortcodes},null,8,["routings","input_type","fields","labels","input_options","editorShortcodes"])):x("",!0)])}const e4=nt(Y8,[["render",Z8]]),t4={name:"CustomComponentRender",props:{field:{type:Object,required:!0},settings:{type:Object,required:!0}},data(){return{message:"This is a custom component render"}},render(){if(this.field&&this.field.render_template){const e=`<div>${this.field.render_template}</div>`,t=qf(e).bind(this);return Yf(t,{settings:this.settings,app:this})}return null}},a4={name:"FeedHeader",props:{integration_name:String,settings:Object},computed:{ArrowRight(){return Al},prevRoute(){return this.$route.name==="product_integration_feed_editor"?{name:"product_integrations",params:{product_id:this.$route.params.product_id}}:{name:"integrations"}}}},l4={class:"fct-feed-header mb-5"},s4={class:"mb-5 flex items-center justify-between"},n4={class:"capitalize"};function o4(e,t,a,l,s,i){const c=C("el-breadcrumb-item"),p=C("el-breadcrumb"),f=C("el-switch");return r(),h("div",l4,[o("div",s4,[n(p,{"separator-icon":i.ArrowRight},{default:d(()=>[n(c,{to:i.prevRoute},{default:d(()=>[R(m(e.$t("Integrations")),1)]),_:1},8,["to"]),n(c,null,{default:d(()=>[o("span",n4,m(a.integration_name),1)]),_:1})]),_:1},8,["separator-icon"]),n(f,{modelValue:a.settings.enabled,"onUpdate:modelValue":t[0]||(t[0]=_=>a.settings.enabled=_),"active-value":"yes","inactive-value":"no","active-text":e.$t("Enable this Integration")},null,8,["modelValue","active-text"])])])}const i4=nt(a4,[["render",o4]]);class r4{constructor(){this.errors={}}get(t){if(this.errors[t])return this.errors[t]}first(t){if(this.errors[t]){let a=Object.keys(this.errors[t]);return a.length?this.errors[t][a[0]]:""}}has(t){return!!this.errors[t]}record(t){this.errors=t}clear(t){t?this.errors[t]=null:this.errors={}}}const d4={name:"RestSelector",props:["field","modelValue"],emits:["update:modelValue"],data(){return{model:this.modelValue,loading:!1,options:[]}},watch:{model(e){this.$emit("update:modelValue",e)}},mounted(){this.fetchOptions("")},methods:{fetchOptions(e){let t=this.field.option_key;this.field.extended_key&&(t+="_"+this.field.extended_key);let a="";if(this.field.cacheable){if(a+="_fcrm_ajax_cache_"+t,window[a]){this.options=window[a];return}}else if(this.field.experimental_cache&&(a+="_fcrm_ajax_cache_"+t+"_"+e+" "+JSON.stringify(this.model),this.field.sub_option_key&&(a+="_"+JSON.stringify(this.field.sub_option_key)),window[a])){this.options=window[a];return}if(this.doing_ajax)return!1;this.loading=!0;const l={search:e,values:this.model,option_key:t};this.field.sub_option_key&&(l.sub_option_key=this.field.sub_option_key),this.$get("integration/feed/dynamic_options",l).then(s=>{this.options=s.options,a&&s.options&&(window[a]=s.options)}).catch(s=>{this.handleError(s)}).finally(()=>{this.loading=!1})}}};function u4(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=Va("loading");return Wt((r(),E(p,{modelValue:s.model,"onUpdate:modelValue":t[0]||(t[0]=_=>s.model=_),multiple:a.field.is_multiple,filterable:"",remote:!a.field.cacheable,clearable:a.field.clearable,disabled:a.field.disabled,"reserve-keyword":"","allow-create":a.field.creatable,size:a.field.size,placeholder:a.field.placeholder||e.$t("Please enter a keyword"),"remote-method":i.fetchOptions},{default:d(()=>[(r(!0),h(P,null,te(s.options,_=>(r(),E(c,{key:_.id,label:_.title,value:_.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","multiple","remote","clearable","disabled","allow-create","size","placeholder","remote-method"])),[[f,s.loading]])}const c4=nt(d4,[["render",u4]]),A4={name:"FeedEditor",components:{FilterFields:t8,MergeFieldMapper:_8,FiledGeneral:ts,ListSelectFilter:b8,DropDownLabelRepeater:x8,DropDownManyFields:Q8,ChainedFields:M8,ChainedSelects:P8,SelectionRouting:e4,CardContainer:Se,CardBody:ke,CardHeader:Ve,LabelHint:pa,FeedHeader:i4,ErrorView:qo,CustomComponentRender:t4,RestSelector:c4},data(){return{loading_app:!1,loading_list:!1,errors:new r4,integration_id:parseInt(this.$route.params.integration_id),integration_name:this.$route.params.integration_name,saving:!1,merge_fields:{},settings:{},settings_fields:{},attachedForms:[],inputs:[],editorShortcodes:[],scope:"",product_variations:[]}},computed:{getTitle(){let e=this.settings_fields.integration_title||"";return this.integration_id?`Update ${e} Integration Feed`:`Add New ${e} Integration Feed`},maybeShowSaveButton(){let e=this.settings_fields,t=this.merge_fields;return e.button_require_list&&t||!e.button_require_list}},mounted(){this.loadIntegrationSettings()},methods:{translate:u,loadIntegrationSettings(){if(this.$route.name==="product_integration_feed_editor"){this.loading_app=!0;const e=this.$route.params.product_id;this.$get(`products/${e}/integrations/${this.integration_name}/settings`,{integration_id:this.integration_id}).then(t=>{this.loading_app=!1,this.settings_fields=t.settings_fields,this.scope=t.scope,this.product_variations=t.product_variations,this.settings=t.settings,this.editorShortcodes=Object.values(t.shortcodes||{}),this.inputs=t.inputs,this.settings.name||(this.settings.name=t.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=t.merge_fields}).catch(t=>{var a;this.loading_app=!1,t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)})}else this.loading_app=!0,this.$get("integration/global-feeds/settings",{integration_id:this.integration_id,integration_name:this.integration_name}).then(e=>{this.loading_app=!1,this.settings_fields=e.settings_fields,this.settings=e.settings,this.editorShortcodes=Object.values(e.shortcodes),this.inputs=e.inputs,this.settings.name||(this.settings.name=e.settings_fields.integration_title+" Integration Feed"||""),this.merge_fields=e.merge_fields}).catch(e=>{var t,a;this.loading_app=!1,this.handleError(((a=(t=e.responseJSON)==null?void 0:t.data)==null?void 0:a.message)||"Failed to load integration settings")})},loadMergeFields(){this.loading_list=!0,this.fieldsLoaded=!1,this.$get("integration/feed/lists",{integration_id:this.integration_id,list_id:this.settings.list_id,integration_name:this.integration_name}).then(e=>{this.loading_list=!1,this.merge_fields=e.merge_fields,this.fieldsLoaded=!0}).catch(e=>{})},saveNotification(){if(this.errors.clear(),this.$route.name==="product_integration_feed_editor"){this.saving=!0;const e=this.$route.params.product_id;let t={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post(`products/${e}/integrations`,t).then(a=>{a.feedData&&(this.settings=a.feedData),a.created&&this.$router.push({name:"product_integrations",params:{product_id:e}}),this.handleSuccess(a.message||"Integration saved successfully"),this.errors.clear()}).catch(a=>{var l;this.errors.record(((l=a==null?void 0:a.data)==null?void 0:l.errors)||{}),this.handleError(a)}).finally(()=>{this.saving=!1})}else{this.saving=!0;let e={integration_id:this.integration_id,integration_name:this.integration_name,integration:JSON.stringify(this.settings)};this.$post("integration/global-feeds/settings",e).then(t=>{t.created&&this.$router.push({name:"integrations"}),this.handleSuccess(t.message)}).catch(t=>{var a;this.errors.record(((a=t==null?void 0:t.data)==null?void 0:a.errors)||{}),this.handleError(t)}).finally(()=>{this.saving=!1})}},setMergeModel(e){this.settings[e.key]={}}}},p4={class:"fct-integration-container fct-layout-width"},f4={class:"fct-add-integration py-7.5"},m4={class:"grid gap-5"},h4={key:0,class:"fct-setting-form-content"},_4=["innerHTML"],v4={class:"fct-setting-form-fields"},g4=["innerHTML"],y4=["innerHTML"],b4=["innerHTML"],w4={key:0,class:"fct-setting-form-row"},C4={class:"fct-setting-form-content"},k4={class:"fct-setting-form-content"},B4={class:"fct-setting-form-fields"},x4={class:"fct-inline-tip pl-6"},S4={key:0,class:"setting-save-action"};function F4(e,t,a,l,s,i){const c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("FeedHeader"),_=C("LabelHint"),g=C("el-input"),y=C("ErrorView"),v=C("el-option"),w=C("el-select"),k=C("MergeFieldMapper"),b=C("el-checkbox"),S=C("el-checkbox-group"),$=C("el-option-group"),D=C("FilterFields"),F=C("FiledGeneral"),B=C("ListSelectFilter"),U=C("DropDownLabelRepeater"),Q=C("DropDownManyFields"),V=C("el-radio"),I=C("el-radio-group"),M=C("el-input-number"),O=C("ChainedFields"),L=C("ChainedSelects"),H=C("SelectionRouting"),j=C("RestSelector"),W=C("CardBody"),G=C("CardContainer"),Z=C("el-button"),ne=C("el-form"),ce=Va("loading");return r(),h("div",p4,[o("div",f4,[n(p,{loading:s.loading_app,class:"bg-white rounded p-6 mb-7.5 dark:bg-dark-700",animated:""},{template:d(()=>[n(c,{variant:"h3",class:"w-[150px] mb-5"}),o("div",m4,[o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})]),o("div",null,[n(c,{variant:"h3",class:"w-[50px] mb-3"}),n(c,{variant:"p"})])])]),_:1},8,["loading"]),s.loading_app?x("",!0):(r(),E(ne,{key:0,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(f,{settings:s.settings,integration_name:s.integration_name},null,8,["settings","integration_name"]),n(G,null,{default:d(()=>[n(W,null,{default:d(()=>[(r(!0),h(P,null,te(s.settings_fields.fields,(z,ue)=>(r(),h("div",{key:ue,class:de(["fct-setting-form-row",z.key])},[z.label?(r(),h("div",h4,[z.tips?(r(),E(_,{key:0,title:z.label,content:z.tips,placement:"top-start",required:z.required},null,8,["title","content","required"])):(r(),E(_,{key:1,title:z.label,required:z.required},null,8,["title","required"])),z.inline_tip?(r(),h("p",{key:2,class:"fct-inline-tip",innerHTML:z.inline_tip},null,8,_4)):x("",!0)])):x("",!0),o("div",v4,[z.component==="text"?(r(),h(P,{key:0},[n(g,{placeholder:z.placeholder,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,class:de(s.errors.errors[z.key]?"is-error":"")},null,8,["placeholder","modelValue","onUpdate:modelValue","class"]),n(y,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="list_ajax_options"?(r(),h(P,{key:1},[Wt((r(),E(w,{onChange:t[0]||(t[0]=ie=>i.loadMergeFields()),modelValue:s.settings.list_id,"onUpdate:modelValue":t[1]||(t[1]=ie=>s.settings.list_id=ie),placeholder:z.placeholder,clearable:""},{default:d(()=>[(r(!0),h(P,null,te(z.options,(ie,J)=>(r(),E(v,{key:J,value:J,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","placeholder"])),[[ce,s.loading_list]]),n(y,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="map_fields"?(r(),E(k,{key:2,onSetMergeModelObj:ie=>i.setMergeModel(z),errors:s.errors,inputs:s.inputs,field:z,settings:s.settings,editorShortcodes:s.editorShortcodes,merge_model:s.settings[z.key],merge_fields:s.merge_fields},null,8,["onSetMergeModelObj","errors","inputs","field","settings","editorShortcodes","merge_model","merge_fields"])):z.component==="select"?(r(),h(P,{key:3},[n(w,{filterable:"",clearable:"",multiple:z.is_multiple,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,placeholder:z.placeholder},{default:d(()=>[(r(!0),h(P,null,te(z.options,(ie,J)=>(r(),E(v,{key:J,value:J,label:ie},null,8,["value","label"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"]),n(y,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="checkbox-single"?(r(),h(P,{key:4},[n(b,{modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},{default:d(()=>[R(m(z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:z.inline_tip},null,8,g4)):x("",!0)],64)):z.component==="yes-no-checkbox"?(r(),h(P,{key:5},[n(b,{"true-value":"yes","false-value":"no",modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},{default:d(()=>[R(m(z.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.inline_tip?(r(),h("p",{key:0,class:"fct-inline-tip pl-6",innerHTML:z.inline_tip},null,8,y4)):x("",!0)],64)):z.component==="checkbox-multiple"?(r(),E(S,{key:6,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},{default:d(()=>[(r(!0),h(P,null,te(z.options,(ie,J)=>(r(),E(b,{key:J,label:Number(J)},{default:d(()=>[R(m(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.component==="selection_group"?(r(),h(P,{key:7},[n(w,{modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,placeholder:z.placeholder,multiple:"",class:de(s.errors.errors[z.key]?"is-error":"")},{default:d(()=>[(r(!0),h(P,null,te(z.options,(ie,J)=>(r(),E($,{key:J,label:ie.label},{default:d(()=>[(r(!0),h(P,null,te(ie.options,N=>(r(),E(v,{key:N.value,label:N.label,value:N.value},null,8,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","class"]),n(y,{field:z.key,errors:s.errors},null,8,["field","errors"])],64)):z.component==="conditional_block"?(r(),E(D,{key:8,fields:s.inputs,conditionals:s.settings[z.key],editorShortcodes:s.editorShortcodes},null,8,["fields","conditionals","editorShortcodes"])):z.component==="value_text"?(r(),E(F,{key:9,editorShortcodes:s.editorShortcodes,defaultValue:s.settings[z.key],modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):z.component==="value_textarea"?(r(),E(F,{key:10,field_type:"textarea",editorShortcodes:s.editorShortcodes,defaultValue:s.settings[z.key],modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,isIconBtn:""},null,8,["editorShortcodes","defaultValue","modelValue","onUpdate:modelValue"])):z.component==="list_select_filter"?(r(),E(B,{key:11,settings:s.settings,field:z},null,8,["settings","field"])):z.component==="dropdown_label_repeater"?(r(),E(U,{key:12,errors:s.errors,inputs:s.inputs,field:z,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):z.component==="dropdown_many_fields"?(r(),E(Q,{key:13,errors:s.errors,inputs:s.inputs,field:z,settings:s.settings,editorShortcodes:s.editorShortcodes},null,8,["errors","inputs","field","settings","editorShortcodes"])):z.component==="radio_choice"?(r(),E(I,{key:14,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},{default:d(()=>[(r(!0),h(P,null,te(z.options,(ie,J)=>(r(),E(V,{key:J,label:J},{default:d(()=>[R(m(ie),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.component==="number"?(r(),E(M,{key:15,size:"default",modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},null,8,["modelValue","onUpdate:modelValue"])):z.component==="chained_fields"?(r(),E(O,{key:16,settings:s.settings,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,field:z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):z.component==="chained_select"?(r(),E(L,{key:17,settings:s.settings,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie,field:z},null,8,["settings","modelValue","onUpdate:modelValue","field"])):z.component==="html_info"?(r(),h("div",{key:18,innerHTML:z.html_info},null,8,b4)):z.component==="selection_routing"?(r(),E(H,{key:19,inputs:s.inputs,field:z,editorShortcodes:s.editorShortcodes,settings:s.settings},null,8,["inputs","field","editorShortcodes","settings"])):z.component==="rest_selector"?(r(),E(j,{key:20,field:z,modelValue:s.settings[z.key],"onUpdate:modelValue":ie=>s.settings[z.key]=ie},null,8,["field","modelValue","onUpdate:modelValue"])):z.component==="custom_component"?(r(),E(gl("custom-component-render"),{key:21,field:z,settings:s.settings},null,8,["field","settings"])):x("",!0)])],2))),128)),s.scope==="product"&&s.product_variations.length?(r(),h("div",w4,[o("div",C4,[o("div",k4,[n(_,{title:i.translate("Run on Selected Variations Only")},null,8,["title"])])]),o("div",B4,[n(w,{filterable:"",clearable:"",multiple:!0,modelValue:s.settings.conditional_variation_ids,"onUpdate:modelValue":t[2]||(t[2]=z=>s.settings.conditional_variation_ids=z),placeholder:e.$t("Leave empty for all the variations")},{default:d(()=>[(r(!0),h(P,null,te(s.product_variations,z=>(r(),E(v,{key:z.id,value:z.id,label:z.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"]),o("p",x4,m(e.$t("Leave empty to run this feed for all variations")),1)])])):x("",!0)]),_:1})]),_:1}),i.maybeShowSaveButton?(r(),h("div",S4,[n(Z,{type:"primary",loading:s.saving,onClick:i.saveNotification},{default:d(()=>[R(m(s.integration_id?`Update ${s.settings_fields.integration_title} Feed`:`Create ${s.settings_fields.integration_title} Feed`),1)]),_:1},8,["loading","onClick"])])):x("",!0)]),_:1}))])])}const nc=nt(A4,[["render",F4]]),$4={class:"setting-wrap"},E4={key:0,class:"integration-actions"},U4={key:0,class:"fct-empty-integration-wrap text-center max-w-[600px] mx-auto mb-5"},I4={class:"text-base"},Q4={key:1,class:"fct-integrations-table-wrap"},D4={class:"fct-integration-logo-wrap"},V4=["src","alt"],T4={class:"text-xs text-gray-700"},M4=["onClick"],L4={class:"fct-event-triggers"},R4={class:"fct-event-triggers"},O4={class:"fct-btn-group sm"},P4={key:2,class:"fct-integration-table-footer"},H4={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"},N4={name:"GloablIntegration",props:["editorShortcodes"],data(){return{loading:!0,feeds:[],available_integrations:{},all_module_config_url:""}},computed:{hasActiveIntegrations(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.getFeeds()},methods:{getFeeds(){this.loading=!0,this.$get("integration/global-feeds").then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.loading=!1}).finally(()=>{this.loading=!1})},handleActive(e){let t={status:e.enabled};this.$post(`integration/global-feeds/change-status/${e.id}`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{var l;this.handleError((l=a==null?void 0:a.data)==null?void 0:l.message)})},removeFeed(e,t){let a=t.$index;this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`integration/global-feeds/${e}`).then(l=>{this.handleSuccess(l.message),this.feeds.splice(a,1)}).catch(l=>{var s;this.handleError(((s=l==null?void 0:l.data)==null?void 0:s.message)||"Failed to delete integration.")})}).catch(()=>{})},add(e){let t=this.available_integrations[e];t&&t.enabled?this.$router.push({name:"feed_editor",params:{integration_id:0,integration_name:e}}):this.$notify.error({message:this.$t("This integration is not enabled. Please enable it from the integration modules.")})},edit(e){this.$router.push({name:"feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},isEmpty:ud}},K4=Object.assign(N4,{setup(e){return(t,a)=>{const l=C("el-button"),s=C("el-dropdown-item"),i=C("el-dropdown-menu"),c=C("el-dropdown"),p=C("el-skeleton"),f=C("el-switch"),_=C("el-table-column"),g=C("el-tag"),y=C("el-popover"),v=C("el-tooltip"),w=C("el-table"),k=Va("loading");return r(),h("div",$4,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:t.$t("Global Integrations Feeds"),text:t.$t("These integration feeds will be applied globally across all your orders and related actions.")},{action:d(()=>[t.hasActiveIntegrations?(r(),h("div",E4,[n(c,{onCommand:t.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(i,null,{default:d(()=>[(r(!0),h(P,null,te(t.available_integrations,(b,S)=>(r(),E(s,{key:S,command:S},{default:d(()=>[R(m(b.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(l,{type:"info",plain:"",size:"small"},{default:d(()=>[R(m(t.$t("Add Integration"))+" ",1),n(Y,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title","text"]),n(ke,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(p,{class:"px-5 pb-5",loading:t.loading,animated:"",rows:6},null,8,["loading"]),t.loading?x("",!0):(r(),h(P,{key:0},[t.hasActiveIntegrations?(r(),h("div",Q4,[Wt((r(),E(w,{data:t.feeds},{empty:d(()=>[n(Ct,{icon:"Folder",text:t.$t("You did not add any integration actions yet.")},null,8,["text"])]),default:d(()=>[n(_,{label:t.$t("Enabled"),width:60},{default:d(b=>[n(f,{"active-value":"yes","inactive-value":"no",onChange:S=>t.handleActive(b.row),modelValue:b.row.enabled,"onUpdate:modelValue":S=>b.row.enabled=S},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(_,{width:120,label:t.$t("Integration")},{default:d(b=>{var S,$;return[o("div",D4,[(S=t.available_integrations[b.row.provider])!=null&&S.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:t.available_integrations[b.row.provider].logo,alt:b.row.provider},null,8,V4)):x("",!0),o("span",T4,m((($=t.available_integrations[b.row.provider])==null?void 0:$.title)||b.row.provider),1)])]}),_:1},8,["label"]),n(_,{width:220,label:t.$t("Title")},{default:d(b=>[o("a",{class:"fct-action-link-btn",onClick:Ge(S=>t.edit(b.row),["prevent"]),href:"#"},m(b.row.name),9,M4)]),_:1},8,["label"]),n(_,{width:160,label:t.$t("Triggers")},{default:d(b=>[o("div",L4,[(r(!0),h(P,null,te((b.row.feed.event_trigger||[]).slice(0,2),(S,$)=>(r(),E(g,{key:S},{default:d(()=>[n(Y,{name:"Trigger"}),R(" "+m(A(da).headline(S)),1)]),_:2},1024))),128)),(b.row.feed.event_trigger||[]).length>2?(r(),E(y,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(g,{type:"info"},{default:d(()=>[R(" +"+m((b.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",R4,[(r(!0),h(P,null,te((b.row.feed.event_trigger||[]).slice(2),(S,$)=>(r(),E(g,{key:S+$},{default:d(()=>[n(Y,{name:"Trigger"}),R(" "+m(A(da).headline(S)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),n(_,{width:80},{default:d(b=>[o("div",O4,[n(v,{effect:"dark",content:t.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button",onClick:S=>t.edit(b.row),size:"x-small",hover:"primary"},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(v,{effect:"dark",content:t.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button",size:"x-small",onClick:S=>t.removeFeed(b.row.id,b),hover:"danger"},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[k,t.loading]])])):(r(),h("div",U4,[o("p",I4,m(t.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(l,{tag:"a",type:"primary",href:t.all_module_config_url},{default:d(()=>[R(m(t.$t("Configure Modules")),1)]),_:1},8,["href"])])),t.feeds.length?x("",!0):(r(),h("div",P4,[o("a",H4,m(t.$t("View Documentations")),1)]))],64))]),_:1})]),_:1})])}}}),G4={name:"Integrations",components:{Badge:fa,FluidTabItem:Qo,FluidTab:ad,CardBody:ke,CardContainer:Se,CardHeader:Ve,PageHeading:ol,IconButton:at,DynamicIcon:Y,Empty:Ct,GlobalIntegrationFeeds:K4},data(){return{search:"",fetching:!1,addOns:{},module_type:"all",integrationTab:"global",modules:["all","crm","lms","core","marketing"],installationLoading:!1,admin_url:ze.get("admin_url"),installing:!1,installingAdding:""}},computed:{filteredAddons(){let e=this.addOns;if(this.search){let t={};Tn(e,(a,l)=>{JSON.stringify(a).indexOf(this.search)!==-1&&(t[l]=a)}),e=t}if(this.module_type!="all"){let t={};Tn(e,(a,l)=>{a.categories&&a.categories.includes(this.module_type)&&(t[l]=a)}),e=t}return e},is_no_modules(){return ud(this.filteredAddons)}},mounted(){this.fetchAddons()},methods:{upgradeUrl:vm,fetchAddons(){this.fetching=!0,this.$get("integration/addons").then(e=>{this.addOns=e.addons}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},translate:u,changeModuleType(e){this.module_type=e},installAddon(e,t){this.installing=!0,this.installingAdding=t,this.$post("integration/feed/install-plugin",{addon:t}).then(a=>{this.$notify.success(a.message),window.location.reload()}).catch(a=>{this.handleError(a)}).finally(()=>{this.installing=!1,this.installingAdding=""})}}},z4={class:"fct-integration-container fct-layout-width"},j4={class:"fct-integration-content mt-8"},q4={class:"fct-integration-content-head"},Y4={class:"fct-card-header-title mb-1"},W4={class:"card-header-text mt-0"},J4={class:"flex items-center gap-3 justify-between py-5 mt-5 border border-solid border-gray-divider border-x-0 dark:border-dark-500 flex-col md:flex-row"},X4={class:"fct-integration-search"},Z4={key:1},ex={class:"fct-integration-card-content"},tx={class:"fct-integration-card-content-inner"},ax={class:"fct-integration-card-logo"},lx=["src","alt"],sx={class:"title"},nx={class:"desc"},ox={key:0,class:"mt-2"},ix={key:1,class:"mt-2"};function rx(e,t,a,l,s,i){const c=C("PageHeading"),p=C("GlobalIntegrationFeeds"),f=C("DynamicIcon"),_=C("IconButton"),g=C("FluidTabItem"),y=C("FluidTab"),v=C("el-input"),w=C("el-skeleton"),k=C("Badge"),b=C("el-button"),S=C("Empty"),$=C("CardBody"),D=C("CardContainer");return r(),h("div",z4,[n(c,{title:e.$t("Integrations & Addons")},null,8,["title"]),n(p),o("div",j4,[n(D,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",q4,[n(_,{circle:"",size:"large"},{default:d(()=>[n(f,{name:"EqualizerLine"})]),_:1}),o("div",null,[o("h2",Y4,m(e.$t("Integration Modules")),1),o("p",W4,m(e.$t("Configure your integrations and extend FluentCart to enhance your store's functionality.")),1)])]),o("div",J4,[n(y,null,{default:d(()=>[(r(!0),h(P,null,te(s.modules,(F,B)=>(r(),E(g,{key:B,class:de(["uppercase",F===s.module_type?"active":""]),onClick:U=>i.changeModuleType(F)},{default:d(()=>[R(m(F),1)]),_:2},1032,["onClick","class"]))),128))]),_:1}),o("div",X4,[n(v,{placeholder:e.$t("Search..."),modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=F=>s.search=F)},{prefix:d(()=>[n(f,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),s.fetching?(r(),E(w,{key:0,loading:!0,animated:"",rows:4})):x("",!0),s.fetching?x("",!0):(r(),h("div",Z4,[(r(!0),h(P,null,te(i.filteredAddons,(F,B)=>(r(),h("div",{key:B,class:de(["fct-integration-card","addon-enabled-"+F.enabled])},[o("div",ex,[o("div",tx,[o("div",ax,[F.logo?(r(),h("img",{key:0,src:F.logo,alt:F.title},null,8,lx)):x("",!0)]),o("div",null,[o("h5",sx,[R(m(F.title)+" ",1),F.is_pro&&!F.enabled?(r(),E(k,{key:0,status:"warning",text:"Pro"})):(r(),E(k,{key:1,status:F.enabled?"active":"info",text:F.enabled?"enabled":"disabled"},null,8,["status","text"]))]),o("p",nx,m(F.description),1),F.is_pro&&!F.is_pro_active?(r(),h("div",ox,[n(b,{type:"warning",size:"small",tag:"a",href:i.upgradeUrl("feature_lock_integrations"),target:"_blank"},{default:d(()=>[n(f,{name:"Crown",class:"mr-1"}),R(" "+m(i.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])):!F.enabled&&F.installable?(r(),h("div",ix,[n(b,{loading:s.installingAdding==B,disabled:s.installingAdding==B,onClick:U=>i.installAddon(F,B),type:"primary",size:"small"},{default:d(()=>[R(m(i.translate("Install %s",F.title)),1)]),_:2},1032,["loading","disabled","onClick"])])):x("",!0)])])])],2))),128))])),i.is_no_modules&&!s.fetching?(r(),E(S,{key:2,icon:"Folder",text:e.$t("Sorry! No modules found based on your filter.")},null,8,["text"])):x("",!0)]),_:1})]),_:1})])])}const dx=nt(G4,[["render",rx]]),ux={class:"fct-connect-details"},cx={key:0,class:"fct-connect-require"},Ax=["src"],px={key:1,class:"fct-connect-success"},fx={class:"inline-flex items-center gap-3"},mx={key:0,class:"display-name"},hx={class:"display-role"},_x={name:"ConnectAccount",props:["connect","connectConfig","mode","method","methodName","methodLabel","brandColor"],data(){return{saving:!1}},methods:{disconnect(){this.saving=!0,this.$post("settings/payment-methods/disconnect",{method:this.method,mode:this.mode}).then(e=>{this.saving=!1,this.$emit("reload_settings",!0)})}}},oc=Object.assign(_x,{setup(e){return(t,a)=>{var c;const l=C("el-button"),s=C("el-tag"),i=C("el-popconfirm");return r(),h("div",ux,[!e.connect||e.connect.error?(r(),h("div",cx,[o("img",{src:e.connectConfig.image_url,alt:"",class:"w-10 h-10 mb-4"},null,8,Ax),o("h4",null,m(A(u)("Connect your %1$s %2$s account",e.mode,e.methodName)),1),n(l,{tag:"a",href:e.connectConfig[e.mode+"_redirect"],style:ra({backgroundColor:e.brandColor,borderColor:e.brandColor,color:"white"})},{default:d(()=>[R(m(A(u)("Connect with %1$s",e.methodLabel)),1)]),_:1},8,["href","style"])])):(r(),h("div",px,[o("div",fx,[o("div",null,[e.connect.display_name?(r(),h("p",mx,m(e.connect.display_name),1)):x("",!0),o("h4",hx,m(t.$t("Administrator"))+" ("+m(t.$t("Owner"))+") ",1)]),n(s,{size:"small",type:"success"},{default:d(()=>[R(m(A(u)("Connected")),1)]),_:1})]),n(i,{width:"230","confirm-button-text":t.$t("Confirm"),"cancel-button-text":t.$t("No, Thanks"),icon:"el-icon-info","icon-color":"red",title:((c=e.connectConfig)==null?void 0:c.disconnect_note)??t.$t("Are you sure to disconnect?"),position:"top",onConfirm:t.disconnect},{reference:d(()=>[n(l,{type:"danger",plain:""},{default:d(()=>[R(m(A(u)("Disconnect")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])]))])}}}),vx={__name:"Tabs",props:{fields:Object,settings:Object,tabs:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-tab-pane"),s=C("el-tabs");return r(),E(s,{class:"demo-tabs",modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=i=>e.settings[e.index]=i)},{default:d(()=>[(r(!0),h(P,null,te(e.tabs.schema,(i,c)=>(r(),E(l,{label:i.label,name:i.value,key:c},{default:d(()=>[o("div",null,[n(Fd,{fields:i.schema,settings:e.settings},null,8,["fields","settings"])])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}},gx={class:"setting-label"},yx=["innerHTML"],bx={key:0},wx={__name:"RadioSelectDependants",props:{fields:Object,settings:Object,index:[String,Number]},setup(e){return(t,a)=>{const l=C("el-icon"),s=C("el-tooltip"),i=C("el-radio"),c=C("el-radio-group");return r(),h(P,null,[o("p",gx,[R(m(e.fields[e.index].label)+" ",1),e.fields[e.index].tooltip?(r(),E(s,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:e.fields[e.index].tooltip},null,8,yx)]),default:d(()=>[n(l,null,{default:d(()=>[n(A(ll))]),_:1})]),_:1})):x("",!0)]),n(c,{modelValue:e.settings[e.index],"onUpdate:modelValue":a[0]||(a[0]=p=>e.settings[e.index]=p)},{default:d(()=>[(r(!0),h(P,null,te(e.fields[e.index].options,(p,f)=>(r(),E(i,{label:p,value:f,key:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),a[1]||(a[1]=o("br",null,null,-1)),a[2]||(a[2]=o("br",null,null,-1)),(r(!0),h(P,null,te(e.fields[e.index].dependants,(p,f)=>(r(),h("div",{key:f},[e.settings[e.index]===p.value?(r(),h("div",bx,[n(Fd,{fields:p.schema,settings:e.settings,index:e.index},null,8,["fields","settings","index"])])):x("",!0)]))),128))],64)}}},Cx={name:"PayPalWebhookSetup",components:{Notify:q},props:["mode","webhook_info","testConnect","liveConnect"],data(){return{isLoading:!1,setupStatus:null,checkingWebhook:!1}},computed:{isConnected(){return this.mode==="test"&&this.testConnect||this.mode==="live"&&this.liveConnect}},watch:{testConnect(){this.checkWebhookStatus()},liveConnect(){this.checkWebhookStatus()}},mounted(){this.checkWebhookStatus()},methods:{checkWebhookStatus(){this.isConnected&&(this.checkingWebhook=!0,this.$get("settings/payment-methods/paypal/webhook/check",{mode:this.mode}).then(e=>{this.checkingWebhook=!1}).catch(e=>{this.checkingWebhook=!1}))},setupWebhook(){this.isLoading=!0,this.$post("settings/payment-methods/paypal/webhook/setup",{mode:this.mode}).then(e=>{this.isLoading=!1,this.setupStatus="success",q.success(e.message),this.$emit("reload_settings",!0)}).catch(e=>{this.isLoading=!1,this.setupStatus="error",q.error(e.message),setTimeout(()=>{window.location.reload()},2e3)})}}},kx={key:0,class:"fluent_cart_paypal_webhook_setup"},Bx={class:"fluent_cart_paypal_webhook_setup_title"},xx=["innerHTML"],Sx={key:1};function Fx(e,t,a,l,s,i){const c=C("el-button"),p=Va("loading");return i.isConnected?(r(),h("div",kx,[o("p",Bx,"PayPal "+m(a.mode)+" webhook setup",1),a.webhook_info?Wt((r(),h("div",{key:0,"element-loading-text":"Checking webhook...",innerHTML:a.webhook_info},null,8,xx)),[[p,s.checkingWebhook]]):(r(),h("div",Sx,[t[1]||(t[1]=o("p",{class:"fluent_cart_paypal_webhook_setup_description"}," Configure PayPal webhooks to receive real-time payment notifications ",-1)),t[2]||(t[2]=o("br",null,null,-1)),n(c,{type:e.text,loading:s.isLoading,onClick:i.setupWebhook,disabled:s.isLoading,class:"setup-button",size:"small"},{default:d(()=>t[0]||(t[0]=[o("span",null,"Setup Webhook",-1)])),_:1,__:[0]},8,["type","loading","onClick","disabled"])]))])):x("",!0)}const $x=nt(Cx,[["render",Fx],["__scopeId","data-v-f187f73f"]]),Ex={key:0,class:"fct-col"},Ux=["innerHTML"],Ix={key:1,class:"fct-col"},Qx={class:"font-bold p-6 mt-6 text-center bg-gray-200"},Dx={key:2,class:"fct-col"},Vx={class:"bg-gray-25 dark:bg-dark-500 p-5 rounded flex flex-col"},Tx={class:"text-red-700"},Mx={key:1},Lx={key:0},Rx={class:"flex items-center justify-between"},Ox={key:1,class:"flex items-center justify-between"},Px={class:"text-red-700"},Hx={key:3,class:"fct-col"},Nx={class:"setting-label"},Kx=["innerHTML"],Gx={key:0,class:"fct-settings-description"},zx={key:4,class:"fct-col"},jx=["innerHTML"],qx={key:0,class:"fct-settings-description"},Yx={key:5,class:"fct-col"},Wx={class:"setting-label"},Jx=["innerHTML"],Xx={key:0,class:"fct-settings-description"},Zx={key:6,class:"fct-col"},e3={class:"setting-label flex items-center gap-1"},t3=["innerHTML"],a3={class:"options-img"},l3=["src"],s3={class:"options-name"},n3={class:"options-text"},o3={key:0,class:"fct-settings-description"},i3={key:7,class:"fct-col"},r3={key:0},d3=["innerHTML"],u3={key:8,class:"fct-col"},c3={class:"setting-label"},A3={key:0,class:"fct-settings-description"},p3={key:9,class:"fct-col"},f3={class:"setting-label"},m3={key:0,class:"fct-settings-description"},h3={key:10,class:"fct-col"},_3={class:"setting-label"},v3={key:0,class:"fct-settings-description"},g3={key:11,class:"fct-col"},y3={class:"setting-label"},b3=["innerHTML"],w3={key:0,class:"fct-settings-description"},C3={key:12,class:"fct-col"},k3={class:"setting-label"},B3=["innerHTML"],x3={key:0,class:"fct-settings-description"},S3={key:13,class:"fct-col"},F3={class:"setting-label"},$3=["innerHTML"],E3={key:0,class:"fct-settings-description"},U3={key:14,class:"fct-col"},I3={class:"setting-label"},Q3={key:0,class:"fct-settings-description"},D3={key:15,class:"fct-col"},V3=["innerHTML"],T3={key:1},M3={key:0,class:"setting-label"},L3={key:1,class:"copyable-content"},R3={key:2},O3={key:0,class:"setting-label"},P3={class:"fct-payment-steps-list"},H3={class:"fct-payment-steps-number"},N3=["innerHTML"],K3={key:4,class:"fct-events-wrap"},G3={class:"setting-label"},z3={class:"flex items-center gap-2 flex-wrap"},j3={class:"copyable-content"},q3={key:5,class:"fct-webhook-notice"},Y3={class:"fct-webhook-notice-title"},W3={class:"fct-webhook-notice-desc"},J3={key:0},X3={key:16,class:"fct-col"},Z3={key:0},eS={key:0},tS={class:"setting-label"},aS={class:"flex flex-wrap gap-2"},lS=["href"],sS={key:1},nS={class:"setting-label"},oS={class:"flex flex-wrap gap-2"},iS=["href"],rS={key:17,class:"fct-col"},dS={key:18,class:"fct-col"},Fd={__name:"Renderer",props:{fields:Object,settings:Object,routeName:String,methodName:String,methodTitle:String,methodLabel:String,brandColor:{type:String,default:"#253241"}},emits:["onSettingsChange"],setup(e,{emit:t}){const a=Jt().ctx,l=T({}),s=T(null),i=T(null),c=T(!1),p=T({}),f=ze.get("shop.order_mode"),_=e,g=t,y=K(()=>{var F,B,U;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?(B=_.settings)==null?void 0:B.define_test_keys:(U=_.settings)==null?void 0:U.define_live_keys});K(()=>{var F,B;return(F=_.fields)!=null&&F.payment_mode&&((B=_.settings)==null?void 0:B.payment_mode)!==f&&g("onSettingsChange",{..._.settings,payment_mode:f}),!0});const v=K(()=>{var F;return((F=_.settings)==null?void 0:F.payment_mode)==="test"?"test":"live"}),w=()=>{c.value=!0,a.$get("settings/payment-methods/connect/info",{method:_.routeName}).then(F=>{F&&(c.value=!1,l.value=F.connect_config,g("onSettingsChange",F.settings),s.value=F.live_account,i.value=F.test_account,s.value.error&&(p.value=s.value),i.value.error&&(p.value=i.value),c.value=!1)}).catch(F=>{c.value=!1,p.value=F}).finally(()=>{c.value=!1})},k=F=>{const B=F.target;if(B.classList.contains("fct-install-addon-btn")||B.closest(".fct-install-addon-btn")){F.preventDefault(),F.stopPropagation();const U=B.classList.contains("fct-install-addon-btn")?B:B.closest(".fct-install-addon-btn"),Q=U.getAttribute("data-addon-slug"),V=U.getAttribute("data-addon-file"),I=U.getAttribute("data-source-type"),M=U.getAttribute("data-source-link"),O=U.getAttribute("data-repo-link");Q&&V&&O&&S({slug:Q,source_type:I||"github",source_link:M||"",repo_link:O||""});return}if(B.classList.contains("fct-activate-addon-btn")||B.closest(".fct-activate-addon-btn")){F.preventDefault(),F.stopPropagation();const Q=(B.classList.contains("fct-activate-addon-btn")?B:B.closest(".fct-activate-addon-btn")).getAttribute("data-addon-file");Q&&$({file:Q})}},b=ze.get("app_config.isProActive"),S=F=>{if(!b){window.open(F.repo_link,"_blank","noopener,noreferrer");return}const B=document.querySelector(`[data-addon-slug="${F.slug}"]`);B&&(B.disabled=!0,B.innerHTML='<span class="el-icon-loading"></span> '+u("Installing...")),a.$post("settings/payment-methods/install-addon",{plugin_slug:F.slug,source_type:F.source_type,source_link:F.source_link}).then(U=>{q.success({message:U.message||u("Addon installed and activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{q.error({message:(U==null?void 0:U.message)||u("Failed to install addon")}),B&&(B.disabled=!1,B.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 10H18L12 16L6 10H11V3H13V10M4 19H20V12H22V20C22 20.5304 21.7893 21.0391 21.4142 21.4142C21.0391 21.7893 20.5304 22 20 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V12H4V19Z"/></svg>'+u("Install Addon"))})},$=F=>{const B=document.querySelector(`[data-addon-file="${F.file}"]`);B&&(B.disabled=!0,B.innerHTML='<span class="el-icon-loading"></span> '+u("Activating...")),a.$post("settings/payment-methods/activate-addon",{plugin_file:F.file}).then(U=>{q.success({message:U.message||u("Addon activated successfully!")}),setTimeout(()=>{window.location.reload()},1e3)}).catch(U=>{q.error({message:(U==null?void 0:U.message)||u("Failed to activate addon")}),B&&(B.disabled=!1,B.innerHTML='<svg style="width: 18px; height: 18px; margin-right: 8px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/></svg>'+u("Activate Addon"))})},D=F=>F?Array.isArray(F)?F:F[v.value]??[]:[];return Ie(()=>{w(),document.addEventListener("click",k)}),Bt(()=>{document.removeEventListener("click",k)}),(F,B)=>{const U=C("el-skeleton-item"),Q=C("el-skeleton"),V=C("el-icon"),I=C("el-tooltip"),M=C("el-switch"),O=C("el-checkbox"),L=C("el-option"),H=C("el-select"),j=C("el-radio"),W=C("el-radio-group"),G=C("el-input"),Z=C("el-input-number"),ne=C("el-checkbox-group"),ce=C("el-tag");return r(),h("div",{class:de([v.value==="test"?"fct_test_mode":"fct_live_mode","grid grid-cols-1 gap-4"])},[(r(!0),h(P,null,te(e.fields,(z,ue)=>{var ie,J,N,ae,oe,fe;return r(),h("div",{class:"fct-setting-row fct-row",key:ue},[z.type==="notice"?(r(),h("div",Ex,[o("p",{innerHTML:z.value},null,8,Ux)])):x("",!0),z.type==="upcoming"?(r(),h("div",Ix,[o("h1",Qx,m(A(u)("Upcoming")),1)])):x("",!0),z.type==="provider"?(r(),h("div",Dx,[z.value=="connect"?(r(),h(P,{key:0},[e.settings.payment_mode=="test"?(r(),h(P,{key:0},[n(Q,{loading:c.value,animated:""},{template:d(()=>[n(U,{variant:"h3",class:"w-[150px] mb-3"}),n(U,{variant:"p",class:"h-[50px]"})]),_:1},8,["loading"]),c.value?x("",!0):(r(),E(oc,{key:0,onReload_settings:B[0]||(B[0]=re=>w()),method:e.routeName,methodName:e.methodName,methodLabel:e.methodLabel,connectConfig:l.value,mode:"test",connect:i.value,brandColor:e.brandColor},null,8,["method","methodName","methodLabel","connectConfig","connect","brandColor"]))],64)):e.settings.payment_mode=="live"?(r(),h(P,{key:1},[n(Q,{loading:c.value,animated:""},{template:d(()=>[o("div",Vx,[n(U,{variant:"h3",class:"w-9 h-9 mb-7 mx-auto rounded"}),n(U,{variant:"h3",class:"w-[200px] mx-auto mb-3"}),n(U,{variant:"h3",class:"w-[120px] h-7.5 mx-auto"})])]),_:1},8,["loading"]),c.value?x("",!0):(r(),E(oc,{key:0,method:e.routeName,methodName:e.methodName,onReload_settings:B[1]||(B[1]=re=>w()),connectConfig:l.value,mode:"live",methodLabel:e.methodLabel,connect:s.value,brandColor:e.brandColor},null,8,["method","methodName","connectConfig","methodLabel","connect","brandColor"]))],64)):x("",!0),o("p",Tx,m((ie=p.value)==null?void 0:ie.error),1)],64)):(r(),h("div",Mx,[y.value?(r(),h("div",Lx,[o("div",null,[n(V2,{title:A(u)("Your API setup is Up & Running 🎉")},{default:d(()=>[o("div",Rx,[o("div",null,[o("b",null,m(A(u)("Payment API settings is enabled by defined API keys.")),1)])])]),_:1},8,["title"])])])):(r(),h("div",Ox,[o("div",null,[o("b",null,m(A(u)("Payment API settings is not enabled by API keys / Connect")),1),B[3]||(B[3]=o("br",null,null,-1)),o("p",null,m(A(u)("You can Set Up API keys defined as constant, Or use connect.")),1),o("p",Px,m((J=p.value)==null?void 0:J.error),1)])]))]))])):x("",!0),z.type==="enable"?(r(),h("div",Hx,[o("p",Nx,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,Kx)]),default:d(()=>[n(V,null,{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(M,{modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,"active-value":"yes","inactive-value":"no","active-text":A(u)("Active"),"inactive-text":A(u)("Inactive")},null,8,["modelValue","onUpdate:modelValue","active-text","inactive-text"]),z.description?(r(),h("p",Gx,m(z.description),1)):x("",!0)])):x("",!0),z.type==="checkbox"?(r(),h("div",zx,[n(O,{"true-value":"yes","false-value":"no",modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,disabled:z.disabled},{default:d(()=>[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,jx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]),z.description?(r(),h("p",qx,m(z.description),1)):x("",!0)])):x("",!0),z.type==="select"?(r(),h("div",Yx,[o("p",Wx,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,Jx)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(H,{placeholder:z.placeholder,modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,filterable:z.filterable!==!1},{default:d(()=>[(r(!0),h(P,null,te(z.options,(re,Ee)=>(r(),E(L,{label:re.label,value:re.value,key:Ee},null,8,["label","value"]))),128))]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue","filterable"]),z.description?(r(),h("p",Xx,m(z.description),1)):x("",!0)])):x("",!0),z.type==="radio"?(r(),h("div",Zx,[o("p",e3,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,t3)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(W,{modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,class:de({"fct-payment-setting-radio-box":typeof Object.values(z.options)[0]=="object"})},{default:d(()=>[(r(!0),h(P,null,te(z.options,(re,Ee)=>(r(),h(P,{key:Ee},[typeof re=="object"?(r(),E(j,{key:0,value:Ee},{default:d(()=>[o("div",a3,[o("img",{src:re.icon,alt:""},null,8,l3)]),o("div",null,[o("span",s3,m(re.label),1),o("span",n3,m(re.text),1)])]),_:2},1032,["value"])):(r(),E(j,{key:1,value:Ee},{default:d(()=>[R(m(re),1)]),_:2},1032,["value"]))],64))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class"]),z.description?(r(),h("p",o3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="webhook_info"&&((N=e.settings)==null?void 0:N.payment_mode)===z.mode?(r(),h("div",i3,[e.routeName==="paypal"&&!y.value?(r(),h("div",r3,[n($x,{testConnect:i.value,liveConnect:s.value,webhook_info:z.info,onReload_settings:B[2]||(B[2]=re=>w()),mode:z==null?void 0:z.mode},null,8,["testConnect","liveConnect","webhook_info","mode"])])):z.info?(r(),h("div",{key:1,innerHTML:z.info},null,8,d3)):x("",!0)])):x("",!0),z.type==="input"||z.type==="password"?(r(),h("div",u3,[o("p",c3,m(z.label),1),n(G,{type:z.type,placeholder:z.placeholder,modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,maxlength:z.max_length},null,8,["type","placeholder","modelValue","onUpdate:modelValue","maxlength"]),z.description?(r(),h("p",A3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="email"?(r(),h("div",p3,[o("p",f3,m(z.label),1),n(G,{type:"email",placeholder:z.placeholder,modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re},null,8,["placeholder","modelValue","onUpdate:modelValue"]),z.description?(r(),h("p",m3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="number"?(r(),h("div",h3,[o("p",_3,m(z.label),1),n(Z,{placeholder:z.placeholder,modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,max:z.max,min:z.min},null,8,["placeholder","modelValue","onUpdate:modelValue","max","min"]),z.description?(r(),h("p",v3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="text"?(r(),h("div",g3,[o("p",y3,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,b3)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(G,{type:"text",placeholder:z.placeholder,modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,disabled:z.disabled,maxlength:z.max_length},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled","maxlength"]),z.description?(r(),h("p",w3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="color"?(r(),h("div",C3,[o("p",k3,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,B3)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(kd,{modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,field:z},null,8,["modelValue","onUpdate:modelValue","field"]),z.description?(r(),h("p",x3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="file"?(r(),h("div",S3,[o("p",F3,[R(m(z.label)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",{innerHTML:z.tooltip},null,8,$3)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(Bi,{modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re,icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","onUpdate:modelValue","title"]),z.description?(r(),h("p",E3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="checkbox_group"?(r(),h("div",U3,[o("p",I3,[R(m(z.title)+" ",1),z.tooltip?(r(),E(I,{key:0,placement:"top-start","popper-class":"fct-tooltip"},{content:d(()=>[o("p",null,m(z.tooltip),1)]),default:d(()=>[n(V,{class:"text-gray-500"},{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),n(ne,{modelValue:e.settings[ue],"onUpdate:modelValue":re=>e.settings[ue]=re},{default:d(()=>[(r(!0),h(P,null,te(z.options,(re,Ee)=>(r(),E(O,{label:Ee,key:Ee},{default:d(()=>[R(m(re),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"]),z.description?(r(),h("p",Q3,m(z.description),1)):x("",!0)])):x("",!0),z.type==="html_attr"?(r(),h("div",D3,[typeof z.value=="string"?(r(),h("div",{key:0,innerHTML:z.value},null,8,V3)):typeof z.value=="object"&&z.value!==null?(r(),h("div",T3,[z.value.title?(r(),h("p",M3,m(z.value.title),1)):x("",!0),z.value.webhook_url?(r(),h("code",L3,m(z.value.webhook_url),1)):x("",!0),z.value.description?(r(),h("p",R3,m(z.value.description),1)):x("",!0),z.value.steps?(r(),h(P,{key:3},[z.value.steps.title?(r(),h("p",O3,m(z.value.steps.title),1)):x("",!0),o("ul",P3,[(r(!0),h(P,null,te(D(z.value.steps.list),(re,Ee)=>(r(),h("li",{key:Ee},[o("span",H3,m(Ee+1),1),o("span",{innerHTML:re},null,8,N3)]))),128))])],64)):x("",!0),z.value.events?(r(),h("div",K3,[o("p",G3,m(z.value.events.title),1),o("ul",z3,[(r(!0),h(P,null,te(D(z.value.events.list),(re,Ee)=>(r(),h("li",{key:Ee},[o("code",j3,m(re),1)]))),128))])])):x("",!0),z.value.webhook_notice?(r(),h("div",q3,[o("h4",Y3,m(z.value.webhook_notice.title),1),o("div",W3,m(z.value.webhook_notice.description),1),z.value.webhook_notice.list&&z.value.webhook_notice.list.length?(r(),h("ul",J3,[(r(!0),h(P,null,te(z.value.webhook_notice.list,(re,Ee)=>(r(),h("li",{key:Ee},m(re),1))),128))])):x("",!0)])):x("",!0)])):x("",!0)])):x("",!0),z.type==="active_methods"?(r(),h("div",X3,[(ae=z.value)!=null&&ae.activated_methods?(r(),h("div",Z3,[e.settings.payment_mode==="live"&&ue==="live_active_methods"?(r(),h("div",eS,[o("p",tS,m(z.label),1),R(" "+m(F.active_methods)+" ",1),o("ul",aS,[(r(!0),h(P,null,te(z.value.activated_methods,(re,Ee)=>(r(),E(ce,{key:Ee},{default:d(()=>[R(m(re!=null&&re.name?re.name:re),1)]),_:2},1024))),128))]),o("p",null,[R(m(A(u)("You can configure methods "))+" ",1),o("a",{href:(oe=z.value)==null?void 0:oe.configure_url,target:"_blank"},m(A(u)("here")),9,lS)])])):x("",!0),e.settings.payment_mode==="test"&&ue==="test_active_methods"?(r(),h("div",sS,[o("p",nS,m(z.label),1),o("ul",oS,[R(m(F.active_methods)+" ",1),(r(!0),h(P,null,te(z.value.activated_methods,(re,Ee)=>(r(),E(ce,{key:Ee},{default:d(()=>[R(m(re!=null&&re.name?re.name:re),1)]),_:2},1024))),128))]),o("p",null,[R(m(A(u)("You can configure methods "))+" ",1),o("a",{href:(fe=z.value)==null?void 0:fe.configure_url,target:"_blank"},m(A(u)("here")),9,iS)])])):x("",!0)])):x("",!0)])):x("",!0),z.type==="tabs"?(r(),h("div",rS,[n(vx,{fields:e.fields,settings:e.settings,index:ue,tabs:e.fields[ue]},null,8,["fields","settings","index","tabs"])])):x("",!0),z.type==="radio-select-dependants"?(r(),h("div",dS,[n(wx,{fields:e.fields,settings:e.settings,index:ue},null,8,["fields","settings","index"])])):x("",!0)])}),128))],2)}}},uS={class:"setting-wrap"},cS={class:"setting-wrap-inner"},AS={class:"mb-5 flex items-center justify-between"},pS={class:"setting-switcher flex items-center gap-3"},fS={class:"setting-save-action"},mS={name:"GlobalPaymentComponents",data(){return{fields:{},settings:{},saving:!1,fetching:!1,is_key_defined:!1,labelPosition:"top",webhook_url:"",fetchRoute:"",pages:[],route_name:"",ipn_url:"Blank",verifiedMessage:!1,verifiedStatus:!1,verifying:!1,methodName:"",methodTitle:"",methodLabel:"",brandColor:"#253241",editDesignModal:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",addonInfo:null,thank_you_page_instructions:""}},watch:{$route(e,t){this.getRoute(),this.getSettings(),this.getPageName()}},mounted(){this.getRoute(),this.getSettings(),window.outerWidth<500&&(this.labelPosition="top")},methods:{editDesign(){this.$router.push({name:"payment-design",params:{method:this.route_name}})},savePaymentDesign(){this.editDesignModal=!1,this.mediaSelection.length>0?this.checkout_logo=this.mediaSelection[0].url:this.checkout_logo="",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(e=>{this.saving=!1,ln("Settings updated!")})},getLogo(e){const t=e.replace(/_/g,"-");return gs.getUrl("images/payment-methods/"+t+"-icon.svg")},updateSettings(e){this.settings=e},getSettings(){this.fetching=!0,this.$get("settings/payment-methods/all").then(e=>{const t=e.gateways.find(a=>a.route===this.route_name);t&&(this.brandColor=t.brand_color||"#000000")}).catch(()=>{}),this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,c,p;this.fetching=!1,this.fields=e.fields,this.settings=e.settings,this.addonInfo=e.addon_info||null,this.registerCopyAction(),this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.checkout_logo?{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}:""}).catch(e=>{var t;this.fetching=!1,fr(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Failed to load settings")})},saveSettings(){this.saving=!0,this.$post("settings/payment-methods",{settings:this.settings,method:this.route_name}).then(e=>{this.saving=!1,ln("Settings updated!")}).catch(e=>{var t;this.saving=!1,fr(((t=e==null?void 0:e.data)==null?void 0:t.message)||"Something went wrong!")})},verifyKeys(e,t){this.verifying=!0},getRoute(){var e,t,a,l,s,i,c,p,f;this.route_name=this.$route.name,this.methodName=(e=this.$route)==null?void 0:e.name,(a=(t=this.$route)==null?void 0:t.meta)!=null&&a.admin_title?this.methodTitle=(s=(l=this.$route)==null?void 0:l.meta)==null?void 0:s.admin_title:this.methodTitle=(c=(i=this.$route)==null?void 0:i.meta)==null?void 0:c.title,this.methodLabel=(f=(p=this.$route)==null?void 0:p.meta)==null?void 0:f.label,this.fetchRoute=`settings/payments/${this.$route.name}`},getPageName(){let e="";return this.$route.meta.title?e=this.$route.meta.title+" Settings":e=this.$route.name.charAt(0).toUpperCase()+this.$route.name.slice(1).toLowerCase()+" Settings",e}}},hS=Object.assign(mS,{setup(e){const t=Jt().ctx;return ws().onSave(()=>{t.saveSettings()}),(l,s)=>{const i=C("el-breadcrumb-item"),c=C("el-breadcrumb"),p=C("el-switch"),f=C("Edit"),_=C("el-icon"),g=C("el-skeleton"),y=C("el-button");return r(),h("div",uS,[o("div",cS,[o("div",AS,[n(c,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[n(i,{to:{path:"/settings/payments"}},{default:d(()=>[R(m(l.$t("Payment Settings")),1)]),_:1}),n(i,null,{default:d(()=>[o("span",null,m(l.methodTitle),1)]),_:1})]),_:1},8,["separator-icon"]),o("div",pS,[n(p,{modelValue:l.settings.is_active,"onUpdate:modelValue":s[0]||(s[0]=v=>l.settings.is_active=v),"active-value":"yes","inactive-value":"no","inactive-text":l.$t("Payment Activation")},null,8,["modelValue","inactive-text"])])]),n(Se,null,{default:d(()=>[n(Ve,{title:l.methodTitle,border_bottom:""},{action:d(()=>[n(_,{class:"text-gray-500 cursor-pointer",onClick:l.editDesign},{default:d(()=>[n(f)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(ke,{class:"pt-0"},{default:d(()=>[n(g,{loading:l.fetching,animated:"",rows:6,class:"pt-5"},null,8,["loading"]),l.fetching?x("",!0):(r(),E(Fd,{key:0,onOnSettingsChange:l.updateSettings,routeName:l.route_name,methodName:l.methodName,methodTitle:l.methodTitle,methodLabel:l.methodLabel,brandColor:l.brandColor,fields:l.fields,settings:l.settings},null,8,["onOnSettingsChange","routeName","methodName","methodTitle","methodLabel","brandColor","fields","settings"]))]),_:1})]),_:1}),o("div",fS,[n(y,{onClick:s[1]||(s[1]=v=>l.saveSettings()),type:"primary",loading:l.saving},{default:d(()=>[R(m(l.$t("Save Settings")),1)]),_:1},8,["loading"])])])])}}}),_S={class:"setting-wrap"},vS={class:"setting-wrap-inner"},gS={class:"setting-save-action"},yS={name:"PaymentDesign",components:{SettingsHeader:Ua},data(){return{settings:{},fetching:!1,saving:!1,mediaSelection:[],checkout_label:"",checkout_logo:"",checkout_instructions:"",thank_you_page_instructions:"",route_name:"",methodTitle:"",routeLabel:""}},mounted(){this.initRouteData(),this.getSettings()},methods:{goBack(){this.$router.push({path:`/settings/payments/${this.route_name}`})},savePaymentDesign(){var t;this.saving=!0;let e="";Array.isArray(this.mediaSelection)&&this.mediaSelection.length>0?e=((t=this.mediaSelection[0])==null?void 0:t.url)||"":this.mediaSelection&&typeof this.mediaSelection=="object"&&this.mediaSelection.url?e=this.mediaSelection.url:typeof this.mediaSelection=="string"&&(e=this.mediaSelection),this.checkout_logo=e||"",this.$post("settings/payment-methods/design",{checkout_label:this.checkout_label,checkout_logo:this.checkout_logo,checkout_instructions:this.checkout_instructions,thank_you_page_instructions:this.thank_you_page_instructions,method:this.route_name}).then(a=>{this.saving=!1,ln("Settings updated!"),this.getSettings()}).catch(()=>{this.saving=!1,fr("Something went wrong!")})},getSettings(){this.fetching=!0,this.$get("settings/payment-methods",{method:this.route_name}).then(e=>{var t,a,l,s,i,c,p;this.fetching=!1,this.settings=e.settings,this.checkout_label=(t=this.settings)!=null&&t.checkout_label?(a=this.settings)==null?void 0:a.checkout_label:this.methodTitle,this.checkout_logo=(l=this.settings)==null?void 0:l.checkout_logo,this.checkout_instructions=((s=this.settings)==null?void 0:s.checkout_instructions)||"",this.thank_you_page_instructions=((i=this.settings)==null?void 0:i.thank_you_page_instructions)||"",this.mediaSelection=(c=this.settings)!=null&&c.checkout_logo?[{url:(p=this.settings)==null?void 0:p.checkout_logo,id:0,title:"Checkout Logo"}]:""}).catch(()=>{this.fetching=!1})},initRouteData(){var a,l,s,i,c,p;this.route_name=this.$route.params.method||this.$route.name,(l=(a=this.$route)==null?void 0:a.meta)!=null&&l.admin_title?this.methodTitle=(i=(s=this.$route)==null?void 0:s.meta)==null?void 0:i.admin_title:this.methodTitle=((p=(c=this.$route)==null?void 0:c.meta)==null?void 0:p.title)||"",this.routeLabel=this.methodTitle||this.route_name;const e=this.$t("Gateway & checkout instructions"),t=this.methodTitle?`${this.methodTitle} - ${e}`:e;this.$route&&this.$route.meta&&(this.$route.meta.title=t)}}},bS=Object.assign(yS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-icon"),c=C("el-button"),p=C("el-skeleton"),f=C("el-input"),_=C("el-form-item"),g=C("el-form");return r(),h("div",_S,[n(Ua,{onOnSave:t.savePaymentDesign,loading:t.saving,"save-button-text":t.$t("Update"),"loading-text":t.$t("Updating")},{heading:d(()=>[n(s,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[n(l,{to:{path:"/settings/payments"}},{default:d(()=>[R(m(t.$t("Payment Settings")),1)]),_:1}),n(l,null,{default:d(()=>[o("span",{class:"cursor-pointer",onClick:a[0]||(a[0]=(...y)=>t.goBack&&t.goBack(...y))},m(t.$route.params.method),1)]),_:1}),n(l,null,{default:d(()=>[o("span",null,m(t.$t("Checkout Customization")),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["onOnSave","loading","save-button-text","loading-text"]),o("div",vS,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Customization"),border_bottom:""},{action:d(()=>[n(c,{onClick:t.goBack,type:"text",class:"cursor-pointer border-none p-0"},{default:d(()=>[n(i,{class:"text-gray-500 cursor-pointer",onClick:t.goBack},{default:d(()=>[n(A(sm))]),_:1},8,["onClick"]),R(" "+m(t.$t("Back to Gateway Settings")),1)]),_:1},8,["onClick"])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(p,{loading:t.fetching,animated:"",rows:4,class:"pt-2"},null,8,["loading"]),t.fetching?x("",!0):(r(),E(g,{key:0,"label-position":"left"},{default:d(()=>[n(_,{label:t.$t("Checkout Label")},{default:d(()=>[n(f,{type:"text",modelValue:t.checkout_label,"onUpdate:modelValue":a[1]||(a[1]=y=>t.checkout_label=y)},null,8,["modelValue"])]),_:1},8,["label"]),n(_,{label:t.$t("Checkout Logo")},{default:d(()=>[n(Bi,{modelValue:t.mediaSelection,"onUpdate:modelValue":a[2]||(a[2]=y=>t.mediaSelection=y),icon:"Upload",title:t.$t("Upload Logo")},null,8,["modelValue","title"])]),_:1},8,["label"]),n(_,{"label-position":"top"},{default:d(()=>[n(pa,{title:t.$t("Checkout Instructions"),content:t.$t("Checkout Instructions will be displayed on the checkout page gateway section.")},null,8,["title","content"]),n(ls,{modelValue:t.checkout_instructions,"onUpdate:modelValue":a[3]||(a[3]=y=>t.checkout_instructions=y),onUpdate:a[4]||(a[4]=y=>{t.checkout_instructions=y})},null,8,["modelValue"])]),_:1}),a[7]||(a[7]=o("div",{class:"h-10"},null,-1)),n(_,{"label-position":"top"},{default:d(()=>[n(pa,{title:t.$t("Thank you page Instruction"),content:t.$t("Thank you page Instruction will be displayed on the thank you page receipt section.")},null,8,["title","content"]),n(ls,{modelValue:t.thank_you_page_instructions,"onUpdate:modelValue":a[5]||(a[5]=y=>t.thank_you_page_instructions=y),onUpdate:a[6]||(a[6]=y=>{t.thank_you_page_instructions=y})},null,8,["modelValue"])]),_:1})]),_:1,__:[7]}))]),_:1})]),_:1}),o("div",gS,[n(c,{type:"primary",loading:t.saving,onClick:t.savePaymentDesign},{default:d(()=>[R(m(t.$t("Update")),1)]),_:1},8,["loading","onClick"])])])])}}}),wS={class:"fct-integration-setting-content"},CS={class:"fct-integration-setting-head"},kS={class:"flex items-center gap-3 mb-2"},BS=["src"],xS={class:"title"},SS=["innerHTML"],FS={key:0,class:"integration_success_state"},$S=["innerHTML"],ES={key:1,class:"fct-integration-setting-body"},US={class:"fct-integration-setting-body-inner"},IS=["innerHTML"],QS=["innerHTML"],DS=["target","href"],VS={key:0},TS={key:0,class:"fct-integration-setting-body-footer"},MS={key:2},LS={name:"GeneralIntegration",components:{InfoFilled:ll,Setting:Jc},props:["settings_key"],data(){return{integration:{},loading:!1,saving:!1,settings:{},error_message:""}},watch:{settings_key(){this.integration={},this.settings={},this.getIntegrationSettings()}},mounted(){this.getIntegrationSettings()},methods:{save(){this.saving=!0,this.$post("integration/global-settings",{settings_key:this.settings_key,integration:this.integration}).then(e=>{if(this.saving=!1,this.handleSuccess(e.data.message),e.data.redirect_url){window.location.href=e.data.redirect_url;return}this.integration.status=e.data.status}).catch(e=>{this.integration.status=!1,e&&e.data.message?this.handleError(e.data.message):e&&e.responseJSON.data.message&&this.handleerror(e.responseJSON.data.message)})},getIntegrationSettings(){this.loading=!0,this.$get("integration/global-settings",{settings_key:this.settings_key}).then(e=>{this.loading=!1,this.integration=e.data.integration,this.settings=e.data.settings}).catch(e=>{this.error_message=e.responseJSON.data.message})},disconnect(e){this.integration=e,this.save()},authenticate(e,t){this.loading=!0,this.$post("integration/global-settings"+e,{settings_key:this.settings_key,integration:this.integration}).then(a=>{this.loading=!1,a.data.url?window.open(a.data.url,"_blank"):this.handleSuccess(a.data.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})}}},RS=Object.assign(LS,{setup(e){const t=Jt().ctx;return ws().onSave(()=>{t.integration.status||t.save()}),(l,s)=>{const i=C("el-button"),c=C("el-icon"),p=C("el-tooltip"),f=C("el-option"),_=C("el-select"),g=C("el-input"),y=C("el-form-item"),v=C("el-form"),w=Va("loading");return r(),h("div",wS,[o("div",CS,[o("div",kS,[l.settings.logo?(r(),h("img",{key:0,class:"h-8",src:l.settings.logo,alt:""},null,8,BS)):x("",!0),o("h3",xS,m(l.settings.menu_title),1)]),o("p",{class:"desc",innerHTML:l.settings.menu_description},null,8,SS)]),l.settings.hide_on_valid&&l.integration.status?(r(),h("div",FS,[o("p",{innerHTML:l.settings.discard_settings.section_description},null,8,$S),o("div",null,[n(i,{onClick:s[0]||(s[0]=k=>l.disconnect(l.settings.discard_settings.data)),type:"danger",plain:""},{default:d(()=>[R(m(l.settings.discard_settings.disconnect_button_text),1)]),_:1}),l.settings.discard_settings.show_verify?(r(),E(i,{key:0,onClick:s[1]||(s[1]=k=>l.save()),type:"primary"},{default:d(()=>[R(m(l.settings.discard_settings.verify_button_text),1)]),_:1})):x("",!0)])])):Wt((r(),h("div",ES,[o("div",US,[l.settings.config_instruction&&!l.integration.status?(r(),h("div",{key:0,class:"integration_instraction",innerHTML:l.settings.config_instruction},null,8,IS)):x("",!0),n(v,{"label-width":"205px","label-position":"top"},{default:d(()=>[(r(!0),h(P,null,te(l.settings.fields,(k,b)=>(r(),E(y,{key:b},{label:d(()=>[R(m(k.label)+" ",1),k.label_tips?(r(),E(p,{key:0,"popper-class":"fct-tooltip",placement:"top-start"},{content:d(()=>[o("div",{innerHTML:k.label_tips},null,8,QS)]),default:d(()=>[n(c,null,{default:d(()=>[n(A(ll))]),_:1})]),_:2},1024)):x("",!0)]),default:d(()=>[k.type=="authenticate-button"?(r(),E(i,{key:0,onClick:S=>l.authenticate(k.end_point,k.params)},{default:d(()=>[R(m(k.button_text),1)]),_:2},1032,["onClick"])):k.type=="select"?(r(),E(_,{key:1,modelValue:l.integration[b],"onUpdate:modelValue":S=>l.integration[b]=S},{default:d(()=>[(r(!0),h(P,null,te(k.options,(S,$)=>(r(),E(f,{key:$,label:S,value:$},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):k.type=="link"?(r(),h(P,{key:2},[o("a",{target:k.target,class:de(k.btn_class),href:k.link},m(k.link_text),11,DS),o("p",null,m(k.tips),1)],64)):(r(),h(P,{key:3},[n(g,{placeholder:k.placeholder,type:k.type,modelValue:l.integration[b],"onUpdate:modelValue":S=>l.integration[b]=S},null,8,["placeholder","type","modelValue","onUpdate:modelValue"]),k.tips?(r(),h("p",VS,m(k.tips),1)):x("",!0)],64))]),_:2},1024))),128))]),_:1})]),l.loading?x("",!0):(r(),h("div",TS,[n(i,{type:"primary",onClick:l.save},{default:d(()=>[R(m(l.settings.save_button_text),1)]),_:1},8,["onClick"])]))])),[[w,l.loading]]),l.error_message?(r(),h("p",MS,m(l.error_message),1)):x("",!0)])}}}),OS={class:"fct-integration-setting-container fct-layout-width"},PS={class:"single-page-header"},HS={class:"single-page-body"},NS={class:"fct-integration-setting-wrap"},KS={name:"IntegrationEditor"},GS=Object.assign(KS,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb");return r(),h("div",OS,[o("div",PS,[n(s,{"separator-icon":A(Al)},{default:d(()=>[n(l,{to:{name:"integrations"}},{default:d(()=>[R(m(t.$t("Integrations")),1)]),_:1}),n(l,null,{default:d(()=>[R(m(A(da).capitalize(t.$route.params.integration_name)),1)]),_:1})]),_:1},8,["separator-icon"])]),o("div",HS,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",NS,[n(RS,{settings_key:t.$route.params.integration_name},null,8,["settings_key"])])]),_:1})]),_:1})])])}}}),zS={class:"fct-form-group"},jS={for:"store-country"},qS={class:"fct-form-group"},YS={class:"fct-form-group"},WS={class:"fct-form-group"},JS={__name:"OnboardingStoreInfoStep",props:{savedFormData:{type:Object,default:null},initialSettings:{type:Object,default:null},countries:{type:Array,default:()=>[]},currencies:{type:Object,default:()=>({})}},emits:["storeCountryChanged"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=T({store_name:"",store_logo:"",store_country:"",currency:""});be(()=>l.savedFormData??l.initialSettings,f=>{f&&(i.value.store_name=f.store_name??"",i.value.store_logo=f.store_logo??"",i.value.store_country=f.store_country??"",i.value.currency=f.currency??"")},{immediate:!0});const c=f=>{s("storeCountryChanged",f),f&&Ae.post("settings/store",{store_country:f,store_name:i.value.store_name,settings_name:"store_setup"}).catch(()=>{})};return t({onNextStep:async()=>{const f=Array.isArray(i.value.store_logo)&&i.value.store_logo.length>0?i.value.store_logo[0]:i.value.store_logo;try{await Ae.post("onboarding/",{store_name:i.value.store_name,store_logo:f,store_country:i.value.store_country,currency:i.value.currency})}catch{q.warning(u("Store info could not be saved. You can update it in Settings."))}return!0},getFormData:()=>({...i.value})}),(f,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-input");return r(),h(P,null,[o("div",zS,[o("label",jS,m(A(u)("Store Country")),1),n(y,{modelValue:i.value.store_country,"onUpdate:modelValue":_[0]||(_[0]=w=>i.value.store_country=w),placeholder:A(u)("Store Country"),onChange:c,filterable:""},{default:d(()=>[(r(!0),h(P,null,te(e.countries,(w,k)=>(r(),E(g,{key:k,label:w.name,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",qS,[o("label",null,m(A(u)("Shop Name")),1),n(v,{modelValue:i.value.store_name,"onUpdate:modelValue":_[1]||(_[1]=w=>i.value.store_name=w)},null,8,["modelValue"])]),o("div",YS,[o("label",null,m(A(u)("Store Currency")),1),n(y,{modelValue:i.value.currency,"onUpdate:modelValue":_[2]||(_[2]=w=>i.value.currency=w),filterable:"",placeholder:A(u)("Select")},{default:d(()=>[(r(!0),h(P,null,te(e.currencies,(w,k)=>(r(),E(g,{key:k,label:w.label,value:w.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",WS,[o("label",null,m(A(u)("Shop Image/Logo")),1),n(Bi,{modelValue:i.value.store_logo,"onUpdate:modelValue":_[3]||(_[3]=w=>i.value.store_logo=w),showSupported:"",icon:"Upload",title:A(u)("Upload")},null,8,["modelValue","title"])])],64)}}},$d=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK"],XS=[...$d,"GB","AU","NZ","CA","IN"],ZS=[...$d,"GB","AU","NZ"],eF={class:"fct-tax-step"},tF={class:"fct-tax-step-toggle-row"},aF={class:"fct-tax-step-toggle-row__label"},lF={class:"fct-alert-content"},sF={class:"fct-alert-text"},nF={class:"fct-form-group"},oF={key:0,class:"fct-tax-step-country-chip"},iF={key:1,class:"fct-tax-step-country-chip fct-tax-step-country-chip--empty"},rF={class:"fct-form-group"},dF={class:"fct-tax-step-radio-group",role:"radiogroup"},uF=["aria-checked"],cF={class:"fct-tax-step-radio-card__label"},AF={class:"fct-tax-step-radio-card__desc"},pF=["aria-checked"],fF={class:"fct-tax-step-radio-card__label"},mF={class:"fct-tax-step-radio-card__desc"},hF={key:0,class:"fct-form-group"},_F={class:"fct-tax-step-radio-group",role:"radiogroup"},vF=["aria-checked"],gF={class:"fct-tax-step-radio-card__label"},yF={class:"fct-tax-step-radio-card__desc"},bF=["aria-checked"],wF={class:"fct-tax-step-radio-card__label"},CF={class:"fct-tax-step-radio-card__desc"},kF=["aria-checked"],BF={class:"fct-tax-step-radio-card__label"},xF={class:"fct-tax-step-radio-card__desc"},SF={class:"fct-form-group"},FF={class:"fct-tax-step-optional"},$F={class:"fct-form-help-text"},EF={class:"fct-alert-content"},UF={class:"fct-alert-text"},IF={__name:"OnboardingTaxStep",props:{savedFormData:{type:Object,default:null},storeCountry:{type:String,default:""},countryName:{type:String,default:""},initialTaxSettings:{type:Object,default:null}},setup(e,{expose:t}){const a=e,l=T({collectTaxes:!1,taxInclusion:"excluded",euMethod:"oss",vatNumber:""}),s=K(()=>$d.includes(a.storeCountry)),i=y=>{l.value={...l.value,...y}},c=K(()=>{if(!s.value)return u("Tax ID / VAT Number");if(l.value.euMethod==="oss")return u("OSS VAT Number");if(l.value.euMethod==="specific"){const y=a.countryName||a.storeCountry;return u("%1$s VAT Number",y)}return u("Home VAT Number")}),p=K(()=>s.value?u("Standard EU VAT rates will be imported automatically for all EU countries."):a.countryName?u("A standard tax class will be created for %1$s. Add your rates in Tax → Tax Rates after setup.",a.countryName):u("A standard tax class will be created. Add your rates in Tax → Tax Rates after setup.")),f=y=>{l.value={collectTaxes:XS.includes(y),taxInclusion:ZS.includes(y)?"included":"excluded",euMethod:"oss",vatNumber:""}};be(()=>a.storeCountry,f),Ie(()=>{if(a.savedFormData){l.value={...a.savedFormData};return}const y=a.initialTaxSettings;y&&y.enable_tax==="yes"?l.value={collectTaxes:!0,taxInclusion:y.tax_inclusion||"excluded",euMethod:y.eu_method||"oss",vatNumber:y.vat_number||""}:f(a.storeCountry)});const _=async()=>{try{await Ae.post("onboarding/save-tax",{enable_tax:l.value.collectTaxes?"yes":"no",store_country:a.storeCountry,tax_inclusion:l.value.taxInclusion,eu_method:l.value.euMethod,vat_number:l.value.vatNumber})}catch{q.warning(u("Tax settings could not be saved. You can configure them in Tax → Settings."))}return!0},g=(y,v)=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i(v))};return t({onNextStep:_,getFormData:()=>({...l.value})}),(y,v)=>{const w=C("el-switch"),k=C("el-input");return r(),h("div",eF,[o("div",tF,[o("span",aF,m(A(u)("Collect taxes for my store")),1),n(w,{"model-value":l.value.collectTaxes,"onUpdate:modelValue":v[0]||(v[0]=b=>i({collectTaxes:b}))},null,8,["model-value"])]),l.value.collectTaxes?(r(),h(P,{key:1},[o("div",nF,[o("label",null,m(A(u)("Store country")),1),o("div",null,[e.countryName||e.storeCountry?(r(),h("span",oF,[n(Y,{name:"Globe"}),R(" "+m(e.countryName||e.storeCountry),1)])):(r(),h("span",iF,m(A(u)("Not set")),1))])]),e.storeCountry?(r(),h(P,{key:0},[o("div",rF,[o("label",null,m(A(u)("How do you display your prices?")),1),o("div",dF,[o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="included"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="included",onClick:v[1]||(v[1]=b=>i({taxInclusion:"included"})),onKeydown:v[2]||(v[2]=b=>g(b,{taxInclusion:"included"}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="included"}])},null,2),o("div",null,[o("div",cF,m(A(u)("Prices include tax")),1),o("div",AF,m(A(u)("Tax is already factored into your listed price.")),1)])],42,uF),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.taxInclusion==="excluded"}]),role:"radio",tabindex:"0","aria-checked":l.value.taxInclusion==="excluded",onClick:v[3]||(v[3]=b=>i({taxInclusion:"excluded"})),onKeydown:v[4]||(v[4]=b=>g(b,{taxInclusion:"excluded"}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.taxInclusion==="excluded"}])},null,2),o("div",null,[o("div",fF,m(A(u)("Add tax at checkout")),1),o("div",mF,m(A(u)("Tax is shown separately and added to the subtotal.")),1)])],42,pF)])]),s.value?(r(),h("div",hF,[o("label",null,m(A(u)("Cross-border compliance")),1),o("div",_F,[o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="oss"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="oss",onClick:v[5]||(v[5]=b=>i({euMethod:"oss",vatNumber:""})),onKeydown:v[6]||(v[6]=b=>g(b,{euMethod:"oss",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="oss"}])},null,2),o("div",null,[o("div",gF,m(A(u)("OSS (One Stop Shop)")),1),o("div",yF,m(A(u)("Charge each EU customer their country's VAT rate.")),1)])],42,vF),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="home"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="home",onClick:v[7]||(v[7]=b=>i({euMethod:"home",vatNumber:""})),onKeydown:v[8]||(v[8]=b=>g(b,{euMethod:"home",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="home"}])},null,2),o("div",null,[o("div",wF,m(A(u)("Home Country Only")),1),o("div",CF,m(A(u)("Charge all EU customers your home country's rate.")),1)])],42,bF),o("div",{class:de(["fct-tax-step-radio-card",{"is-selected":l.value.euMethod==="specific"}]),role:"radio",tabindex:"0","aria-checked":l.value.euMethod==="specific",onClick:v[9]||(v[9]=b=>i({euMethod:"specific",vatNumber:""})),onKeydown:v[10]||(v[10]=b=>g(b,{euMethod:"specific",vatNumber:""}))},[o("span",{class:de(["fct-tax-step-radio-dot",{"is-active":l.value.euMethod==="specific"}])},null,2),o("div",null,[o("div",BF,m(A(u)("Only for %1$s",e.countryName||e.storeCountry)),1),o("div",xF,m(A(u)("Only collect VAT from customers in %s.",e.countryName||e.storeCountry)),1)])],42,kF)])])):x("",!0),o("div",SF,[o("label",null,[R(m(c.value)+" ",1),o("span",FF,m(A(u)("(optional)")),1)]),n(k,{"model-value":l.value.vatNumber,"onUpdate:modelValue":v[11]||(v[11]=b=>i({vatNumber:b})),placeholder:s.value?"DE123456789":""},null,8,["model-value","placeholder"]),o("p",$F,m(A(u)("Your registration number, printed on invoices")),1)]),n(el,{icon:"Info"},{content:d(()=>[o("div",EF,[o("p",UF,m(p.value),1)])]),_:1})],64)):x("",!0)],64)):(r(),E(el,{key:0},{content:d(()=>[o("div",lF,[o("p",sF,m(A(u)("Tax collection is disabled. Enable it any time in Tax → Settings.")),1)])]),_:1}))])}}},QF={class:"dialog-footer"},DF={__name:"CreatePageButton",props:{title:{default:u("Create Page")},content:{required:!0,type:String}},emits:["onPageCreated"],setup(e,{emit:t}){const a=e,l=t,s=T(!1),i=T(a.title),c=()=>{Ae.post("onboarding/create-page",{page_name:i.value,content:a.content}).then(p=>{l("onPageCreated",{value:p.page_id,label:`${i.value}( ${p.page_id})`,page_link:p.link}),i.value="",s.value=!1,q.success(u("The page created successfully."))}).catch(p=>{if(p&&p.hasOwnProperty("page_name")){const f=Object.entries(p.page_name).length;let _="",g=0;for(const y in p.page_name)_+=p.page_name[y],g!==f&&(_+=` | |
| 151 | +`),g++;q.error(_)}else q.error(u("Sorry, Unable To Create Page!!"))})};return(p,f)=>{const _=C("el-input"),g=C("el-form-item"),y=C("el-form"),v=C("el-button"),w=C("el-dialog");return r(),h(P,null,[n(at,{onClick:f[0]||(f[0]=Ge(k=>s.value=!0,["prevent"])),tag:"button",bg:"info",outline:""},{default:d(()=>[n(Y,{name:"Plus"})]),_:1}),n(w,{modelValue:s.value,"onUpdate:modelValue":f[3]||(f[3]=k=>s.value=k),title:A(u)("Create %s Page",e.title),width:"35%",center:"","append-to-body":!0},{footer:d(()=>[o("div",QF,[n(v,{onClick:f[2]||(f[2]=k=>s.value=!1),type:"info",soft:""},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(v,{type:"primary",onClick:c},{default:d(()=>[R(m(A(u)("Create Page")),1)]),_:1})])]),default:d(()=>[n(y,{"require-asterisk-position":"right","label-position":"top",onSubmit:Ge(c,["prevent"])},{default:d(()=>[n(g,{label:A(u)("Page Name"),required:""},{default:d(()=>[n(_,{modelValue:i.value,"onUpdate:modelValue":f[1]||(f[1]=k=>i.value=k),placeholder:A(u)("Page Name")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},VF={class:"fct-form-group"},TF={class:"fct-form-group-inner"},MF={class:"input-prepend"},LF={class:"input-append"},RF={__name:"PageSelector",props:bl({title:{type:String,required:!0},pages:{type:Array,required:!0},modelId:{type:String,required:!0}},{modelValue:{},modelModifiers:{}}),emits:bl(["onPageCreated"],["update:modelValue"]),setup(e,{emit:t}){const a=Il(e,"modelValue",{get:c=>c?typeof c=="string"?Number(c):c:""}),l=t,s=T(!1),i=c=>{s.value=c};return(c,p)=>{const f=C("el-option"),_=C("el-select");return r(),h("div",VF,[o("label",null,m(e.title),1),o("div",TF,[o("div",{class:de(["fct-input-group w-full",{focused:s.value}])},[o("div",MF,[n(_,{filterable:"",modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=g=>a.value=g),onFocus:p[1]||(p[1]=g=>i(!0)),onBlur:p[2]||(p[2]=g=>i(!1)),placeholder:A(u)("Select"),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(e.pages,(g,y)=>(r(),E(f,{key:y,label:g.label,value:Number(g.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),o("div",LF,[n(DF,{title:e.title,onOnPageCreated:p[3]||(p[3]=g=>l("onPageCreated",g,e.modelId)),content:e.modelId},null,8,["title","content"])])],2)])])}}},OF={__name:"OnboardingPagesStep",props:{pages:{type:Array,default:()=>[]},initialSettings:{type:Object,default:null},savedFormData:{type:Object,default:null},onPagesUpdated:{type:Function,default:()=>{}}},setup(e,{expose:t}){const a=e,l=["checkout_page_id","cart_page_id","receipt_page_id","shop_page_id","customer_profile_page_id"],s={checkout_page_id:()=>u("Checkout"),cart_page_id:()=>u("Cart"),receipt_page_id:()=>u("Receipt"),shop_page_id:()=>u("Shop"),customer_profile_page_id:()=>u("Customer Profile")},i=T(Object.fromEntries(l.map(v=>[v,""])));be(()=>a.initialSettings,v=>{if(a.savedFormData){l.forEach(w=>{i.value[w]=a.savedFormData[w]??""});return}v&&l.forEach(w=>{i.value[w]=v[w]??""})},{immediate:!0});const c=T(!1),p=T(!1),f=()=>{p.value=!0,Ae.post("onboarding/create-pages",{}).then(v=>{l.forEach(w=>{var k;i.value[w]=String(((k=v.default_settings)==null?void 0:k[w])??"")}),c.value=!0,a.onPagesUpdated(v.pages)}).finally(()=>{p.value=!1})},_=(v,w)=>{i.value[w]=v.value,a.onPagesUpdated([...a.pages,v])};return t({onNextStep:async()=>{try{await Ae.post("onboarding/",{...i.value})}catch{}return!0},getFormData:()=>({...i.value}),createAllPage:f,pageGenerated:c,generating:p}),(v,w)=>(r(),h(P,null,te(l,k=>o("div",{key:k,class:"fct-form-group"},[n(RF,{title:s[k](),pages:e.pages,modelId:k,modelValue:i.value[k],"onUpdate:modelValue":b=>i.value[k]=b,onOnPageCreated:_},null,8,["title","pages","modelId","modelValue","onUpdate:modelValue"])])),64))}},PF={key:0,class:"fct-dummy-product-content"},HF={key:0,class:"title"},NF={class:"fct-dummy-product-hint"},KF={class:"fct-btn-group mt-4"},GF={key:1,class:"fct-dummy-product-content"},zF={key:0,class:"title"},jF={class:"text"},qF={class:"fct-dummy-product-loading"},YF={class:"fct-loading-bars"},WF=["id"],JF={class:"fct-dummy-product-hint"},XF=["href"],ZF={key:2,class:"fct-form-group"},e$={class:"label"},t$={class:"marker"},a$={class:"label"},l$={class:"marker"},s$={__name:"OnboardingProductsStep",props:{dummyProductInfo:{type:Object,default:()=>({})}},setup(e,{expose:t}){const a=e,l=T("start-from-scratch"),s=T(!1),i=T(!1),c=T(null),p=T(0),f=T(0),_=T([]),g=T(!1),y=K(()=>g.value||_.value.length>0),v=()=>{f.value=0,p.value=0,s.value=!1,i.value=!1,c.value=null,_.value=[],g.value=!1},w=async F=>{let B=0;for(let U=0;U<F.count;U++){p.value=U;try{await Ae.post("products/create-dummy",{category:F.category,index:U}),B++,f.value=parseFloat((B/F.count*100).toFixed(0))}catch(Q){if(Q.status_code===400){g.value=!0;for(let V=U;V<F.count;V++)_.value.push(V);return}_.value.push(U)}}},k=async()=>{if(!l.value||l.value==="start-from-scratch"){v();return}const F=a.dummyProductInfo[l.value];if(!F){v();return}_.value=[],g.value=!1,s.value=!0,i.value=!0,c.value=F;try{await w(F)}finally{i.value=!1}},b=()=>{y.value||(f.value=100,setTimeout(S,1e3))},S=()=>{let F=ze.get("dashboard_url");l.value&&l.value!=="start-from-scratch"&&(F=nn.appendToVueUrl(F,{import_product:l.value})),window.location.href=F},$=async()=>{const F=!l.value||l.value==="start-from-scratch";try{await Ae.post("onboarding/")}catch{}return F?(setTimeout(S,300),!1):(await k(),b(),!1)},D=ze.get("dashboard_url");return t({onNextStep:$,inserting:s}),(F,B)=>{const U=C("el-button"),Q=C("el-progress"),V=C("el-icon"),I=C("el-radio-button"),M=C("el-radio-group");return s.value&&y.value&&!i.value?(r(),h("div",PF,[c.value!=null?(r(),h("div",HF,m(A(u)("%1$s of %2$s products could not be created",_.value.length,c.value.count)),1)):x("",!0),o("p",NF,m(g.value?A(u)("The import stopped early. Products created before it stopped were kept, and you can add the rest from the Products page."):A(u)("The products that were created have been kept. You can add the rest from the Products page.")),1),o("div",KF,[n(U,{type:"primary",onClick:S},{default:d(()=>[R(m(A(u)("Continue to Dashboard")),1)]),_:1})])])):s.value?(r(),h("div",GF,[c.value!=null?(r(),h("div",zF,m(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,c.value.count,c.value.title)),1)):x("",!0),o("div",jF,[R(m(A(u)("Please wait, your products are being added."))+" ",1),o("div",qF,[o("div",YF,[(r(),h(P,null,te(8,O=>o("div",{key:O,class:"bar-block",id:`bar-block-${O+1}`},null,8,WF)),64))]),R(" "+m(A(u)("Uploading... %1$s",`${f.value}%`)),1)])]),n(Q,{percentage:f.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"]),o("p",JF,[R(m(A(u)("Please keep this window open, we'll take you to your"))+" ",1),o("a",{href:A(D),target:"_blank",rel:"noopener"},m(A(u)("Dashboard")),9,XF),R(" "+m(A(u)("as soon as your products are ready.")),1)])])):(r(),h("div",ZF,[n(M,{class:"fct-import-onboarding-products",modelValue:l.value,"onUpdate:modelValue":B[0]||(B[0]=O=>l.value=O),size:"large"},{default:d(()=>[n(I,{value:"start-from-scratch"},{default:d(()=>[n(Y,{name:"Scratch"}),o("span",e$,[R(m(A(u)("Start"))+" ",1),B[1]||(B[1]=o("br",null,null,-1)),R(" "+m(A(u)("From scratch")),1)]),o("span",t$,[n(V,null,{default:d(()=>[n(A(Do))]),_:1})])]),_:1}),(r(!0),h(P,null,te(e.dummyProductInfo,(O,L)=>(r(),E(I,{key:L,value:L},{default:d(()=>[n(Y,{name:O.icon},null,8,["name"]),o("span",a$,m(O.title),1),o("span",l$,[n(V,null,{default:d(()=>[n(A(Do))]),_:1})])]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]))}}},n$={class:"fct-onboarding-wrap"},o$={key:0,class:"fct-onboarding-card"},i$={class:"fct-onboarding-card-body"},r$={class:"fct-onboarding-content-box"},d$={class:"fct-onboarding-card-head"},u$={class:"fct-onboarding-card-head-top"},c$=["src","alt"],A$={class:"fct-onboarding-steps-count"},p$={class:"fct-onboarding-card-head-content"},f$={class:"flex-1"},m$={class:"fct-onboarding-card-title"},h$={class:"fct-onboarding-card-text"},_$={key:0,class:"fct-onboarding-card-head-action"},v$={class:"fct-onboarding-content-box-inner"},g$={key:0,class:"fct-onboarding-load-error"},y$={key:1,class:"fct-onboarding-form-wrap active"},b$={class:"fct-onboarding-form-body"},w$={key:0,class:"fct-onboarding-bottom"},C$={class:"fct-onboarding-bottom-left"},k$={class:"fct-onboarding-bottom-right"},B$={key:0,class:"cmd"},x$={__name:"Onboarding",setup(e){const t=T(!1),a=T([]),l=T({}),s=T([]),i=T([]),c=T(null),p=T(null),f=T(null),_=T(null),g=T(null),y=T(""),v=K(()=>{if(!y.value)return"";const ue=s.value.find(ie=>ie.value===y.value);return ue?ue.name:y.value}),w=[{key:"store-info",title:()=>u("Welcome aboard! Let's create your online store."),text:()=>u("You've successfully installed the plugin, let's configure the store."),component:JS,props:()=>({savedFormData:f.value,initialSettings:c.value,countries:s.value,currencies:l.value,onStoreCountryChanged:ue=>{y.value=ue}})},{key:"tax",title:()=>u("Set Up Tax Collection"),text:()=>u("Configure tax rates so checkout calculates correctly."),component:IF,canSkip:!0,props:()=>({savedFormData:_.value,storeCountry:y.value,countryName:v.value,initialTaxSettings:p.value})},{key:"pages",title:()=>u("Setup Your Pages"),text:()=>u("Create the essential pages your store needs: cart, checkout, and more."),component:OF,props:()=>({pages:a.value,initialSettings:c.value,savedFormData:g.value,onPagesUpdated:ue=>{a.value=ue}})},{key:"products",title:()=>u("Setup Your Products"),text:()=>u("Add your first products and start building your business catalog."),component:s$,isFinal:!0,props:()=>({dummyProductInfo:i.value})}],k=w.length+1,b=T(1),S=K(()=>w[b.value-1]),$=K(()=>{var ue;return((ue=S.value)==null?void 0:ue.title())??""}),D=K(()=>{var ue;return((ue=S.value)==null?void 0:ue.text())??""}),F=T(null),B=T(!1),U=()=>{b.value++},Q=K(()=>{var ue;return!!((ue=F.value)!=null&&ue.inserting)}),V=()=>{var ie,J;const ue=(J=(ie=F.value)==null?void 0:ie.getFormData)==null?void 0:J.call(ie);ue&&(S.value.key==="store-info"?f.value=ue:S.value.key==="tax"?_.value=ue:S.value.key==="pages"&&(g.value=ue))},I=async()=>{var ue,ie;if(!B.value){B.value=!0;try{V(),await((ie=(ue=F.value)==null?void 0:ue.onNextStep)==null?void 0:ie.call(ue))!==!1&&U()}finally{B.value=!1}}},M=()=>{var ue,ie;V(),(ie=(ue=F.value)==null?void 0:ue.onPreviousStep)==null||ie.call(ue),b.value>1&&b.value--},O=()=>{U()},L=()=>{var ue,ie;(ie=(ue=F.value)==null?void 0:ue.onSkipAll)==null||ie.call(ue),window.location.href=ze.get("dashboard_url")};ws().onSave(()=>{var ue;(ue=S.value)!=null&&ue.isFinal&&I()});const j=T(!1),W=()=>{t.value=!0,j.value=!1,Ae.get("onboarding/").then(ue=>{var ie;a.value=ue.pages,l.value=ue.currencies,c.value=ue.default_settings,y.value=((ie=ue.default_settings)==null?void 0:ie.store_country)??"",p.value=ue.tax_settings??null}).catch(()=>{j.value=!0}).finally(()=>{t.value=!1})},G=()=>{Ae.get("address-info/countries").then(ue=>{s.value=ue.data})},Z=gs.getUrl("images/logo/logo-full-dark.svg"),ne=gs.getUrl("images/logo/logo-full.svg"),ce=T(ze.get("asset_url")+"/images/logo/logo-full-dark.svg"),z=()=>{ce.value=Te.isDark()?ne:Z};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",z),i.value=ze.get("dummy_product_info"),jQuery(".fca_admin_menu").hide(),jQuery("body").addClass("fct-onboarding-body"),ce.value=Te.isDark()?ne:Z,W(),G()}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",z),jQuery(".fca_admin_menu").show(),jQuery("body").removeClass("fct-onboarding-body")}),(ue,ie)=>{const J=C("el-progress"),N=C("el-button"),ae=Va("loading");return r(),h(P,null,[o("div",n$,[b.value<k?(r(),h("div",o$,[Wt((r(),h("div",i$,[o("div",r$,[o("div",d$,[o("div",u$,[o("img",{src:ce.value,alt:A(u)("Fluent Cart")},null,8,c$),o("div",A$,m(A(u)("Step %1$s of %2$s",b.value,w.length)),1),n(J,{percentage:b.value/w.length*100,"stroke-width":8,"show-text":!1,class:"fct-onboarding-progress"},null,8,["percentage"])]),o("div",p$,[o("div",f$,[o("h2",m$,m($.value),1),o("p",h$,m(D.value),1)]),S.value.key==="pages"&&F.value&&!F.value.pageGenerated?(r(),h("div",_$,[n(N,{onClick:ie[0]||(ie[0]=oe=>F.value.createAllPage()),loading:F.value.generating,size:"small"},{default:d(()=>[F.value.generating?x("",!0):(r(),E(Y,{key:0,name:"MagicPen"})),R(" "+m(A(u)("Generate All Pages")),1)]),_:1},8,["loading"])])):x("",!0)])]),o("div",v$,[j.value?(r(),h("div",g$,[o("p",null,m(A(u)("Failed to load settings. Please refresh and try again.")),1),n(N,{onClick:W},{default:d(()=>[R(m(A(u)("Retry")),1)]),_:1})])):(r(),h("div",y$,[o("div",b$,[(r(),E(gl(S.value.component),va({key:S.value.key,ref_key:"stepRef",ref:F},S.value.props()),null,16))])]))])])])),[[ae,t.value]])])):x("",!0)]),b.value<k&&!Q.value?(r(),h("div",w$,[o("div",C$,[b.value>1?(r(),E(N,{key:0,text:"",onClick:L},{default:d(()=>[R(m(A(u)("Skip All")),1)]),_:1})):x("",!0)]),o("div",k$,[n(N,{onClick:M,type:"info",plain:"",disabled:b.value===1},{default:d(()=>[R(m(A(u)("Go Back")),1)]),_:1},8,["disabled"]),S.value.canSkip?(r(),E(N,{key:0,text:"",onClick:O,disabled:B.value},{default:d(()=>[R(m(A(u)("Skip for now")),1)]),_:1},8,["disabled"])):x("",!0),S.value.isFinal?(r(),E(N,{key:2,type:"primary",loading:B.value,onClick:I},{default:d(()=>[B.value?x("",!0):(r(),h("span",B$,"⌘s")),R(" "+m(B.value?A(u)("Saving"):A(u)("Save")),1)]),_:1},8,["loading"])):(r(),E(N,{key:1,type:"primary",loading:B.value,disabled:j.value,onClick:I},{default:d(()=>[R(m(A(u)("Continue")),1)]),_:1},8,["loading","disabled"]))])])):x("",!0)],64)}}},S$={class:"fct-orders-route-wrap"},F$=Object.assign({name:"OrdersRoute"},{__name:"OrdersRoute",setup(e){return(t,a)=>{const l=C("router-view");return r(),h("div",S$,[n(l)])}}}),$$={class:"setting-wrap"},E$={class:"setting-wrap-inner"},U$={key:0,class:"payment-method-list fct-content-card-list"},I$={class:"flex items-start gap-3"},Q$=["title"],D$=["onClick"],V$=["src","alt"],T$=["src","alt"],M$={key:1,class:"fct_payment_method_tag"},L$={class:"fct-content-card-list-content"},R$={class:"fct-content-card-list-action"},O$={key:0},P$=["src"],H$={__name:"PaymentSettings",setup(e){const t=Jt().ctx,a=T(!1),l=T([]),s=ze.get("app_config.isProActive"),i=K(()=>({animation:200,ghostClass:"ghost"})),c=g=>!((g==null?void 0:g.upcoming)==!0||g!=null&&g.requires_pro&&!s||(g==null?void 0:g.is_addon)==!0&&!(g!=null&&g.status)&&(g!=null&&g.addon_status)&&!g.addon_status.is_installed),p=g=>g===!0?"active":"inactive",f=()=>{a.value=!0,t.$get("settings/payment-methods/all",{}).then(g=>{l.value=g.gateways}).catch(g=>{}).finally(()=>{a.value=!1})},_=()=>{const g=l.value.map(y=>y.route);t.$post("settings/payment-methods/reorder",{order:g}).then(y=>{q.success(y.message)}).catch(y=>{})};return Ie(()=>{f()}),(g,y)=>{const v=C("el-skeleton"),w=C("el-button");return r(),h("div",$$,[n(Ua,{heading:A(u)("Payment Settings"),"show-save-button":!1},null,8,["heading"]),o("div",E$,[n(Ia),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(v,{loading:a.value,animated:"",rows:6},null,8,["loading"]),a.value?x("",!0):(r(),h("div",U$,[n(A(sn),va(i.value,{list:l.value,"item-key":"route",handle:".drag-handle",onEnd:_}),{default:d(()=>[(r(!0),h(P,null,te(l.value,k=>(r(),h("div",{key:k.route,class:de(k!=null&&k.upcoming?"upcoming fct-content-card-list-item":"fct-content-card-list-item")},[o("div",I$,[o("span",{class:"drag-handle cursor-move text-gray-400 hover:text-gray-600 mt-1 w-7.5 h-7.5",title:A(u)("Drag to reorder")},y[0]||(y[0]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 6h8v2H8V6zm0 4h8v2H8v-2zm0 4h8v2H8v-2z"})],-1)]),8,Q$),o("div",{onClick:()=>{var b;!((b=k==null?void 0:k.addon_status)!=null&&b.is_installed)&&(k!=null&&k.addon_source)||g.$router.push({name:k.route})},class:"cursor-pointer grid gap-2 flex-1"},[o("div",{class:de(["fct-content-card-list-head",k.route])},[o("img",{src:k.logo,alt:k.admin_title||k.title,class:de(k.logo_light?"dark:hidden":"")},null,10,V$),k.logo_light?(r(),h("img",{key:0,src:k.logo_light,alt:k.admin_title||k.title,class:"hidden dark:block"},null,8,T$)):x("",!0),k!=null&&k.tag?(r(),h("span",M$,[n(fa,{size:"small",status:"info",text:k.tag},null,8,["text"])])):x("",!0),c(k)?(r(),E(fa,{key:2,size:"small",status:k.status?"active":"disabled","hide-icon":!0},{default:d(()=>[R(m(p(k.status)),1)]),_:2},1032,["status"])):x("",!0)],2),o("div",L$,[o("p",null,m(k.description),1)])],8,D$),o("div",R$,[k!=null&&k.upcoming?(r(),h("div",O$,m(A(u)("Coming Soon!")),1)):(r(),E(w,{key:1,class:"el-button--x-small",onClick:()=>g.$router.push({name:k.route})},{default:d(()=>{var b;return[R(m(A(u)("Manage"))+" ",1),k!=null&&k.requires_pro?(r(),h("img",{key:0,src:((b=g.appVars)==null?void 0:b.asset_url)+"images/crown.svg",alt:"pro feature",class:"pro-feature-icon"},null,8,P$)):x("",!0)]}),_:2},1032,["onClick"]))])])],2))),128))]),_:1},16,["list"])]))]),_:1})]),_:1})])])}}},N$={class:"role-form"},K$={class:"select-use-option"},G$={class:"select-label"},z$={key:0,class:"select-desc"},j$={class:"dialog-footer"},q$={__name:"RoleAssignmentModal",props:{},emits:["fetchRoles"],setup(e,{expose:t,emit:a}){const l=T(!1),s=a,i=T(!1),c=T(null),p=T(null),f=T(!1),_=T(null),g=T(null),y=T({}),v=T(!1),w=B=>{if(!B){_.value=[];return}Ae.get("roles/user-list",{search:B}).then(U=>{_.value=U.users.data}).finally(()=>{})},k=()=>{Ae.get("roles").then(B=>{g.value=B.roles}).catch(B=>{if(B.message){q.error(B.message);return}}).finally(()=>{})},b=()=>{y.value={},i.value=!0,Ae.post("roles",{user_id:c.value,role_key:p.value}).then((B,U)=>{l.value=!1,q.success(B.message),s("fetchRoles")}).catch(B=>{var U;(U=B.data)!=null&&U.message?q.error(B.data.message):y.value=B.data}).finally(()=>{i.value=!1})},S=()=>{c.value=null,p.value=null,f.value=!1,y.value={},l.value=!1},$=T(""),D=K(()=>f.value?u("Edit %1$s's Role",$.value):u("Add Role"));return t({openModal:(B,U,Q,V=!1)=>{c.value=B,p.value=U,$.value=Q,l.value=!0,f.value=V,k()}}),(B,U)=>{const Q=C("el-option"),V=C("el-select"),I=C("el-form-item"),M=C("el-form"),O=C("el-button"),L=C("el-dialog");return r(),E(L,{title:D.value,modelValue:l.value,"onUpdate:modelValue":U[4]||(U[4]=H=>l.value=H),onClosed:S,"append-to-body":!0},{footer:d(()=>[o("span",j$,[n(O,{onClick:S},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(O,{type:"primary",onClick:b,loading:i.value,disabled:i.value},{default:d(()=>[R(m(f.value?A(u)("Update Role"):A(u)("Attach Role")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[o("div",N$,[n(M,{"label-position":"top"},{default:d(()=>[f.value?x("",!0):(r(),E(I,{key:0,label:A(u)("Select User")},{default:d(()=>[n(V,{modelValue:c.value,"onUpdate:modelValue":U[0]||(U[0]=H=>c.value=H),remote:!0,"remote-method":w,loading:v.value,filterable:"",clearable:"",placeholder:A(u)("Type to search user"),class:"w-full",onChange:U[1]||(U[1]=()=>{delete y.value.user_id})},{default:d(()=>[(r(!0),h(P,null,te(_.value,H=>(r(),E(Q,{key:H.ID,label:H.name,value:H.ID},{default:d(()=>[o("div",K$,[o("span",null,m(H.name),1),o("span",null,m(H.email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),y.value.hasOwnProperty("user_id")?(r(),E(Aa,{key:0,"validation-errors":y.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])),n(I,{label:A(u)("Select Role")},{default:d(()=>[n(V,{onChange:U[2]||(U[2]=H=>{delete y.value.role_key}),id:"role_key",modelValue:p.value,"onUpdate:modelValue":U[3]||(U[3]=H=>p.value=H),placeholder:A(u)("Select a role"),class:"w-full","popper-class":"fct-select-role-dropdown"},{default:d(()=>[(r(!0),h(P,null,te(g.value,(H,j)=>(r(),E(Q,{key:j,label:H.title,value:j},{default:d(()=>[o("div",G$,m(H.title),1),H.description?(r(),h("div",z$,m(H.description),1)):x("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),y.value.hasOwnProperty("role_key")?(r(),E(Aa,{key:0,"validation-errors":y.value,"field-key":"role_key"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"])}}},Y$=nt(q$,[["__scopeId","data-v-b3e8599d"]]),W$={class:"setting-wrap"},J$={class:"setting-wrap-inner"},X$={key:0,class:"fct-setting-header-action"},Z$={class:"fct-role-settings"},eE={class:"fct-customer-card"},tE={class:"fct-customer-details"},aE={class:"fct-customer-name"},lE={class:"fct-customer-id"},sE={class:"fct-customer-email"},nE={class:"role-title flex items-center gap-1 capitalize"},oE={class:"role-desc flex items-center gap-1 capitalize text-system-mid dark:text-system-light text-xs"},iE={class:"fct-role-settings-table-action fct-btn-group sm justify-end"},rE={__name:"RoleSettings",setup(e){const t=T(!1),a=T([]),l=T(),s=T(!1),i=ze.get("app_config.isProActive"),c=()=>{t.value=!0,Ae.get("roles/managers").then(f=>{a.value=f.managers}).finally(()=>{t.value=!1})},p=f=>{s.value=!0,Ae.delete("roles/"+f.shop_role,{user_id:f.id}).then(_=>{a.value=a.value.filter(g=>g.id!==f.id),q.success(_.message)}).catch(_=>{if(_.message)return q.error(_.message)}).finally(()=>{s.value=!1})};return Ie(()=>{i&&c()}),(f,_)=>{const g=C("el-button"),y=C("el-table-column"),v=C("el-popconfirm"),w=C("el-table"),k=Va("loading");return r(),h("div",W$,[n(Ua,{heading:A(u)("Roles & Permissions"),"show-save-button":!1},null,8,["heading"]),o("div",J$,[n(Ia),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Existing Roles & Permissions")},{action:d(()=>[A(i)?(r(),h("div",X$,[n(g,{type:"primary",size:"small",onClick:_[0]||(_[0]=()=>{var b;(b=l.value)==null||b.openModal()})},{default:d(()=>[R(m(A(u)("Add Role")),1)]),_:1})])):x("",!0)]),_:1},8,["title"]),A(i)?(r(),E(ke,{key:0,class:"px-0 pb-0"},{default:d(()=>[o("div",Z$,[Wt((r(),E(w,{data:a.value},{empty:d(()=>[n(Ct,{icon:"Empty/RoleAndPermission","has-dark":!0,text:A(u)("No roles found!")},null,8,["text"])]),default:d(()=>[n(y,{label:A(u)("User"),width:150},{default:d(b=>{var S,$,D;return[o("div",eE,[o("div",tE,[o("div",aE,[R(m(((S=b.row)==null?void 0:S.display_name)||A(u)("No Name"))+" ",1),o("span",lE,"#"+m(($=b.row)==null?void 0:$.id),1)]),o("div",sE,m((D=b.row)==null?void 0:D.email),1)])])]}),_:1},8,["label"]),n(y,{prop:"shop_role",label:A(u)("Role Title"),width:100},{default:d(b=>[o("span",nE,m(A(da).headline(b.row.shop_role)),1)]),_:1},8,["label"]),n(y,{prop:"description",label:A(u)("Roles"),width:100},{default:d(b=>[o("span",oE,m(b.row.description),1)]),_:1},8,["label"]),n(y,{width:100},{default:d(b=>[o("div",iE,[n(at,{tag:"a",size:"x-small",hover:"primary",onClick:()=>{var S;(S=l.value)==null||S.openModal(b.row.id,b.row.shop_role,b.row.display_name,!0)}},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(v,{width:235,"confirm-button-text":A(u)("Confirm"),"cancel-button-text":A(u)("No, Thanks"),"icon-color":"red",title:A(u)("Are you sure to delete this user?"),onConfirm:S=>p(b.row)},{reference:d(()=>[n(at,{tag:"a",size:"x-small",hover:"danger"},{default:d(()=>[n(Y,{name:"Delete"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])),[[k,t.value||s.value]])])]),_:1})):(r(),E(ke,{key:1,class:"px-0 pb-0"},{default:d(()=>[n(dn,{class:"py-7.5",placement:"feature_lock_roles_permissions",title:A(u)("Upgrade to Pro for Roles & Permission"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]),_:1}))]),_:1}),n(Y$,{ref_key:"roleModal",ref:l,onFetchRoles:c},null,512)])])}}},dE={class:"fct-settings-nav-wrap"},uE={class:"fct-settings-nav-collapse-button-wrapper"},cE={class:"fct-menu-collapse-button-text"},AE=["src","alt"],pE=["src","alt"],fE={class:"fct-settings-nav-link-text"},mE={class:"fct-settings-nav-child-list"},hE={class:"fct-settings-nav-content"},_E={class:"fct-settings-nav-content-inner"},vE=Object.assign({name:"SettingsView"},{__name:"SettingsView",setup(e){const t=nl(),a=sl(),l=T(window.innerWidth>=1024),s=T(!1),i=T(!1),c=T(null),p=T(null),f=T(null);Vn.has("store/settings");const _=T([{name:u("Store Settings"),icon:"Gift",permission:["store/settings","store/sensitive"],url:"/settings/store-settings/",child:[{name:u("Store Setup"),url:"/settings/store-settings/"},{name:u("Pages Setup"),url:"/settings/store-settings/pages_setup"},{name:u("Product Page"),url:"/settings/store-settings/single_product_setup"},{name:u("Cart & Checkout"),url:"/settings/store-settings/cart_and_checkout"},{name:u("Checkout Fields"),url:"/settings/store-settings/checkout_fields"},{name:u("Subscriptions"),url:"/settings/store-settings/subscriptions_setup"},{name:u("Appearance"),url:"/settings/store-settings/appearance"}]},{name:u("Payment Settings"),icon:"PaymentIcon",permission:["is_super_admin"],url:"/settings/payments"},{name:u("Invoice & Packing"),icon:"Invoice",permission:["is_super_admin"],url:"/settings/invoice-packing",child:[{name:u("Invoice & Packing"),url:"/settings/invoice-packing"},{name:u("PDF Templates"),url:"/settings/pdf-template"},{name:u("E-Invoice Settings"),url:"/settings/pdf-template/settings"}]},{name:u("Tax Settings"),icon:"Tax",permission:["is_super_admin"],url:"/settings/tax_settings",child:[{name:u("Configuration"),url:"/settings/tax_settings"},{name:u("Rates"),url:"/settings/tax_settings/tax_rates",activeFor:["/settings/tax_settings/eu","/settings/tax_settings/tax_rates_country_single"]}]},{name:u("Email Configuration"),icon:"Message",permission:["store/sensitive"],url:"/settings/email_mailing_settings",child:[{name:u("Mailing Settings"),url:"/settings/email_mailing_settings"},{name:u("Reminders"),url:"/settings/email_mailing_settings/reminders"},{name:u("Notifications"),url:"/settings/email_notifications"},{name:u("Store Digest"),url:"/settings/email_digest_settings"}]},{name:u("Roles and Permissions"),icon:"ShieldCheck",permission:["is_super_admin"],url:"/settings/roles"},{name:u("Storage Settings"),icon:"Database",permission:["is_super_admin"],url:"/settings/storage"}]);a.hasRoute("shipping")&&_.value.push({name:u("Shipping"),icon:"Truck",permission:["store/sensitive"],url:"/settings/shipping",child:[{name:u("Shipping Zones"),permission:["store/sensitive"],url:"/settings/shipping"},{name:u("Shipping Classes"),permission:["store/sensitive"],url:"/settings/shipping/shipping_classes"},{name:u("Packages"),permission:["store/sensitive"],url:"/settings/shipping/packages"}]}),_.value.push({name:u("Features & addon"),icon:"Module",permission:["is_super_admin"],url:"/settings/addons"}),ze.get("app_config.isProActive")&&_.value.push({name:u("License Settings"),icon:"License",permission:"store/sensitive",url:"/settings/licensing"}),ze.get("addon_settings_sidebar",[]).forEach(F=>_.value.push(F)),_.value.push({name:u("Compliance"),icon:"ShieldCheck",permission:["store/settings"],url:"/settings/compliance"});const y=()=>{if(!l.value){c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open");return}s.value=!s.value,i.value=!1},v=()=>{l.value||(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open"))},w=F=>F.child?(!b.value||S.value)&&$(F):!1,k=()=>{const F=window.innerWidth,B=l.value;l.value=F>=1024,!B&&l.value&&(c.value&&c.value.classList.remove("is-nav-open"),p.value&&p.value.classList.remove("is-overlay-open")),B&&!l.value&&(s.value=!1)};Ie(()=>{f.value=document.getElementById("fluent_cart_plugin_app"),f.value&&f.value.classList.add("fct_settings_page_plugin_app_wrap"),k(),window.addEventListener("resize",k)}),Bt(()=>{f.value&&f.value.classList.remove("fct_settings_page_plugin_app_wrap"),window.removeEventListener("resize",k)});const b=K(()=>s.value),S=K(()=>l.value&&s.value&&i.value),$=F=>{const B=t.path;return!!(F.child&&F.child.length&&F.child.some(Q=>B===Q.url||B.includes(Q.url))||B===F.url||B.includes(F.url))},D=(F,B,U)=>{const Q=t.path;return!!(Q===F.url||F.activeFor&&F.activeFor.some(V=>Q.startsWith(V))||Q===U.url&&B===0)};return(F,B)=>{const U=C("el-button"),Q=C("el-tooltip"),V=C("router-link"),I=C("router-view");return r(),h("div",{class:de(["fct-setting-container setting-container",{"is-collapsed":b.value,"is-expanded":S.value}])},[o("div",{ref_key:"overlayRef",ref:p,class:"fct-settings-menu-overlay",onClick:v},null,512),o("div",dE,[o("div",{ref_key:"sidebarRef",ref:c,class:de(["fct-settings-nav-container",{"is-collapsed":b.value,"is-expanded":S.value}])},[o("div",uE,[n(Q,{content:A(u)("Toggle settings"),placement:"right"},{default:d(()=>[n(U,{onClick:y,"aria-label":A(u)("Toggle settings navigation"),"aria-expanded":!b.value},{default:d(()=>[n(Y,{name:"Window"}),o("span",cE,m(A(u)("Settings")),1)]),_:1},8,["aria-label","aria-expanded"])]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:B[0]||(B[0]=M=>l.value&&s.value&&(i.value=!0)),onMouseleave:B[1]||(B[1]=M=>i.value=!1)},[(r(!0),h(P,null,te(_.value,(M,O)=>(r(),h("li",{key:O,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":$(M)}])},[A(Vn).hasAny(M.permission)?(r(),E(V,{key:0,to:M.url,class:"fct-settings-nav-link"},{default:d(()=>[M.icon_img?(r(),h(P,{key:0},[o("img",{src:M.icon_img,alt:M.name,class:de(M.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,AE),M.icon_img_dark?(r(),h("img",{key:0,src:M.icon_img_dark,alt:M.name,class:"w-5 h-5 hidden dark:block"},null,8,pE)):x("",!0)],64)):(r(),E(Y,{key:1,name:M.icon},null,8,["name"])),o("span",fE,[R(m(M.name)+" ",1),n(Y,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])]),_:2},1032,["to"])):x("",!0),n(ya,{visible:w(M),accordion:"",class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",mE,[(r(!0),h(P,null,te(M.child,(L,H)=>(r(),h("li",{key:H,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":D(L,H,M)}])},[n(V,{to:L.url,class:"fct-settings-nav-link"},{default:d(()=>[R(m(L.name),1)]),_:2},1032,["to"])],2))),128))])]),_:2},1032,["visible"])],2))),128))],32)],2),o("div",hE,[o("div",_E,[n(I)])])])],2)}}}),gE={class:"min-h-[72px] px-2 pl-6 flex flex-col justify-center"},yE={__name:"CustomerOrdersLoader",props:{columns:{type:Array,default:()=>[]}},setup(e){const t=e,a=l=>t.columns.includes(l);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("el-table");return r(),E(f,{class:"w-full compact-table responsive",data:[1,2,3,4,5,6,7,8,9,10]},{default:d(()=>[a("selection")?(r(),E(i,{key:0,type:"selection",width:"45"})):x("",!0),n(i,{width:140,label:A(u)("# Date")},{default:d(()=>[o("div",gE,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1}),n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})])]),_:1},8,["label"]),a("order_items")?(r(),E(i,{key:1,"min-width":200,label:A(u)("Items")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"])):x("",!0),n(i,{width:150,label:A(u)("Total")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:150,label:A(u)("Payment Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),a("status")?(r(),E(i,{key:2,width:120,label:A(u)("Status")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0),a("type")?(r(),E(i,{key:3,width:140,label:A(u)("Order Type")},{default:d(()=>[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])):x("",!0)]),_:1})}}},bE={class:"select-use-option"},wE={class:"dialog-footer"},Kp={__name:"UserAttchModal",props:{customer:{}},setup(e){const t=e,a=T(!1),l=T([]),s=T(null),i=T({}),c=T(!1),p=()=>{i.value={},c.value=!0,Ae.post(`customers/${t.customer.id}/attachable-user`,{user_id:s.value}).then((g,y)=>{a.value=!1,q.success(g.message),t.customer.user_id=s.value}).catch(g=>{if(g.message)return q.error(g.message);i.value=g}).finally(()=>{c.value=!1})},f=()=>{s.value=null,i.value={},a.value=!1},_=()=>{Ae.get("customers/attachable-user").then(g=>{l.value=dt.get(g,"users")})};return Ie(()=>{_()}),(g,y)=>{C("el-link");const v=C("el-option"),w=C("el-select"),k=C("el-form-item"),b=C("el-form"),S=C("el-button"),$=C("el-dialog");return r(),h(P,null,[x("",!0),n($,{modelValue:a.value,"onUpdate:modelValue":y[2]||(y[2]=D=>a.value=D),title:A(u)("Attach User"),onClosed:f},{footer:d(()=>[o("span",wE,[n(S,{onClick:f},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:p,loading:c.value,disabled:c.value},{default:d(()=>[R(m(A(u)("Attach User")),1)]),_:1},8,["loading","disabled"])])]),default:d(()=>[n(b,{"label-position":"top"},{default:d(()=>[n(k,{label:g.$t("Select User")},{default:d(()=>[n(w,{id:"user_id",modelValue:s.value,"onUpdate:modelValue":y[1]||(y[1]=D=>s.value=D),filterable:"",placeholder:g.$t("Select a user"),class:"w-full"},{default:d(()=>[(r(!0),h(P,null,te(l.value,D=>(r(),E(v,{key:D.ID,label:D.display_name,value:D.ID},{default:d(()=>[o("div",bE,[o("span",null,m(D.display_name),1),o("span",null,m(D.user_email),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),i.value.hasOwnProperty("user_id")?(r(),E(Aa,{key:0,"validation-errors":i.value,"field-key":"user_id"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},CE={class:"more-btn"},kE={class:"fct-admin-sidebar-item"},BE={class:"fct-profile-card"},xE={class:"fct-profile-image"},SE=["src","alt"],FE={class:"fct-profile-details"},$E={class:"title"},EE={class:"text"},UE={key:0},IE={class:"text"},QE={key:0,class:"flex items-center gap-2 mt-1.5"},DE={class:"user-info"},VE=["href"],TE={key:1},ME={class:"fct-admin-sidebar-item mt-5"},LE={class:"sidebar-title"},RE={class:"fct-contact-info-list"},OE={class:"flex items-center justify-between gap-2"},PE=["href"],HE={class:"fct-admin-sidebar-item mt-5"},NE={class:"sidebar-title"},KE={key:0,class:"fct-address-copy-wrap"},GE={class:"text"},zE={key:0,class:"pr-1"},jE=["innerHTML"],qE={key:1,class:"mt-3"},YE={class:"pr-1"},WE=["href"],JE={key:0,class:"no-address-text"},XE={class:"fct-admin-sidebar-item mt-5"},ZE={class:"sidebar-title"},eU={key:0,class:"fct-address-copy-wrap"},tU={class:"text"},aU={key:0,class:"pr-1"},lU=["innerHTML"],sU={key:1,class:"mt-3"},nU={class:"pr-1"},oU=["href"],iU={key:0,class:"no-address-text"},rU={class:"fct-customer-address-wrap"},dU={name:"CustomerInformations",components:{CustomerPurchaseValue:hm,NewCustomerModal:nd,ManageAddressModal:lA,AddOrEditAddressModal:aA,DynamicIcon:Y,CopyToClipboard:Ea,UserAttchModal:Kp,Back:ld},props:["customer","customer_id"],data(){return this.localizedData=window.fluentCartAdminApp,{addOrEditAddress:!1,shippingAddress:[],billingAddress:[],showAddressModal:!1,modalAction:{type:"billing",action:"create"},address:{},address_mock:{label:"",name:"",phone:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",is_primary:"0"},customerModalInfos:{showModal:!1,action:"edit",title:"Edit Customer Information",customer:{}},detaching:!1,recalculatingLtv:!1,shouldShowSetAsAlsoCheckbox:!0,closingModal:!1}},computed:{customerDisplayName(){var e,t,a;return this.localizedData.is_full_name_required?(e=this.customer)==null?void 0:e.full_name:((t=this.customer)==null?void 0:t.first_name)+" "+((a=this.customer)==null?void 0:a.last_name)},hasPrimaryBilling(){return this.billingAddress.findIndex(e=>e.is_primary=="1")},hasPrimaryShipping(){return this.shippingAddress.findIndex(e=>e.is_primary=="1")}},mounted(){this.billingAddress=this.customer.billing_address,this.shippingAddress=this.customer.shipping_address,this.customerModalInfos.customer=this.customer,this.customerModalInfos.customer_id=this.customer.id},methods:{handleCustomerBulkCommand(e){e==="edit_customer_information"&&(this.customerModalInfos.showModal=!0),e==="manage_billing_address"&&this.manageAddress("billing"),e==="manage_shipping_address"&&this.manageAddress("shipping"),e==="recalculate_ltv"&&this.recalculateLtv()},getCustomerTotalOrders(e){return e>0?e+" "+(e.toString()==="1"?this.$t("order"):this.$t("orders")):this.$t("No orders")},refresh(){this.addOrEditAddress=!1,this.fetch()},getTitle(){return this.modalAction.action==="create"?this.modalAction.type==="billing"?this.$t("Add new billing address"):this.$t("Add new shipping Address"):this.modalAction.type==="billing"?this.$t("Edit billing address"):this.$t("Edit shipping address")},addNewAddress(e="billing",t="create",a=[]){Object.keys(a).length>0?(this.address=JSON.parse(JSON.stringify(a)),this.shouldShowSetAsAlsoCheckbox=!1):this.address=JSON.parse(JSON.stringify(this.address_mock)),this.addOrEditAddress=!0,this.modalAction.type=e,this.modalAction.action=t,this.showAddressModal=!1},manageAddress(e="billing",t="edit"){this.showAddressModal=!0,this.modalAction.type=e,this.modalAction.action=t},fetch(){this.$emit("fetch")},recalculateLtv(){this.recalculatingLtv=!0,this.$post(`customers/${this.customer_id}/recalculate-ltv`).then(e=>{e.customer&&(this.customer.ltv=e.customer.ltv,this.customer.purchase_count=e.customer.purchase_count,this.customer.aov=e.customer.aov,this.customer.first_purchase_date=e.customer.first_purchase_date,this.customer.last_purchase_date=e.customer.last_purchase_date),this.handleSuccess(e.message)}).catch(e=>{this.handleError(e.message||this.$t("Failed to recalculate lifetime value"))}).finally(()=>{this.recalculatingLtv=!1})},handleDetachUser(){this.detaching=!0,Rest.post(`customers/${this.customer_id}/detach-user`,{user_id:this.customer.user_id}).then((e,t)=>{this.customer.user_id=0,Notify.success(e.message)}).catch(e=>{if(e.message)return Notify.error(e.message)}).finally(()=>{this.detaching=!1})}}},Gp=Object.assign(dU,{setup(e){return(t,a)=>{const l=C("el-dropdown-item"),s=C("el-dropdown-menu"),i=C("el-dropdown"),c=C("el-button"),p=C("el-popconfirm"),f=C("el-tag"),_=C("el-icon"),g=C("el-dialog"),y=Va("loading");return r(),h("div",null,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Information"),title_size:"small",border_bottom:""},{action:d(()=>[n(i,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleCustomerBulkCommand},{dropdown:d(()=>[n(s,null,{default:d(()=>[n(l,{command:"edit_customer_information"},{default:d(()=>[R(m(t.$t("Edit customer information")),1)]),_:1}),n(l,{command:"manage_shipping_address"},{default:d(()=>[R(m(t.$t("Manage shipping address")),1)]),_:1}),n(l,{command:"manage_billing_address"},{default:d(()=>[R(m(t.$t("Manage billing address")),1)]),_:1}),n(l,{command:"recalculate_ltv",disabled:t.recalculatingLtv},{default:d(()=>[R(m(t.$t("Recalculate lifetime value")),1)]),_:1},8,["disabled"])]),_:1})]),default:d(()=>[o("span",CE,[n(Y,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),n(ke,null,{default:d(()=>{var v,w,k,b;return[o("div",kE,[o("div",BE,[o("div",xE,[o("img",{src:(v=e.customer)==null?void 0:v.photo,alt:t.customerDisplayName},null,8,SE)]),o("div",FE,[o("div",$E,m(t.customerDisplayName),1),o("span",EE,[e.customer.purchase_count>0?(r(),h("span",UE,m(A(sa)(e.customer.purchase_count)),1)):x("",!0),R(" "+m(t.$n("Order","Orders",e.customer.purchase_count??0,"No Order")),1)]),o("span",IE,m(A(Kt)((w=e.customer)==null?void 0:w.ltv,!0))+" "+m(A(u)("Lifetime Value")),1)])])]),o("div",null,[e.customer.user_id&&e.customer.user_id>0?(r(),h("div",QE,[o("div",DE,[a[6]||(a[6]=R(" WP User: ",-1)),o("a",{href:e.customer.user_link,target:"_blank",class:"inline-flex items-center gap-1 dark:text-gray-100 text-primary-500 focus:shadow-none hover:!underline"},[R(" #"+m(A(sa)(e.customer.user_id))+" ",1),n(Y,{name:"Redirect",class:"w-2.5 h-2.5 text-primary-500 dark:text-gray-200"})],8,VE)]),x("",!0)])):(r(),h("div",TE,[n(Kp,{customer:e.customer},null,8,["customer"])]))]),o("div",ME,[o("h4",LE,m(t.$t("Contact Information")),1),o("ul",RE,[o("li",null,[o("div",OE,[o("a",{class:"text",href:"mailto:"+((k=e.customer)==null?void 0:k.email)},m((b=e.customer)==null?void 0:b.email),9,PE),n(Ea,{text:e.customer.email,showMode:"basic_copy_btn",tooltipText:"Copy email"},null,8,["text"])])])])]),o("div",HE,[o("h4",NE,[R(m(t.$t("Shipping Address"))+" ",1),t.hasPrimaryShipping!=-1?(r(),E(f,{key:0,type:"info",round:""},{default:d(()=>[R(m(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(P,null,te(t.shippingAddress,(S,$)=>(r(),h(P,null,[S.is_primary==="1"?(r(),h("div",KE,[o("span",GE,[S.name?(r(),h("strong",zE,m(S.name),1)):x("",!0),o("span",{innerHTML:t.getOrderAddress(S,"shipping",!0)},null,8,jE),S.phone?(r(),h("span",qE,[o("strong",YE,m(A(u)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},m(S.phone),9,WE)])):x("",!0)]),n(Ea,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:"Copy address"},null,8,["text"])])):x("",!0)],64))),256)),t.hasPrimaryShipping==-1?(r(),h("p",JE,m(t.$t("No default address found.")),1)):x("",!0)]),o("div",XE,[o("h4",ZE,[R(m(t.$t("Billing Address"))+" ",1),t.hasPrimaryBilling!=-1?(r(),E(f,{key:0,type:"info",round:""},{default:d(()=>[R(m(t.$t("Default")),1)]),_:1})):x("",!0)]),(r(!0),h(P,null,te(t.billingAddress,(S,$)=>(r(),h(P,null,[S.is_primary==="1"?(r(),h("div",eU,[o("span",tU,[S.name?(r(),h("strong",aU,m(S.name),1)):x("",!0),o("span",{innerHTML:t.getOrderAddress(S,"billing",!0)},null,8,lU),S.phone?(r(),h("span",sU,[o("strong",nU,m(A(u)("Phone"))+":",1),o("a",{href:"tel:"+S.phone,class:"text-system-mid dark:text-gray-50 hover:underline"},m(S.phone),9,oU)])):x("",!0)]),n(Ea,{text:t.getOrderAddress(S),showMode:"basic_copy_btn",tooltipText:t.$t("Copy address")},null,8,["text","tooltipText"])])):x("",!0)],64))),256)),t.hasPrimaryBilling===-1?(r(),h("p",iU,m(t.$t("No default address found.")),1)):x("",!0)])]}),_:1})]),_:1}),t.customerModalInfos.showModal?(r(),E(nd,{key:0,"onUpdate:customerModal":t.fetch,customerModalInfos:t.customerModalInfos,customer_id:t.customerModalInfos.customer_id,customer:t.customerModalInfos.customer,onCloseModal:a[0]||(a[0]=v=>t.customerModalInfos.showModal=!1)},null,8,["onUpdate:customerModal","customerModalInfos","customer_id","customer"])):x("",!0),n(lA,{modalAction:t.modalAction,onRefreshAddress:t.refresh,"onUpdate:showAddressModal":a[1]||(a[1]=v=>t.showAddressModal=v),showAddressModal:t.showAddressModal,customer_id:e.customer_id,showBusinessDetailsSection:!0,onAddNewAddress:t.addNewAddress},null,8,["modalAction","onRefreshAddress","showAddressModal","customer_id","onAddNewAddress"]),n(g,{"show-close":!0,modelValue:t.addOrEditAddress,"onUpdate:modelValue":a[4]||(a[4]=v=>t.addOrEditAddress=v),"append-to-body":!0,title:t.getTitle(),onClose:a[5]||(a[5]=()=>{t.closingModal=!0})},{default:d(()=>[o("div",rU,[n(c,{text:"",onClick:a[2]||(a[2]=()=>{t.showAddressModal=!0,t.addOrEditAddress=!1})},{default:d(()=>[n(_,null,{default:d(()=>[n(A(ld))]),_:1}),R(" "+m(t.$t("Manage address")),1)]),_:1}),n(aA,{"onUpdate:refreshAddress":t.refresh,customer_id:e.customer_id,modalAction:t.modalAction,address:t.address,showAddressModal:t.addOrEditAddress,showSetAsAlsoCheckbox:t.shouldShowSetAsAlsoCheckbox,showBusinessDetailsSection:!0,onCloseModal:a[3]||(a[3]=v=>t.addOrEditAddress=!1),closing_modal:t.closingModal},null,8,["onUpdate:refreshAddress","customer_id","modalAction","address","showAddressModal","showSetAsAlsoCheckbox","closing_modal"])])]),_:1},8,["modelValue","title"])])}}}),uU={class:"fct-single-customer-loader-wrap fct-layout-width"},cU={class:"single-page-header fct-page-loader-header flex items-start justify-between"},AU={class:"single-page-body"},pU={class:"fct-single-order"},fU={class:"fct-single-order-main"},mU={class:"fct-single-order-aside"},hU={class:"fct-admin-sidebar"},zp={__name:"SingleCustomerLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",uU,[o("div",cU,[n(s,{animated:"",class:"flex items-start gap-2"},{template:d(()=>[(r(),h(P,null,te(3,i=>n(l,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),o("div",AU,[o("div",pU,[o("div",fU,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Orders")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1})]),o("div",mU,[o("div",hU,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Informations"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},_U={key:2},vU={key:0,class:"fct-single-customer-wrapper fct-layout-width"},gU={class:"single-page-header"},yU={class:"single-page-header-title-wrap"},bU={key:0},wU={key:0,class:"single-page-body"},CU={class:"fct-admin-sidebar"},kU={key:0},BU={name:"SingleCustomer",props:["customer_id"],components:{OrdersTable:rd,IconButton:at,Empty:Ct,DynamicIcon:Y,Badge:fa,SaveBar:un,CustomerInformation:Gp,Labels:di,DynamicTemplates:pn,ArrowDown:Hn,ArrowRight:Al,CardContainer:Se,CardHeader:Ve,CardBody:ke,LicenseTable:od,OrdersTableMobile:dd,SubscriptionsTable:oA,SingleCustomerLoader:zp,SubscriptionsTableMobile:nA},data(){return{changes_made:0,notFound:{show:!1,message:"",buttonText:"",route:""},loading:!1,customer:"",selection:!1,selectedOrders:[],editableOrderStatues:this.appVars.editable_order_statues,selectedLabels:[],licenses:[],subscriptions:[],customerOrders:[],paginate:{current_page:1,per_page:10,last_page:1,total:0,from:1,to:10},fetchingOrders:!1,search:"",showSearch:!1}},watch:{customer_id:{handler(e,t){this.fetch()}}},computed:{},methods:{getProductName(e){var t,a;return(t=e==null?void 0:e.product)!=null&&t.post_title?(a=e==null?void 0:e.product)==null?void 0:a.post_title:"n/a"},getProductVariationName(e){var t,a;return(t=e==null?void 0:e.product_variant)!=null&&t.variation_title?(a=e==null?void 0:e.product_variant)==null?void 0:a.variation_title:"n/a"},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},update(){this.loading=!0,Ae.put("customers/"+this.customer_id+"/additional-info",{labels:this.selectedLabels}).then(e=>{q.success(e)}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},discardChanges(){return window.location.reload()},fetch(){this.notFound.show=!1,this.loading=!0,this.selectedOrders=[],Ae.get("customers/"+this.customer_id,{with:["admin_customer_detail"]}).then(e=>{this.changeTitle(u("Customer: %s",e.customer.full_name)),this.customer=e.customer,this.selectedLabels=e.customer.selected_labels,this.licenses=this.customer.licenses,this.subscriptions=this.customer.subscriptions}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=dt.get(e,"data.buttonText"),this.notFound.message=dt.get(e,"data.message"),this.notFound.route=dt.get(e,"data.route")):e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},getCustomerOrders(){this.fetchingOrders=!0,Ae.get("customers/"+this.customer_id+"/orders",{per_page:this.paginate.per_page,page:this.paginate.current_page,with:["admin_customer_orders"],search:this.search,order_by:"id",order_type:"DESC"}).then(e=>{this.customerOrders=e.orders,this.paginate.total=e.orders.total,this.paginate.per_page=e.orders.per_page,this.paginate.current_page=e.orders.current_page,this.paginate.last_page=e.orders.last_page,this.paginate.from=e.orders.from,this.paginate.to=e.orders.to}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.fetchingOrders=!1})},onSelection(e){this.selection=!!e.length,this.selectedOrders=e,this.selectionCount=e.length}},mounted(){this.fetch(),this.getCustomerOrders()}},xU=Object.assign(BU,{setup(e){return(t,a)=>{const l=C("el-breadcrumb-item"),s=C("el-breadcrumb"),i=C("el-input"),c=C("el-col"),p=C("el-row");return r(),h(P,null,[t.loading?(r(),E(zp,{key:0})):x("",!0),t.notFound.show?(r(),E(ci,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):x("",!0),t.notFound.show===!1?(r(),h("div",_U,[t.loading?x("",!0):(r(),h("div",vU,[n(un,{isActive:t.changes_made>0?"is-active":"",onDiscard:t.discardChanges,onSave:t.update,loading:t.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",gU,[o("div",yU,[n(s,{"separator-icon":A(Al)},{default:d(()=>[n(l,{to:{name:"customers"}},{default:d(()=>[R(m(A(u)("Customers")),1)]),_:1}),n(l,null,{default:d(()=>[t.customer?(r(),h("span",bU,m(t.customer.full_name),1)):x("",!0)]),_:1}),n(l,null,{default:d(()=>[R(m(A(u)("Overview")),1)]),_:1})]),_:1},8,["separator-icon"])])]),t.customer.id?(r(),h("div",wU,[n(p,{gutter:30},{default:d(()=>[n(c,{lg:17,xs:24},{default:d(()=>[n(A(Se),{class:"overflow-hidden fct-customer-orders-items"},{default:d(()=>[n(A(Ve),{title:A(u)("Orders (%s)",A(sa)(t.customerOrders.total||0)),title_size:"small"},{action:d(()=>[n(i,{modelValue:t.search,"onUpdate:modelValue":a[0]||(a[0]=f=>t.search=f),onKeyup:a[1]||(a[1]=xa(f=>t.getCustomerOrders(),["enter"])),placeholder:A(u)("Type and hit enter..."),clearable:"",onClear:a[2]||(a[2]=f=>t.getCustomerOrders()),class:de(`w-[210px] ${t.showSearch?"":"search-input-hide-on-mobile"}`)},null,8,["modelValue","placeholder","class"]),n(at,{tag:"button",size:"small",onClick:a[3]||(a[3]=f=>t.showSearch=!t.showSearch),class:"icon-button-show-on-mobile ml-2"},{default:d(()=>[t.showSearch?(r(),E(Y,{key:0,name:"Cross"})):(r(),E(Y,{key:1,name:"Search"}))]),_:1})]),_:1},8,["title"]),n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[t.fetchingOrders?(r(),E(yE,{key:0,columns:["items","order_items","total","type","status"]})):(r(),h(P,{key:1},[n(rd,{class:"hide-on-mobile",onFetch:t.getCustomerOrders,orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["onFetch","orders"]),n(dd,{class:"show-on-mobile",orders:t.customerOrders.data,columns:["items","order_items","total","type","status"]},null,8,["orders"])],64)),t.paginate.total>10?(r(),E(jc,{key:2,onFetch:t.getCustomerOrders,hide_on_single:!1,pagination:t.paginate},null,8,["onFetch","pagination"])):x("",!0)]),_:1})]),_:1}),t.customer.subscriptions?(r(),E(A(Se),{key:0,class:"overflow-hidden"},{default:d(()=>[n(A(Ve),{title:A(u)("Subscriptions")+" ("+A(sa)(t.customer.subscriptions.length)+")",title_size:"small"},null,8,["title"]),n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[n(oA,{class:"hide-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"]),n(nA,{class:"show-on-mobile",subscriptions:t.customer.subscriptions,columns:["next_billing_date","collection_method","bills_count","order_id","payment_method","valid_till"]},null,8,["subscriptions"])]),_:1})]),_:1})):x("",!0),t.customer.licenses?(r(),E(A(Se),{key:1,class:"overflow-hidden"},{default:d(()=>[n(A(Ve),{title:A(u)("Licenses")+" ("+A(sa)(t.customer.licenses.length)+")",title_size:"small"},null,8,["title"]),n(A(ke),{class:"px-0 pb-0 fct-single-customer-license-table"},{default:d(()=>[n(od,{columns:["product","order_id"],licenses:t.customer.licenses},null,8,["licenses"])]),_:1})]),_:1})):x("",!0)]),_:1}),n(c,{lg:7,xs:24},{default:d(()=>[o("div",CU,[n(Gp,{customer:t.customer,customer_id:e.customer_id,onFetch:t.fetch},null,8,["customer","customer_id","onFetch"]),n(di,{"bind-to-id":t.customer.id,"bind-to-type":"Customer",selectedLabels:t.selectedLabels,shouldEnableEditing:!0},null,8,["bind-to-id","selectedLabels"]),t.customer?(r(),h("div",kU,[n(pn,{filter:"customer",widgetsQuery:{customer_id:t.customer.id},data:{customer:t.customer}},null,8,["widgetsQuery","data"])])):x("",!0)])]),_:1})]),_:1})])):x("",!0)]))])):x("",!0)],64)}}}),SU={components:{BundleProducts:To,Empty:Ct,Pagination:jc,Badge:fa,DynamicIcon:Y},props:["searchQueryParent","orderParent","order_id"],data(){return{loading:!1,searching:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],cartItems:[],paginate:{per_page:10,current_page:1,total:0,last_page:1},collapsedStates:null}},computed:{CurrencyFormatter(){return ft},Asset(){return gs},order:{get(){return this.orderParent},set(e){this.$emit("update:order",e)}},searchQuery:{get(){return this.searchQueryParent},set(e){this.$emit("update:searchQuery",e)}}},created(){this.initializeCollapsedStates()},methods:{translate:u,translateNumber:sa,initializeCollapsedStates(){this.collapsedStates=Array.from({length:this.availableProducts.length},()=>!1)},handleToggleCollapse(e){this.collapsedStates[e]=!this.collapsedStates[e];for(let t=0;t<this.collapsedStates.length;t++)t!==e&&(this.collapsedStates[t]=!1)},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.other_info.payment_type&&l.other_info.payment_type===t)).length>0},validateShouldAddProduct(e){var i;const t=this.order.order_items.map(c=>c.object_id),a=this.selectedProducts.map(c=>c.object_id),l=((i=e==null?void 0:e.other_info)==null?void 0:i.payment_type)==="onetime"?"subscription":"onetime",s=this.order.order_items.length===0;if(s&&this.selectedProducts.length===0)return!0;if(s&&a.includes(e.object_id))return!0;if(!s&&t.includes(e.object_id))return!0;if(s&&!this.hasSubscriptionProduct(this.selectedProducts,l)){if(!this.hasSubscriptionProduct(this.selectedProducts,"subscription"))return!0}else if(!s&&!this.hasSubscriptionProduct(this.order.order_items,l)&&!this.hasSubscriptionProduct(this.order.order_items,"subscription"))return!0;return!1},handleCheckboxChange(e,t){if(t.checked)if(this.validateShouldAddProduct(t))this.selectedProducts.push(t);else return t.checked=!1,q.error(u("You can purchase one subscription at a time."));else{const a=this.selectedProducts.findIndex(l=>l.id===t.id);if(a!==-1)return this.selectedProducts.splice(a,1)}},onCurrentPageChanged({page:e,currentPageCount:t}){this.paginate.current_page=e,this.doSearch()},onPerPageChanged(e){this.paginate.per_page=e,this.doSearch()},isAlreadyAdded(e){return this.order.order_items?this.order.order_items.some(t=>parseInt(t.object_id)===parseInt(e)):!1},isNotParentVariant(e){return!e.children||e.children.length<1},handleSelectionChanges(e){this.selectedProducts=e},processProducts(){let e={};this.order.order_items&&this.order.order_items.length&&this.order.order_items.forEach((a,l)=>{e[a.object_id]=a}),this.selectedProducts&&this.selectedProducts.forEach((a,l)=>{e[a.object_id]?e[a.object_id].quantity++:(a.tax_amount=parseInt(a.tax_amount)||0,a.shipping_charge=parseInt(a.shipping_charge)||0,a.discount_total=parseInt(a.discount_total)||0,a.quantity=parseInt(a.quantity)||1,a.payment_type==="subscription"&&(a.custom_price=null,a.original_price=a.price,a.original_unit_price=a.unit_price,a.has_custom_price=!1),e[a.object_id]=a),e[a.object_id].updated_stock=parseInt(a.available),e[a.object_id].total=parseInt(e[a.object_id].price)*parseInt(e[a.object_id].quantity),e[a.object_id].line_total=parseInt(e[a.object_id].total)-parseInt(e[a.object_id].discount_total)+parseInt(e[a.object_id].tax_amount)}),this.order.order_items=[];let t=0;for(const a in e)if(this.order.order_items.push(e[a]),t+=parseInt(e[a].line_total),e[a].payment_type==="subscription"&&e[a].other_info.manage_setup_fee==="yes"){let l=parseInt(e[a].other_info.signup_fee);e[a].other_info.setup_fee_per_item==="yes"&&(l=l*e[a].quantity),t+=l}return this.order.subtotal=t,this.order.total_amount=t+parseInt(this.order.tax_total)+parseInt(this.order.shipping_total)-parseInt(this.order.manual_discount_total),this.orderAddModal=!1,this.searchQuery="",this.selectedProducts=[],!0},fetchBySearch(){this.loading=!0,this.searching=!0,this.orderAddModal=!0;let e=this;xe(()=>{setTimeout(()=>{e.$refs.fc_product_search_new.ref.focus()},50)}),clearTimeout(this.timeout);const t=this;this.timeout=setTimeout(function(){t.doSearch()},700)},doSearch(){this.loading=!0;let e={active_view:"publish",per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.searchQuery,filter_type:"simple",sort_by:"ID",with:["admin_order_add_product"]};Ae.get("products/",{...e}).then(t=>{let a={...t.products};this.availableProducts=Dm(a.data,this.order_id),delete a.data,this.paginate=a,this.searching=!1}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1})},formatCapitalized(e){return Qm(e)}}},FU={class:"fluent-cart-admin-pages"},$U={class:"-mx-5 pb-5 border border-solid border-t-0 border-x-0 border-gray-divider dark:border-dark-400"},EU={class:"px-5"},UU={class:"fc_product_search_table",ref:"fc_product_search_table"},IU={class:"fct-collapsible-list"},QU={class:"fct-collapsible-list-item-inner"},DU={class:"fct-collapsible-item"},VU={class:"fct-collapsible-content-wrapper"},TU=["onClick"],MU={key:1,class:"content-indent"},LU={class:"content-checkbox"},RU={class:"content-img"},OU=["src","alt"],PU={class:"content-title"},HU={class:"title"},NU={key:0,class:"text-gray-500 dark:text-gray-400"},KU={key:1,class:"text"},GU={key:0,class:"fct-collapsible-stock-wrapper"},zU={key:0},jU={key:1,class:"text-red-500"},qU={class:"fct-collapsible-value-wrapper"},YU={key:0},WU={key:1},JU={class:"fct-collapsible-item-child-inner"},XU={class:"fct-collapsible-item"},ZU={class:"fct-collapsible-content-wrapper"},e5={class:"fct-collapsible-content-group"},t5={class:"content-checkbox"},a5={class:"content-img"},l5=["src","alt"],s5={class:"content-title"},n5={class:"title title--wrap"},o5={key:0,class:"text"},i5={key:0},r5={key:1,class:"text already-added"},d5={class:"fct-collapsible-stock-wrapper"},u5={key:0},c5={key:1,class:"text-red-500"},A5={class:"fct-collapsible-value-wrapper"},p5={class:"-mx-5 -mb-5 fc_product_search_pagination_wrap"},f5={class:"dialog-footer"};function m5(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),f=C("el-skeleton"),_=C("el-checkbox"),g=C("BundleProducts"),y=C("Empty"),v=C("Pagination"),w=C("el-button"),k=C("el-dialog");return r(),h("div",FU,[n(k,{class:"fct-add-product-item-modal",ref:"fc_product_search_container",onClose:t[3]||(t[3]=b=>i.searchQuery=""),modelValue:s.orderAddModal,"onUpdate:modelValue":t[4]||(t[4]=b=>s.orderAddModal=b),title:e.$t("Add Items")},{default:d(()=>[o("div",$U,[o("div",EU,[n(p,{placeholder:e.$t("Search products"),autofocus:"",ref:"fc_product_search_new",onInput:t[0]||(t[0]=b=>i.fetchBySearch()),modelValue:i.searchQuery,"onUpdate:modelValue":t[1]||(t[1]=b=>i.searchQuery=b),clearable:""},{prefix:d(()=>[n(c,{name:"Search"})]),_:1},8,["placeholder","modelValue"])])]),o("div",UU,[n(f,{class:"px-5 py-4",loading:s.loading,rows:5,animated:""},null,8,["loading"]),s.loading?x("",!0):(r(),h(P,{key:0},[o("ul",IU,[(r(!0),h(P,null,te(s.availableProducts,(b,S)=>{var $,D,F,B,U,Q,V,I,M;return r(),h("li",{class:"fct-collapsible-list-item",key:S},[o("div",QU,[o("div",DU,[o("div",VU,[(($=b==null?void 0:b.children)==null?void 0:$.length)>0?(r(),h("div",{key:0,class:de(["content-collapsible-btn",{"is-collapsed":s.collapsedStates[S]}]),onClick:O=>i.handleToggleCollapse(S)},[n(c,{name:"CaretRight"})],10,TU)):x("",!0),!((D=b==null?void 0:b.children)!=null&&D.length)>0?(r(),h("div",MU)):x("",!0),o("div",LU,[n(_,{modelValue:b.checked,"onUpdate:modelValue":O=>b.checked=O,onChange:O=>i.handleCheckboxChange(S,b),disabled:b.disable===!0||i.isAlreadyAdded(b.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",RU,[o("img",{src:b.featured_media!=null?b.featured_media:i.Asset.getUrl("images/placeholder-small.svg"),alt:b.title},null,8,OU)]),o("div",PU,[o("div",HU,m(b.post_title),1),((F=b==null?void 0:b.other_info)==null?void 0:F.payment_type)==="subscription"&&((B=b.other_info)==null?void 0:B.billing_summary)!==""?(r(),h("small",NU,m((U=b.other_info)==null?void 0:U.billing_summary),1)):x("",!0),i.isAlreadyAdded(b.object_id)?(r(),h("div",KU,m(e.$t("Item already added")),1)):x("",!0)])]),((Q=b==null?void 0:b.children)==null?void 0:Q.length)==0?(r(),h("div",GU,[b.stockStatus=="in-stock"?(r(),h("span",zU,m(b.available!==1/0?b.available+i.translate(" Available"):i.translate("Unlimited")),1)):x("",!0),b.stockStatus==="out-of-stock"?(r(),h("span",jU,m(i.formatCapitalized(b.stockStatus)),1)):x("",!0)])):x("",!0),o("div",qU,[((V=b==null?void 0:b.children)==null?void 0:V.length)>0?(r(),h("span",YU,m(b.min_price!=b.max_price?e.formatNumber(b.min_price)+" - "+e.formatNumber(b.max_price):e.formatNumber(b.min_price)),1)):(r(),h("span",WU,m(e.formatNumber(b.price)),1))])]),((I=b==null?void 0:b.children)==null?void 0:I.length)>0?(r(),h("div",{key:0,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},null,2)):x("",!0),((M=b==null?void 0:b.children)==null?void 0:M.length)>0?(r(),h("div",{key:1,class:de(["fct-collapsible-item-child-container",{"is-collapsed":s.collapsedStates[S]}])},[o("ul",JU,[(r(!0),h(P,null,te(b.children,(O,L)=>{var H,j,W,G,Z;return r(),h("li",{key:L},[o("div",XU,[o("div",ZU,[o("div",e5,[o("div",t5,[n(_,{modelValue:O.checked,"onUpdate:modelValue":ne=>O.checked=ne,onChange:ne=>i.handleCheckboxChange(L,O),disabled:O.disable===!0||i.isAlreadyAdded(O.object_id)},null,8,["modelValue","onUpdate:modelValue","onChange","disabled"])]),o("div",a5,[o("img",{src:O.featured_media!=null?O.featured_media:e.appVars.asset_url+"images/placeholder-small.svg",alt:O.title},null,8,l5)])]),o("div",s5,[o("div",n5,m(O.variation_display_title||O.title),1),((H=O==null?void 0:O.other_info)==null?void 0:H.payment_type)==="subscription"&&((j=O.other_info)==null?void 0:j.billing_summary)!==""?(r(),h("small",o5,[R(m(i.CurrencyFormatter.currencySign)+" "+m((W=O.other_info)==null?void 0:W.billing_summary)+" ",1),((G=O.other_info)==null?void 0:G.trial_days)>0?(r(),h("span",i5,[t[5]||(t[5]=o("br",null,null,-1)),R(" "+m(i.translate("Trial Days"))+": "+m((Z=O.other_info)==null?void 0:Z.trial_days),1)])):x("",!0)])):x("",!0),i.isAlreadyAdded(O.object_id)?(r(),h("div",r5,m(i.translate("Item already added")),1)):x("",!0),O.bundle_items.length>0?(r(),E(g,{key:2,product:O,"title-key":"variation_title"},null,8,["product"])):x("",!0)])]),o("div",d5,[O.stockStatus=="in-stock"?(r(),h("span",u5,m(O.available!==1/0?i.translateNumber(O.available)+i.translate(" Available"):i.translate("Unlimited")),1)):x("",!0),O.stockStatus=="out-of-stock"?(r(),h("span",c5,m(i.formatCapitalized(O.stockStatus)),1)):x("",!0)]),o("div",A5,m(e.formatNumber(O.price)),1)])])}),128))])],2)):x("",!0)])])}),128))]),s.availableProducts.length===0?(r(),E(y,{key:0,icon:"Empty/ListView",text:i.translate("We could't find any products matching your search.")},null,8,["text"])):x("",!0)],64))],512),o("div",p5,[n(v,{pagerSizes:!1,hide_on_single:!1,pagination:s.paginate,onFetch:i.doSearch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),o("div",f5,[n(w,{onClick:t[2]||(t[2]=b=>s.orderAddModal=!1)},{default:d(()=>[R(m(i.translate("Cancel")),1)]),_:1}),n(w,{disabled:!s.selectedProducts.length,type:"primary",onClick:i.processProducts},{default:d(()=>[R(m(i.translate("Add Items")),1)]),_:1},8,["disabled","onClick"])])]),_:1},8,["modelValue","title"])])}const jp=nt(SU,[["render",m5]]),Pn=(e,t=null)=>{if(!e)return"";const a=Array.isArray(e.attr_map)?e.attr_map:[];if(a.length){const l=Array.isArray(t)?t.map(p=>parseInt(p,10)):null,s=p=>{const f=parseInt(p&&p.group_id,10);if(l){const _=l.indexOf(f);return _===-1?Number.MAX_SAFE_INTEGER:_}return f||0},c=[...a].sort((p,f)=>s(p)-s(f)).map(p=>p&&p.title?String(p.title).trim():"").filter(Boolean);if(c.length)return c.join(" / ")}return e.variation_title||""},Yo=e=>{var a,l;const t=(l=(a=e==null?void 0:e.detail)==null?void 0:a.other_info)==null?void 0:l.attribute_config;return Array.isArray(t)?t.map(s=>parseInt(s&&s.group_id,10)).filter(s=>!Number.isNaN(s)):null},h5={key:0,class:"fct-downloadable-variation-selector"},_5={class:"price-info"},v5={key:0},Wo={__name:"VariationSelector",props:{variant:{type:Object,required:!0},groupOrder:{type:Array,default:null}},setup(e){return(t,a)=>{var l;return e.variant?(r(),h("div",h5,[o("span",null,m(A(Pn)(e.variant,e.groupOrder)),1),o("span",_5,[(l=e.variant.other_info)!=null&&l.repeat_interval?(r(),h("span",v5,m(A(da).capitalize(e.variant.other_info.repeat_interval)),1)):x("",!0),o("span",null,m(A(Kt)(e.variant.item_price,!0)),1)])])):x("",!0)}}},g5={name:"Refund",components:{Badge:fa,VariationSelector:Wo,DynamicIcon:Y},props:["order_id","order","is_subscription","subscription_status","showRefundModal"],data(){return{transactions:{},maxRefundAmount:"",refundProcessing:!1,refundableTransactions:[],isShippingRefundable:!1,refund:{item_ids:[],transaction_id:"",amount:0,cancelSubscription:!0,reason:"",availableAmount:"",paymentMethod:"",manageStock:!1},totalPaid:0,refundNote:""}},computed:{CurrencyFormatter(){return ft},orderCurrencySign(){const e=ze.get("currency_signs",{}),t=ze.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},isAnyProductManageStock(){var e;for(const t of this.order.order_items)if(t!=null&&t.variants&&((e=t==null?void 0:t.variants)==null?void 0:e.manage_stock)==="1")return!0;return!1},isSubscriptionCancelable(){return this.is_subscription&&this.subscription_status!=="canceled"&&this.subscription_status!=="expired"},checkMaxRefundAmount(){this.refund.amount>this.maxRefundAmount&&(this.refund.amount=this.maxRefundAmount)},refundTableItems(){let e=[];return!this.refund.item_ids||this.refund.item_ids.length===0?e=this.order.order_items.filter(t=>t.payment_type!=="signup_fee"):e=this.order.order_items.filter(t=>this.refund.item_ids.includes(t.id)&&t.payment_type!=="signup_fee"),e.map(t=>({...t,restore_quantity:t.restore_quantity||0,refund_quantity:Number(t.refund_total)||0}))}},watch:{showRefundModal(e){this.refundNote=""},"order.order_items":{immediate:!0,handler(e){const t=e.filter(a=>Number(a.line_total)-Number(a.refund_total)>0);t.length===1?this.refund.item_ids=[t[0].id]:this.refund.item_ids=[]}}},mounted(){var e,t,a;this.refund.availableAmount=parseInt((e=this==null?void 0:this.order)==null?void 0:e.total_paid)-parseInt((t=this==null?void 0:this.order)==null?void 0:t.total_refund),this.transactions=(a=this.order)==null?void 0:a.transactions,this.transactions.length&&this.updateRefundable()},methods:{translate:u,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},updateMaxRefund(){const e=this.refund.transaction_id;let t=this.refundableTransactions.find(s=>s.id===e);this.refund.amount=t.refundable?parseFloat(t.refundable/100):0,this.refund.paymentMethod=t.payment_method;const a=dt.whereIn(this.order.order_items,"id",this.refund.item_ids),l=a.reduce((s,i)=>s+(i.line_total-i.refund_total)/100,0);this.refund.amount>l&&a.length>0&&(this.refund.amount=l),this.maxRefundAmount=this.refund.amount},updateRefundable(){this.refundableTransactions=this.transactions.filter(e=>e.status==="succeeded"),this.refundableTransactions.length!==0&&(this.refund.transaction_id=this.refundableTransactions[0].id,this.refund.payment_method=this.refundableTransactions[0].payment_method,this.updateMaxRefund(this.refund.transaction_id))},processRefund(){if(this.refundProcessing=!0,!this.refund.amount)return this.refundProcessing=!1,this.handleMessage("Please add refund amount.","error");if(this.refund.amount>this.refund.availableAmount)return this.refundProcessing=!1,this.handleMessage(`Refund amount should not exceed: ${this.appVars.shop.currency_sign}${this.refund.availableAmount}`,"error");const e=this.refundTableItems.filter(a=>a.restore_quantity>0).map(a=>({id:a.id,variation_id:a.object_id,quantity:a.quantity,restore_quantity:a.restore_quantity}));this.refund.refunded_items=e;const t={...this.refund,amount:Math.round(parseFloat(this.refund.amount)*100)};this.$post("orders/"+this.order_id+"/refund",{refund_info:t,refunded_items:e}).then(a=>{this.refundNote=a}).catch(a=>{this.handleError(a)}).finally(()=>{this.updateRefundable(),this.refundProcessing=!1})}}},y5={key:0,class:"fct-refund-note-list"},b5={class:"message"},w5={key:1},C5={class:"refund-item-info"},k5={class:"right"},B5={class:"price"},x5={class:"price light"},S5={class:"form-note"},F5={style:{color:"#F04438","font-weight":"500"}},$5={class:"form-note form-note-tooltip"},E5={class:"dialog-footer is-border"},U5={key:0};function I5(e,t,a,l,s,i){const c=C("Badge"),p=C("el-option"),f=C("el-select"),_=C("el-form-item"),g=C("el-input"),y=C("el-checkbox"),v=C("el-col"),w=C("el-table-column"),k=C("el-input-number"),b=C("el-table"),S=C("DynamicIcon"),$=C("el-tooltip"),D=C("el-row"),F=C("el-form"),B=C("el-button");return r(),h("div",null,[s.refundNote?(r(),h("div",y5,[(r(!0),h(P,null,te(s.refundNote,(U,Q)=>(r(),h("div",{key:Q,class:"fct-refund-note-item"},[o("span",b5,m(U.message),1),n(c,{status:U.status},null,8,["status"])]))),128))])):(r(),h("div",w5,[n(F,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(D,{gutter:10},{default:d(()=>[n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund with transaction"),required:""},{default:d(()=>[n(f,{modelValue:s.refund.transaction_id,"onUpdate:modelValue":t[0]||(t[0]=U=>s.refund.transaction_id=U),placeholder:e.$t("Select"),onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(P,null,te(s.refundableTransactions,U=>(r(),E(p,{key:U.id,label:i.translate("#%1$s - Paid %2$s",U.id,i.formatNumber(U.refundable,!0)),value:U.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(_,{label:e.$t("Select Item/s")},{default:d(()=>[n(f,{modelValue:s.refund.item_ids,"onUpdate:modelValue":t[1]||(t[1]=U=>s.refund.item_ids=U),placeholder:e.$t("Select"),multiple:"",onChange:i.updateMaxRefund},{default:d(()=>[(r(!0),h(P,null,te(a.order.order_items,U=>(r(),E(p,{key:U.id,value:U.id,label:U.post_title+" - "+(U.variation_display_title||U.title)+" "+i.formatNumber(U.line_total-U.refund_total),class:"refund-item",disabled:Number(U.line_total)-Number(U.refund_total)<=0},{default:d(()=>[o("div",C5,[o("p",null,[R(m(U.post_title)+" ",1),o("span",null,"-"+m(U.variation_display_title||U.title),1)]),o("div",k5,[o("span",B5,m(i.translate("Refundable: %1$s",i.formatNumber(U.line_total-U.refund_total))),1),o("span",x5,m(i.translate("Item price: %1$s",i.formatNumber(U.line_total))),1)])])]),_:2},1032,["value","label","disabled"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])]),_:1},8,["label"]),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Refund amount"),required:""},{default:d(()=>[n(g,{type:"number",min:1,max:s.maxRefundAmount,modelValue:s.refund.amount,"onUpdate:modelValue":t[2]||(t[2]=U=>s.refund.amount=U),modelModifiers:{number:!0},onInput:i.checkMaxRefundAmount},{prefix:d(()=>[R(m(i.orderCurrencySign),1)]),_:1},8,["max","modelValue","onInput"]),o("div",S5,[o("p",null,[R(m(e.$t("Max refund amount for this transaction:"))+" ",1),o("span",F5,m(i.formatNumber(s.maxRefundAmount*100)),1)])])]),_:1},8,["label"]),i.isSubscriptionCancelable?(r(),E(v,{key:0,lg:24},{default:d(()=>[n(_,{label:e.$t("Subscription")},{default:d(()=>[n(y,{label:e.$t("Cancel Subscription (if any)"),modelValue:s.refund.cancelSubscription,"onUpdate:modelValue":t[3]||(t[3]=U=>s.refund.cancelSubscription=U)},null,8,["label","modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),i.isAnyProductManageStock?(r(),E(v,{key:1,lg:24},{default:d(()=>[n(_,null,{default:d(()=>[n(y,{modelValue:s.refund.manageStock,"onUpdate:modelValue":t[4]||(t[4]=U=>s.refund.manageStock=U)},{default:d(()=>[R(m(e.$t("Restock Quantity")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})):x("",!0),s.refund.manageStock?(r(),E(v,{key:2,lg:24},{default:d(()=>[n(b,{data:i.refundTableItems,border:"",style:{width:"100%","margin-top":"15px"}},{default:d(()=>[n(w,{prop:"post_title",label:e.$t("Product"),"min-width":"200"},{default:d(({row:U})=>[o("span",null,m(U.post_title)+" - "+m(U.title),1)]),_:1},8,["label"]),n(w,{prop:"quantity",label:e.$t("Quantity"),width:"120",align:"center"},{default:d(({row:U})=>[o("span",null,m(U.quantity),1)]),_:1},8,["label"]),n(w,{label:e.$t("Restore Quantity"),width:"180",align:"center"},{default:d(({row:U})=>[n(k,{modelValue:U.restore_quantity,"onUpdate:modelValue":Q=>U.restore_quantity=Q,min:0,max:U.quantity},null,8,["modelValue","onUpdate:modelValue","max"])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})):x("",!0),n(v,{lg:24},{default:d(()=>[n(_,{label:e.$t("Reason of refund")},{default:d(()=>[n(g,{modelValue:s.refund.reason,"onUpdate:modelValue":t[5]||(t[5]=U=>s.refund.reason=U)},null,8,["modelValue"]),o("div",$5,[o("p",null,[R(m(i.translate("Your customers can see this reason"))+" ",1),o("span",null,[n($,{"popper-class":"fct-tooltip",placement:"top",content:i.translate("If set, possible values are duplicate fraudulent, and requested_by_customer If you believe the charge to be fraudulent, specifying fraudulent as the reason will add the associated card and email to your block lists")},{default:d(()=>[n(S,{name:"InformationFill"})]),_:1},8,["content"])])])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o("div",E5,[n(B,{type:"primary",onClick:Ge(i.processRefund,["prevent"]),loading:s.refundProcessing,disabled:s.refund.amount<=0},{default:d(()=>[R(m(s.refundProcessing?i.translate("Processing"):i.translate("Refund"))+" ",1),s.refund.amount?(r(),h("span",U5)):x("",!0),R(m(i.formatNumber(s.refund.amount*100)),1)]),_:1},8,["onClick","loading","disabled"])])]))])}const Q5=nt(g5,[["render",I5]]),D5={class:"fct-number-input"},V5=["disabled","min","max"],T5={class:"fct-number-input-buttons"},M5=["disabled"],L5=["disabled"],R5={style:{color:"red"}},qp={__name:"NumberInput",props:{min:{type:Number,default:1},max:{type:Number,default:999999},item:{type:Object,default:()=>({})},isDisabled:{type:Boolean,default:!1}},setup(e,{emit:t}){var $,D,F,B,U;const a=t,l=e,s=T(""),i=()=>{var Q,V,I,M;return(((Q=l.item)==null?void 0:Q.manage_stock)||((M=(I=(V=l.item)==null?void 0:V.variants)==null?void 0:I.product_detail)==null?void 0:M.manage_stock))==1},c=T((($=l.item)==null?void 0:$.quantity)||l.min),p=T(c.value),f=T(i()?((D=l.item)==null?void 0:D.available)||((B=(F=l.item)==null?void 0:F.variants)==null?void 0:B.available):l.max),_=T(i()?(U=l.item)==null?void 0:U.updated_stock:l.max);Jt().ctx;const g=K(()=>p.value<=l.min),y=K(()=>p.value>=_.value),v=()=>{s.value="",p.value<_.value&&(c.value++,p.value=c.value,a("update:value",c.value,_.value,l.item))},w=()=>{s.value="",p.value>l.min&&(c.value--,p.value=c.value,a("update:value",c.value,_.value,l.item))},k=(Q,V)=>{s.value="",p.value=parseInt(p.value),(isNaN(p.value)||p.value==="")&&(c.value=1),p.value<l.min?(c.value=l.min,p.value=c.value):p.value>l.max?(c.value=l.min,p.value=c.value,s.value=u("Unable to adjust quantity")):p.value>_.value?(c.value=_.value,p.value=c.value,s.value=u("Available: %s in stock",_.value)):p.value>=l.min&&(p.value===_.value||p.value<_.value)&&(c.value=p.value,p.value=c.value),a("update:value",c.value,_.value,l.item)},b=Q=>{Q.key==="ArrowDown"&&p.value<=l.min&&Q.preventDefault()},S=()=>{var Q,V,I,M,O;s.value="",c.value=((Q=l.item)==null?void 0:Q.quantity)||l.min,p.value=c.value,f.value=i()?((V=l.item)==null?void 0:V.available)||((M=(I=l.item)==null?void 0:I.variants)==null?void 0:M.available):l.max,_.value=i()?(O=l.item)==null?void 0:O.updated_stock:l.max};return Ds(()=>{S()}),be(()=>l.item,Q=>{S()},{deep:!0}),(Q,V)=>(r(),h(P,null,[o("div",D5,[Wt(o("input",{disabled:e.isDisabled,"onUpdate:modelValue":V[0]||(V[0]=I=>p.value=I),type:"number",onInput:V[1]||(V[1]=I=>{k()}),min:e.min,max:e.max,onKeydown:b},null,40,V5),[[Hc,p.value,void 0,{number:!0}]]),o("div",T5,[o("button",{onClick:v,class:"increment-btn",disabled:y.value||e.isDisabled},[n(Y,{name:"ChevronUp"})],8,M5),o("button",{onClick:w,class:"decrement-btn",disabled:g.value||e.isDisabled},[n(Y,{name:"ChevronDown"})],8,L5)])]),o("span",R5,m(s.value),1)],64))}},O5={name:"PaymentLink",components:{IconButton:at,DynamicIcon:Y,CopyToClipboard:Ea,InfoFilled:ll},props:["order","order_id"],data(){return{fetchLink:!1,selectedMethod:"stripe",business_email:"",buyer_email:"",selectedTransaction:"0",use_vendor_checkout:!1,vendor_url:null,transactionIds:[],actionName:"copy",paymentUrl:"",paymentMethods:[{value:"stripe",label:"Stripe"},{value:"paypal",label:"PayPal"}]}},computed:{DynamicIcon(){return Y},adminUrl(){return ze.get("admin_url")}},mounted(){this.makeSelectableId(),this.generatePaymentUrl()},methods:{translate:u,updatePaymentLink(e){e?this.searchOldUrl():this.paymentUrl=this.order.custom_checkout_url},getPaymentLink(){this.fetchLink=!0,this.$get("orders/"+this.order_id+"/transactions/get_payment_link",{data:{method:this.selectedMethod,transaction:0,use_vendor_checkout:this.use_vendor_checkout,business_email:this.business_email,buyer_email:this.buyer_email}}).then(e=>{var t,a;this.vendor_url=(t=e==null?void 0:e.data)==null?void 0:t.redirect_to,this.paymentUrl=(a=e==null?void 0:e.data)==null?void 0:a.redirect_to,this.fetchLink=!1}).catch(e=>{this.handleError(e),this.fetchLink=!1,this.$emit("reload")})},makeSelectableId(){this.transactionIds=[],this.order.transactions.forEach(e=>{e.status!=="paid"&&this.transactionIds.push({label:e.id,value:e.id})})},searchOldUrl(){var t,a;this.selectedTransaction=this.transactionIds[this.transactionIds.length-1].value;const e=this.order.transactions.filter(l=>l.id==this.selectedTransaction&&l.payment_method==this.selectedMethod);this.paymentUrl=(a=(t=e[0])==null?void 0:t.meta)==null?void 0:a.payment_link},generatePaymentUrl(){this.paymentUrl=this.order.custom_checkout_url}}},P5=["element-loading-text"],H5={class:"fct-payment-link-block"},N5={key:1,class:"fct-payment-link-block"};function K5(e,t,a,l,s,i){const c=C("CopyToClipboard"),p=C("el-button"),f=C("el-input"),_=C("el-form-item"),g=C("el-col"),y=C("el-row"),v=Va("loading");return Wt((r(),h("div",{class:"fct-payment-link grid gap-5","element-loading-text":i.translate("Please wait, Generating Payment link...")},[o("div",H5,[s.paymentUrl?(r(),E(c,{key:0,text:s.paymentUrl,tooltipText:i.translate("Copy Link"),placeholder:i.translate("No payment link available,Please setup custom checkout page!")},null,8,["text","tooltipText","placeholder"])):(r(),E(p,{key:1,target:"_blank",link:"",tag:"router-link",to:{name:"pages_setup"}},{default:d(()=>[R(m(i.translate("Create a custom checkout page to generate custom links.")),1)]),_:1}))]),s.selectedMethod==="paypal"&&s.use_vendor_checkout?(r(),E(y,{key:0,class:"el-form--label-top",gutter:20},{default:d(()=>[n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Business/Seller Email")},{default:d(()=>[n(f,{modelValue:s.business_email,"onUpdate:modelValue":t[0]||(t[0]=w=>s.business_email=w),placeholder:i.translate("Enter your PayPal business/seller email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(g,{md:24,lg:11},{default:d(()=>[n(_,{label:i.translate("PayPal Buyer Email (optional)")},{default:d(()=>[n(f,{modelValue:s.buyer_email,"onUpdate:modelValue":t[1]||(t[1]=w=>s.buyer_email=w),placeholder:i.translate("Enter The buyer email")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0),s.use_vendor_checkout?(r(),h("div",N5,[n(p,{type:"primary",onClick:i.getPaymentLink},{default:d(()=>[R(m(i.translate("Create new transaction & link")),1)]),_:1},8,["onClick"])])):x("",!0)],8,P5)),[[v,s.fetchLink]])}const G5=nt(O5,[["render",K5]]),z5={class:"fct-single-order-loader-wrap fct-layout-width"},j5={class:"single-page-header fct-page-loader-header flex items-start justify-between"},q5={class:"single-page-body"},Y5={class:"fct-single-order"},W5={class:"fct-single-order-main"},J5={class:"fct-single-order-aside"},X5={class:"fct-admin-sidebar"},Z5={__name:"SingleOrderLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",z5,[o("div",j5,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-180"},{template:d(()=>[n(l,{class:"w-1/4"}),n(l,{class:"w-3/4"})]),_:1})]),o("div",q5,[o("div",Y5,[o("div",W5,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Order items")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Payments")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Transaction Details")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title:t.$t("Activity")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})]),o("div",J5,[o("div",X5,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},eI={name:"_Plans.vue",components:{Badge:fa},props:["subscription","header","order","getOrderUrl"],data(){return{}},computed:{subscriptionStatus(){var e;return(e=this.subscription)==null?void 0:e.status}},methods:{translate:u}},tI={class:"fct-subscription-plan-wrap"},aI={class:"fct-subs-status-wrap float-end"},lI={class:"fct-subs-title underline"},sI=["innerHTML"],nI={key:0,class:"cursor-pointer"};function oI(e,t,a,l,s,i){var f,_,g,y;const c=C("Badge"),p=C("router-link");return r(),h("div",tI,[o("div",aI,[n(c,{status:i.subscriptionStatus},null,8,["status"])]),n(p,{to:{name:"view_subscription",params:{subscription_id:(f=a.subscription)==null?void 0:f.id}}},{default:d(()=>{var v;return[o("p",lI,m(e.$t((v=a.subscription)==null?void 0:v.display_item_name)),1)]}),_:1},8,["to"]),o("p",{innerHTML:(_=a.subscription)==null?void 0:_.payment_info},null,8,sI),parseInt((g=a.order)==null?void 0:g.parent_id)?(r(),h("p",nI,[R(m(i.translate("Parent Order:"))+" ",1),o("a",{onClick:t[0]||(t[0]=v=>{var w;return a.getOrderUrl((w=a.order)==null?void 0:w.parent_id)})},"#"+m((y=a.order)==null?void 0:y.parent_id),1)])):x("",!0)])}const Yp=nt(eI,[["render",oI]]),iI={name:"SubscriptionPlanItem",components:{CardContainer:Se,CardHeader:Ve,CardBody:ke,Plans:Yp},props:["subscription","order","index","getOrderUrl"]};function rI(e,t,a,l,s,i){const c=C("CardHeader"),p=C("Plans"),f=C("CardBody"),_=C("CardContainer");return r(),E(_,null,{default:d(()=>[n(c,{title:e.$t("Subscription Plan"),border_bottom:"",title_size:"small"},null,8,["title"]),n(f,null,{default:d(()=>[n(p,{getOrderUrl:a.getOrderUrl,subscription:a.subscription,order:a.order,header:e.$t("Subscription Plans #")+(a.index+1)},null,8,["getOrderUrl","subscription","order","header"])]),_:1})]),_:1})}const dI=nt(iI,[["render",rI]]),uI={name:"OrderBulkActions",components:{DynamicIcon:Y},props:["order","trigger_action","isEditingItem","mode","triggerMode","shouldShowRefund","warningMessage"],emits:["reload","addItem","addProduct","enableItemEditing","disableItemEditing","handlePaymentActions"],data(){return{selected_action:"",showModal:!1,status_data:{order_status:this.order.status,shipping_status:this.order.shipping_status},doing_actions:!1,manage_stock:!0,shouldDisableEditing:["completed","archived","canceled"].includes(this.order.status),isCancelled:["canceled"].includes(this.order.status),isCompleted:["completed"].includes(this.order.status),isUnshippable:["unshippable"].includes(this.order.shipping_status)}},methods:{translate:u,handleCommandAction(e){if(this.selected_action=e,e==="shipping_status")this.changeShipping();else if(e==="delete_order")this.confirmDeleteOrder();else if(e==="order_complete")this.selected_action="order_status",this.completeOrder();else if(e==="order_cancel")this.selected_action="order_status",this.cancelOrder();else if(e==="order_processing")this.selected_action="order_status",this.backToProcessing();else if(e==="order_receipt")this.showModal=!1;else if(e==="generate_missing_licenses")this.generateMissingLicenses();else if(e==="refund_order")this.$emit("handlePaymentActions","refund");else if(e==="sync_order_statuses")this.syncOrderStatuses();else if(e.action==="order_edit")if(e.isEditingItem)this.$emit("disableItemEditing");else{if(this.shouldDisableEditing)return;this.$emit("enableItemEditing")}else this.showModal=!0},confirmDeleteOrder(){this.$confirm(u("Are you sure you want to delete this order? This action can not be undone!"),u("Confirm Deleting"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteOrder()})},deleteOrder(){this.deleting=!0,this.$del("orders/"+this.order.id).then(e=>{ln(e.message),this.$router.replace({name:"orders"})}).catch(e=>{e.status_code=="422"?q.validationErrors(e):q.error(e==null?void 0:e.data)}).finally(()=>{this.deleting=!1})},changeShipping(){this.showModal=!0},completeOrder(){this.$confirm(u("Are you sure you want to complete this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as complete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"completed"})})},generateMissingLicenses(){this.$confirm(u("Are you sure you want to generate missing licenses!"),u("Please confirm"),{confirmButtonText:u("Yes, Generate all missing licenses!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.generateLicenses()})},generateLicenses(){this.doing_actions=!0,this.$post("orders/"+this.order.id+"/generate-missing-licenses",{}).then(e=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},backToProcessing(){this.$confirm(u("Are you sure you want to revert back processing this order!"),u("Please confirm"),{confirmButtonText:u("Yes, Mark order as processing!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.updateOrderStatuses({order_status:"processing"})})},cancelOrder(){this.$confirm(u("Are you sure you want to change the order status to Cancel? This action is irreversible and cannot be undone."),u("Please confirm"),{confirmButtonText:u("Yes, Changed status to Cancel"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.manage_stock=!0,this.updateOrderStatuses({order_status:"canceled"})})},changeShippingStatus(){let e={};this.manage_stock=!0,e[this.selected_action]=this.status_data[this.selected_action],this.updateOrderStatuses(e)},updateOrderStatuses(e){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/statuses",{action:"change_"+this.selected_action,statuses:e,manage_stock:this.manage_stock}).then(t=>{q.success(t.message),this.$emit("reload")}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.doing_actions=!1,this.showModal=!1})},syncOrderStatuses(){this.doing_actions=!0,this.$put("orders/"+this.order.id+"/sync-statuses").then(e=>{q.success(e.message),this.$emit("reload")}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.doing_actions=!1})}}},cI={class:"fct-order-bulk-action-modal"},AI={key:1,class:"more-btn"},pI={key:0},fI=["href"],mI={class:"dialog-footer"};function hI(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),f=C("el-dropdown-item"),_=C("el-tooltip"),g=C("el-dropdown-menu"),y=C("el-dropdown"),v=C("el-option"),w=C("el-select"),k=C("el-form-item"),b=C("el-form"),S=C("el-dialog");return r(),h("div",cI,[n(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleCommandAction},{dropdown:d(()=>[n(g,null,{default:d(()=>{var $,D;return[a.trigger_action!=="add"?(r(),h("div",pI,[!s.isCancelled&&(($=a.order)==null?void 0:$.fulfillment_type)==="physical"?(r(),E(f,{key:0,command:"shipping_status"},{default:d(()=>[n(c,{name:"ShipmentStatus"}),R(" "+m(i.translate("Change Shipping Status")),1)]),_:1})):x("",!0),a.order.mode==="test"||s.isCancelled?(r(),E(f,{key:1,command:"delete_order",class:"item-destructive"},{default:d(()=>[n(c,{name:"Delete"}),R(" "+m(i.translate("Delete order")),1)]),_:1})):x("",!0),a.order.status==="processing"?(r(),E(f,{key:2,command:"order_complete"},{default:d(()=>[n(c,{name:"Check"}),R(" "+m(i.translate("Mark As Complete")),1)]),_:1})):x("",!0),s.isCancelled?x("",!0):(r(),E(f,{key:3,command:"order_cancel"},{default:d(()=>[n(c,{name:"Cross"}),R(" "+m(i.translate("Cancel Order")),1)]),_:1})),a.order.status==="completed"?(r(),E(f,{key:4,command:"order_processing"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+m(i.translate("Back to processing")),1)]),_:1})):x("",!0),!s.isCompleted&&!s.isCancelled?(r(),E(f,{key:5,command:"sync_order_statuses"},{default:d(()=>[n(c,{name:"Refresh"}),R(" "+m(i.translate("Sync Order Statuses")),1)]),_:1})):x("",!0),n(f,{command:"order_receipt",class:"item-link"},{default:d(()=>[o("a",{target:"_blank",href:a.order.receipt_url},[n(c,{name:"External"}),R(" "+m(i.translate("Receipt")),1)],8,fI)]),_:1}),(D=a.order)!=null&&D.has_missing_licenses?(r(),E(f,{key:6,command:"generate_missing_licenses"},{default:d(()=>[n(c,{name:"Files"}),R(" "+m(i.translate("Generate missing licenses")),1)]),_:1})):x("",!0),a.shouldShowRefund?(r(),E(f,{key:7,command:"refund_order",class:"bulk-action-only-mobile"},{default:d(()=>[n(c,{name:"Money"}),R(" "+m(i.translate("Refund")),1)]),_:1})):x("",!0),n(f,{command:{action:"order_edit",isEditingItem:a.isEditingItem},class:"bulk-action-only-mobile",disabled:s.shouldDisableEditing},{default:d(()=>[n(c,{name:"Edit"}),a.isEditingItem?(r(),h(P,{key:1},[R(m(i.translate("Disable Editing")),1)],64)):(r(),h(P,{key:0},[s.shouldDisableEditing?(r(),E(_,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(m(a.warningMessage),1)]),default:d(()=>[R(" "+m(i.translate("Edit")),1)]),_:1})):(r(),h(P,{key:1},[R(m(i.translate("Edit")),1)],64))],64))]),_:1},8,["command","disabled"])])):x("",!0)]}),_:1})]),default:d(()=>[a.triggerMode==="button"?(r(),E(p,{key:0},{default:d(()=>[R(m(i.translate("More Action"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})):(r(),h("span",AI,[n(c,{name:"More"})]))]),_:1},8,["onCommand"]),n(S,{modelValue:s.showModal,"onUpdate:modelValue":t[2]||(t[2]=$=>s.showModal=$),title:i.translate("Update Shipping Status")},{default:d(()=>[n(b,{data:s.status_data,"label-position":"top"},{default:d(()=>[s.selected_action==="shipping_status"||s.selected_action==="all"?(r(),E(k,{key:0,label:i.translate("Shipping Status")},{default:d(()=>[n(w,{modelValue:s.status_data.shipping_status,"onUpdate:modelValue":t[0]||(t[0]=$=>s.status_data.shipping_status=$),placeholder:i.translate("Select Shipping Status")},{default:d(()=>[(r(!0),h(P,null,te(e.appVars.shipping_statuses,($,D)=>(r(),E(v,{key:D,label:$,value:D},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),o("span",mI,[n(p,{onClick:t[1]||(t[1]=$=>i.changeShippingStatus()),type:"primary"},{default:d(()=>[R(m(i.translate("Update")),1)]),_:1})])]),_:1},8,["modelValue","title"])])}const Ed=nt(uI,[["render",hI]]),_I={name:"Transaction",computed:{Str(){return da}},components:{ConvertedTime:Pa,ArrowDown:Gc(Hn),Check:Xc,Badge:fa,DynamicIcon:Y},props:["transactions","transaction","header","transaction_data","order_id","orderCurrency"],emits:["reload"],data(){return{visible:!1,doing_action:!1,disputeHandleModal:!1,disputeForm:{dispute_note:""},disputeTransaction:null,loadingDisputeAction:!1,syncing_transaction:null}},methods:{translate:u,getCardBrand:dA,translateNumber:sa,handleDispute(e){this.disputeHandleModal=!0,this.disputeTransaction=e},handleDisputeSubmit(e){this.loadingDisputeAction=!0,this.$post("orders/"+this.order_id+"/transactions/"+this.disputeTransaction.id+"/accept-dispute",{dispute_note:this.disputeForm.dispute_note}).then(t=>{this.$notify.success(t.message),this.$emit("reload"),this.disputeHandleModal=!1}).catch(t=>{this.$notify.error(t.message)}).finally(()=>{this.disputeHandleModal=!1,this.loadingDisputeAction=!1})},hasDisputedTransaction(e){return e.some(t=>t.transaction_type=="dispute"&&t.status=="succeeded")},hasSyncableTransaction(e){return e.some(t=>t.transaction_type=="charge"&&t.status=="pending"&&t.vendor_charge_id)},syncTransaction(e){this.syncing_transaction||(this.syncing_transaction=e.id,this.$post("orders/"+this.order_id+"/transactions/"+e.id+"/sync").then(t=>{this.$notify.success(t.message),this.$emit("reload")}).catch(t=>{var a;this.$notify.error(((a=t==null?void 0:t.data)==null?void 0:a.message)||u("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},vI={key:0,class:"fct-transaction-details -mt-[1px]"},gI={class:"fct-table-wrap"},yI={class:"p-0 m-0 text-xs text-gray-500"},bI={key:0},wI=["href"],CI={class:"flex items-center gap-2.5"},kI={key:0,class:"w-7"},BI=["title","src","alt"],xI={key:1,class:"capitalize"},SI={key:2},FI={class:"p-0 m-0 text-xs text-gray-500"},$I={key:1},EI={class:"text-sm"},UI={class:"text-sm text-gray-700"},II={class:"text-sm flex gap-2"},QI=["href"];function DI(e,t,a,l,s,i){var $,D;const c=C("ConvertedTime"),p=C("el-table-column"),f=C("Badge"),_=C("el-tooltip"),g=C("el-button"),y=C("DynamicIcon"),v=C("el-table"),w=C("el-form-item"),k=C("el-input"),b=C("el-form"),S=C("el-dialog");return a.transactions.length>0?(r(),h("div",vI,[o("div",gI,[n(v,{data:a.transactions,class:"w-full"},{default:d(()=>[n(p,{label:i.translate("# Date"),width:"auto"},{default:d(F=>{var B,U;return[o("div",null,[o("p",yI,"#"+m(i.translateNumber(F.row.id)),1),n(c,{"date-time":((U=(B=F.row)==null?void 0:B.meta)==null?void 0:U.settled_at)||F.row.created_at},null,8,["date-time"])])]}),_:1},8,["label"]),n(p,{label:i.translate("Gateway ID"),width:"160"},{default:d(F=>[F.row.vendor_charge_id==""?(r(),h("span",bI,"--")):(r(),h("a",{key:1,class:"text-primary-500 dark:text-gray-50 link",target:"_blank",href:F.row.url},m(F.row.vendor_charge_id),9,wI))]),_:1},8,["label"]),n(p,{label:i.translate("Payment Method"),width:"140"},{default:d(F=>[o("div",CI,[i.getCardBrand(F.row.card_brand,F.row.payment_method_type)?(r(),h("div",kI,[o("img",{class:"w-full",title:F.row.payment_method,src:i.getCardBrand(F.row.card_brand,F.row.payment_method_type),alt:F.row.card_brand},null,8,BI)])):(r(),h("span",xI,m(F.row.payment_method_type),1)),F.row.card_last_4&&F.row.card_last_4!="0"?(r(),h("span",SI,m("..."+F.row.card_last_4),1)):x("",!0)])]),_:1},8,["label"]),n(p,{label:i.translate("Total"),width:"auto"},{default:d(F=>{var B,U;return[((U=(B=F.row)==null?void 0:B.meta)==null?void 0:U.mor_vat_removed)>0?(r(),h(P,{key:0},[o("span",null,m(e.formatNumberForOrder(F.row.total-F.row.meta.mor_vat_removed,a.orderCurrency)),1),o("p",FI,m(i.translate("Tax reversed"))+": "+m(e.formatNumberForOrder(F.row.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h("span",$I,m(e.formatNumberForOrder(F.row.total,a.orderCurrency)),1))]}),_:1},8,["label"]),n(p,{label:i.translate("Status"),width:"120"},{default:d(F=>{var B,U,Q,V,I,M;return[F.row.transaction_type=="dispute"?(r(),E(_,{key:0,effect:"dark",placement:"top",content:"Transaction dispute, please resolve it from action menu. Reason: "+((U=(B=F.row)==null?void 0:B.meta)==null?void 0:U.dispute_reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>[n(f,{class:"m-2 b-red",status:"dispute"},{default:d(()=>t[3]||(t[3]=[R(" Dispute ",-1)])),_:1,__:[3]})]),_:2},1032,["content"])):x("",!0),(V=(Q=F.row)==null?void 0:Q.meta)!=null&&V.reason?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate((M=(I=F.row)==null?void 0:I.meta)==null?void 0:M.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var O,L,H,j;return[((L=(O=F.row)==null?void 0:O.meta)==null?void 0:L.disputed)=="yes"&&((j=(H=F.row)==null?void 0:H.meta)==null?void 0:j.dispute_resolved)=="no"?(r(),E(f,{key:0,status:F.row.status},{default:d(()=>{var W;return[R(m(F.row.status)+" "+m((W=F==null?void 0:F.row)==null?void 0:W.transaction_type),1)]}),_:2},1032,["status"])):(r(),E(f,{key:1,status:F.row.status},{default:d(()=>[R(m(F.row.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(f,{key:2,status:F.row.status},{default:d(()=>[R(m(F.row.status),1)]),_:2},1032,["status"]))]}),_:1},8,["label"]),i.hasDisputedTransaction(a.transactions)||i.hasSyncableTransaction(a.transactions)?(r(),E(p,{key:0,label:i.translate("Actions"),width:"140"},{default:d(F=>[F.row.transaction_type=="dispute"&&F.row.status=="succeeded"?(r(),E(g,{key:0,type:"warning",size:"small",onClick:B=>i.handleDispute(F.row)},{default:d(()=>[R(m(i.translate("Handle dispute")),1)]),_:2},1032,["onClick"])):x("",!0),F.row.transaction_type=="charge"&&F.row.status=="pending"&&F.row.vendor_charge_id?(r(),E(_,{key:1,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",F.row.payment_method),"popper-class":"fct-tooltip"},{default:d(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",F.row.payment_method),loading:s.syncing_transaction===F.row.id,onClick:B=>i.syncTransaction(F.row)},{default:d(()=>[n(y,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]),n(S,{modelValue:s.disputeHandleModal,"onUpdate:modelValue":t[2]||(t[2]=F=>s.disputeHandleModal=F),title:"Handle Dispute #"+((D=($=s.disputeTransaction)==null?void 0:$.meta)==null?void 0:D.dispute_id),width:"800px"},{footer:d(()=>{var F,B,U,Q,V,I;return[o("a",{href:(F=s.disputeTransaction)==null?void 0:F.url,target:"_blank",class:"el-button el-button--warning is-link"},m(i.translate("See dispute on ")+((B=s.disputeTransaction)==null?void 0:B.payment_method)),9,QI),(Q=(U=s.disputeTransaction)==null?void 0:U.meta)!=null&&Q.is_charge_refundable?(r(),E(g,{key:0,type:"primary",onClick:t[1]||(t[1]=()=>e.$emit("triggerRefundModal")),loading:s.loadingDisputeAction},{default:d(()=>[R(m(i.translate("Refund customer")),1)]),_:1},8,["loading"])):x("",!0),(I=(V=s.disputeTransaction)==null?void 0:V.meta)!=null&&I.is_dispute_actionable?(r(),E(g,{key:1,type:"primary",onClick:i.handleDisputeSubmit,loading:s.loadingDisputeAction},{default:d(()=>[R(m(i.translate("Accept Dispute")),1)]),_:1},8,["onClick","loading"])):x("",!0)]}),default:d(()=>{var F,B,U,Q,V,I;return[(B=(F=s.disputeTransaction)==null?void 0:F.meta)!=null&&B.dispute_reason?(r(),E(w,{key:0},{default:d(()=>{var M,O;return[o("div",EI," Dispute Reason: "+m((O=(M=s.disputeTransaction)==null?void 0:M.meta)==null?void 0:O.dispute_reason),1)]}),_:1})):x("",!0),n(w,null,{default:d(()=>[o("div",UI,m(i.translate("You may either counter the dispute by providing evidence to prove that the cardholder is the legitimate purchaser, or you can accept this dispute immediately to refund the cardholder and close the dispute.")),1)]),_:1}),(Q=(U=s.disputeTransaction)==null?void 0:U.meta)!=null&&Q.is_dispute_actionable?(r(),E(b,{key:1,model:s.disputeForm,"label-position":"top"},{default:d(()=>[n(w,{label:i.translate("Note"),prop:"dispute_note"},{default:d(()=>[n(k,{modelValue:s.disputeForm.dispute_note,"onUpdate:modelValue":t[0]||(t[0]=M=>s.disputeForm.dispute_note=M),placeholder:"(optional)",type:"text"},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])):x("",!0),(I=(V=s.disputeTransaction)==null?void 0:V.meta)!=null&&I.is_charge_refundable?(r(),E(w,{key:2},{default:d(()=>[o("div",II,[n(y,{class:"w-6 h-6",name:"Information"}),R(" "+m(i.translate("This dispute has refundable action, so you may refund the charge to the customer for a dispute resolution.")),1)])]),_:1})):x("",!0)]}),_:1},8,["modelValue","title"])])):x("",!0)}const Ud=nt(_I,[["render",DI]]),Id=(e,t,a=0)=>{let l=0,s=0;return t&&(e.manual_discount_total=0),e.order_items&&e.order_items.forEach((i,c)=>{let p=i.updateStock||0;i.quantity<1?i.quantity=1:p!=0&&parseInt(i.quantity)>p&&(i.quantity=p),i.total=i.unit_price*i.quantity;let f=i.unit_price*i.quantity;if(i.subtotal=f-(parseInt(i.cost)||0),e.manual_discount_total>0?i.discount_total=i.discount_total:t===!0?s+=i.discount_total:(!e.manual_discount_total===0?e.manual_discount_total-=i.discount_total:e.manual_discount_total=0,i.discount_total=0),i.line_total=f-i.discount_total,l+=f,i.payment_type=="subscription"&&i.other_info.manage_setup_fee=="yes"){let _=parseInt(i.other_info.signup_fee);i.other_info.setup_fee_per_item=="yes"&&(_=_*i.quantity),l+=_}}),e.subtotal=l,e.coupon_discount_total=s,(e.subtotal<=0||e.subtotal<=e.manual_discount_total)&&(e.manual_discount_total=e.coupon_discount_total=e.shipping_tax=e.shipping_total=e.tax_total=0),VI(e),e},ic=(e,t)=>{if(t.value<0)return e;let a=t.value?Math.round(t.value*100):0;t.label="",t.type==="percentage"&&(a=e.subtotal*t.value/100),Wp(t),a=parseInt(a),a>=0&&a<=parseInt(e.subtotal)&&(e.manual_discount_total=a);let l=e.subtotal*1+e.tax_total*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total;return l>=0&&(e.total_amount=l),e},VI=e=>(e.total_amount=e.subtotal*1+e.tax_total*1+e.shipping_tax*1+e.shipping_total*1-e.manual_discount_total-e.coupon_discount_total,e),Wp=e=>(e.type==="percentage"&&(e.label="(-"+e.value+"%)"),e),TI={name:"NoteModal",props:["note"],data(){return{notes:this.note}},watch:{note:{handler:function(e,t){this.notes=e},deep:!0}},mounted(){},methods:{saveNote(){this.$emit("whenNoteEditIsDone",this.notes,!1)},closeModal(){this.$emit("closeModal")}}},MI={class:"fct-note-modal"},LI={class:"dialog-footer"};function RI(e,t,a,l,s,i){const c=C("el-input"),p=C("el-form-item"),f=C("el-form"),_=C("el-button");return r(),h("div",MI,[n(f,{"label-position":"top"},{default:d(()=>[n(p,null,{default:d(()=>[n(c,{modelValue:s.notes,"onUpdate:modelValue":t[0]||(t[0]=g=>s.notes=g),autosize:{minRows:4},type:"textarea",minlength:"1",maxlength:"5000","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),o("div",LI,[n(_,{type:"info",soft:"",onClick:i.closeModal},{default:d(()=>[R(m(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(_,{type:"primary",onClick:i.saveNote},{default:d(()=>[R(m(e.$t("Save")),1)]),_:1},8,["onClick"])])])}const Jp=nt(TI,[["render",RI]]),OI={class:"fct-admin-sidebar-item"},PI={key:0},HI={name:"Notes",components:{IconButton:at,NoteModal:Jp,DynamicIcon:Y},props:{note:{type:String,default:""},shouldEnableEditing:{type:Boolean,default:!0},orderId:{type:[String,Number]}},data(){return{noteModalIsOpen:!1,isNoteExpanded:!1,noteCopy:this.note,loading:!1}},computed:{noteNeedsCollapse(){var e;return((e=this.noteCopy)==null?void 0:e.length)>355},noteTextToDisplay(){return this.isNoteExpanded||!this.noteNeedsCollapse?this.noteCopy:this.noteCopy.substring(0,355)+"..."}},watch:{note:{handler(e,t){this.noteCopy=e},deep:!0,immediate:!0}},mounted(){},methods:{saveNoteModal(e,t){this.loading=!0,this.noteModalIsOpen=t,this.$emit("whenNoteEditIsDone",e),this.orderId&&this.$post("notes/attach",{order_id:this.orderId,note:e}).then(a=>{q.success(a.message),this.noteCopy=e}).catch(a=>{q.error(a.message)}).finally(()=>{this.loading=!1})},toggleNoteText(){this.isNoteExpanded=!this.isNoteExpanded}}},Fi=Object.assign(HI,{setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-button"),c=C("el-dialog");return r(),h("div",null,[e.orderId?(r(),E(Se,{key:0},{default:d(()=>[n(Ve,{title:t.$t("Notes"),border_bottom:"",title_size:"small"},{action:d(()=>[e.shouldEnableEditing?(r(),E(at,{key:0,size:"x-small",bg:"transparent",tag:"button",border:"transparent",onClick:a[0]||(a[0]=p=>t.noteModalIsOpen=!0)},{default:d(()=>[n(Y,{name:"Edit"})]),_:1})):x("",!0)]),_:1},8,["title"]),n(ke,{class:de(t.noteNeedsCollapse?"pb-0":"")},{default:d(()=>[o("div",OI,[t.loading?(r(),E(s,{key:0,animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})):(r(),h(P,{key:1},[o("span",null,m(t.noteCopy?t.noteTextToDisplay:t.$t("No notes")),1),t.noteNeedsCollapse?(r(),E(i,{key:0,class:"fct-show-more-button",onClick:t.toggleNoteText,text:""},{default:d(()=>[t.isNoteExpanded?(r(),h(P,{key:0},[R(m(t.$t("Show less"))+" ",1),n(Y,{name:"ChevronUp"})],64)):(r(),h(P,{key:1},[R(m(t.$t("Show more"))+" ",1),n(Y,{name:"ChevronDown"})],64))]),_:1},8,["onClick"])):x("",!0)],64))])]),_:1},8,["class"])]),_:1})):x("",!0),n(c,{"append-to-body":!0,width:"45%",modelValue:t.noteModalIsOpen,"onUpdate:modelValue":a[2]||(a[2]=p=>t.noteModalIsOpen=p),title:t.noteCopy?t.$t("Edit Note"):t.$t("Add Note")},{default:d(()=>[t.noteModalIsOpen?(r(),h("div",PI,[n(Jp,{note:t.noteCopy,onWhenNoteEditIsDone:t.saveNoteModal,onCloseModal:a[1]||(a[1]=p=>t.noteModalIsOpen=!1)},null,8,["note","onWhenNoteEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])])}}}),NI={name:"Coupon",components:{IconButton:at,DynamicIcon:Y},props:{order:{type:Object,default:()=>({})},appliedCouponsAttributes:{type:Array,default:()=>[]},hasCouponAttributes:{type:Boolean,default:!1},couponsAttributes:{type:Array,default:()=>[]},action:{type:String,default:""},shouldManageCoupon:{type:Boolean,default:!0}},data(){return{appliedCoupons:[...this.appliedCouponsAttributes],hasCoupon:this.hasCouponAttributes,availableCoupons:[],newCoupon:"",coupons:[...this.couponsAttributes]}},mounted(){},methods:{translate:u,searchCoupon(e,t){this.fetchCoupon(e,t)},fetchCoupon(e="",t=()=>{}){this.$get("coupons",{search:e,select:"code",scopes:["active"]}).then(a=>{var i;const l=(i=a.coupons)==null?void 0:i.data;this.availableCoupons=l.map(c=>c.code);const s=this.availableCoupons.filter(c=>c.toLowerCase().includes(e.toLowerCase())).map(c=>({value:c}));t(s)}).catch(a=>{var l;a.status_code=="422"?q.validationErrors(a):q.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},applyCoupon(){if(this.coupons&&this.coupons.find(e=>e.code===this.newCoupon)){q.error(this.translate("Coupon already applied"));return}this.$post("coupons/apply",{coupon_code:this.newCoupon,order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e),this.newCoupon=""}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)})},cancelCoupon(e,t){this.$post("coupons/cancel",{id:t.id,coupon_code:t.code,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons,order_items:this.order.order_items}).then(a=>{this.processCoupon(a)}).catch(a=>{var l;a.status_code=="422"?q.validationErrors(a):q.error((l=a.data)==null?void 0:l.message)}).finally(()=>{})},reApplyCoupon(){this.$post("coupons/re-apply",{order_items:this.order.order_items,order_uuid:this.order.uuid,applied_coupons:this.appliedCoupons}).then(e=>{this.processCoupon(e)}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},processCoupon(e){this.coupons=[],this.appliedCoupons=[];for(let s in e.applied_coupons)this.coupons.push({id:e.applied_coupons[s].id,code:s,amount:e.applied_coupons[s].discount}),this.appliedCoupons.push(e.applied_coupons[s].id);let t=0,a=0;const l=Object.values(e.calculated_items);this.order.order_items.forEach((s,i)=>{const c=l.find(p=>p.id==s.object_id||p.id==s.id);c!=null&&(this.order.order_items[i].price=c.price,this.order.order_items[i].unit_price=c.unit_price,this.order.order_items[i].line_total=c.unit_price*c.quantity-c.discount_total,t+=this.order.order_items[i].line_total,a+=c.discount_total,this.order.order_items[i].line_total_formatted=c.line_total_formatted,this.order.order_items[i].discount_total=c.discount_total,this.order.order_items[i].coupon_discount=c.coupon_discount||0,this.order.order_items[i].line_meta&&(this.order.order_items[i].line_meta.coupon_discount=c.coupon_discount||0))}),this.order.applied_coupon=e.applied_coupons,this.hasCoupon=this.coupons.length>0,Id(this.order,this.hasCoupon,a),this.$emit("update:coupons",this.coupons,this.appliedCoupons,this.hasCoupon)}}},KI={colspan:"3"},GI={class:"fct-add-coupon-wrap"},zI={key:0,class:"fct-add-coupon-input-label"},jI={key:1,class:"fct-add-coupon-input-label"},qI={key:2,class:"fct-add-coupon-input-wrap"},YI={class:"flex gap-0.5 items-center"};function WI(e,t,a,l,s,i){const c=C("el-autocomplete"),p=C("el-button"),f=C("el-alert"),_=C("DynamicIcon"),g=C("IconButton"),y=C("el-popconfirm");return r(),h(P,null,[o("tr",null,[o("td",KI,[o("div",GI,[a.action==="create_order"?(r(),h("div",zI,m(e.$t("Have a Coupon?")),1)):(r(),h("div",jI,m(a.shouldManageCoupon?e.$t("Have a Coupon?"):s.hasCoupon?e.$t("Coupons"):e.$t("")),1)),a.shouldManageCoupon?(r(),h("div",qI,[n(c,{modelValue:s.newCoupon,"onUpdate:modelValue":t[0]||(t[0]=v=>s.newCoupon=v),"fetch-suggestions":i.searchCoupon,"trigger-on-focus":!1,clearable:"",class:"w-full",placeholder:e.$t("Enter coupon code")},null,8,["modelValue","fetch-suggestions","placeholder"]),n(p,{onClick:i.applyCoupon,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["onClick"])])):x("",!0),!s.hasCoupon&&a.shouldManageCoupon?(r(),E(f,{key:3,title:e.$t("If you apply coupon, regular discounts for this order will be removed."),type:"warning","show-icon":""},null,8,["title"])):x("",!0),t[1]||(t[1]=o("span",null,null,-1))])])]),(r(!0),h(P,null,te(s.coupons,v=>(r(),h("tr",{key:v.id,class:"fct-coupons-applied-row"},[o("td",null,[o("div",YI,[o("span",null,m(v.code),1),a.action==="create_order"?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(w=>i.cancelCoupon(v.id,v),["prevent"]),class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),a.action==="edit_order"?(r(),E(y,{key:1,icon:"InfoFilled","icon-color":"#626AEF",title:i.translate("Are you sure to cancel this coupon? This action is not recoverable"),onConfirm:w=>i.cancelCoupon(v.id,v),width:"250"},{reference:d(()=>[a.shouldManageCoupon?(r(),E(g,{key:0,bg:"transparent",border:"transparent",tag:"a",size:"x-small",class:"coupon-delete-btn"},{default:d(()=>[n(_,{name:"Delete"})]),_:1})):x("",!0)]),_:2},1032,["title","onConfirm"])):x("",!0)])]),t[2]||(t[2]=o("td",null,null,-1)),o("td",null,"- "+m(e.formatNumberForOrder(v.amount,a.order)),1)]))),128))],64)}const $i=nt(NI,[["render",WI]]),JI={name:"DiscountModal",props:["discount","showModal","totalAmount"],setup(e,{emit:t}){const a=Zs({...e.discount}),l=T([{label:u("Amount"),value:"amount"}]),s=T("");return{discountOptions:l,applyDiscount:()=>{const f=parseInt(a.value);isNaN(f)||f<1?a.value=1:t("whenDiscountEditIsDone",!1,{...a})},cancelDiscount:()=>{t("emitCancelDiscountModal")},initialDiscount:a,isDisabledApplyButton:()=>{s.value="";const f=parseInt(a.value);let _=f||0;const g=e.totalAmount/100;return a.type=="percentage"?(_=g*f/100,(f>100||_>g)&&(s.value=u("Discount should not exceed the full product price (100%).")),isNaN(f)||f<1||f>100):(_>g&&(s.value=u("Discount should not exceed the full product price (%s).",Vm(g))),isNaN(f)||f<1||_>g)},error:s}}},XI={class:"fct-discount-modal"},ZI=["innerHTML"],e6={key:1},t6={style:{color:"red"}},a6={class:"form-note"},l6={class:"dialog-footer"};function s6(e,t,a,l,s,i){const c=C("el-option"),p=C("el-select"),f=C("el-form-item"),_=C("el-col"),g=C("el-input"),y=C("el-row"),v=C("el-form"),w=C("el-button");return r(),h("div",XI,[n(v,{"label-position":"top"},{default:d(()=>[n(y,{gutter:20},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Discount type")},{default:d(()=>[n(p,{modelValue:l.initialDiscount.type,"onUpdate:modelValue":t[0]||(t[0]=k=>l.initialDiscount.type=k),placeholder:e.$t("Select"),onChange:t[1]||(t[1]=k=>{l.error=""})},{default:d(()=>[(r(!0),h(P,null,te(l.discountOptions,k=>(r(),E(c,{key:k.value,label:k.label,value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Discount value")},{default:d(()=>[n(g,{type:"number",min:1,modelValue:l.initialDiscount.value,"onUpdate:modelValue":t[2]||(t[2]=k=>l.initialDiscount.value=k),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[l.initialDiscount.type==="amount"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,ZI)):(r(),h("span",e6,"%"))]),_:1},8,["modelValue","onKeyup"]),o("span",t6,m(l.error),1)]),_:1},8,["label"])]),_:1})]),_:1}),n(y,null,{default:d(()=>[n(_,{md:24,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Reason for discount")},{default:d(()=>[n(g,{modelValue:l.initialDiscount.reason,"onUpdate:modelValue":t[3]||(t[3]=k=>l.initialDiscount.reason=k),minlength:"1",maxlength:"255","show-word-limit":""},null,8,["modelValue"]),o("div",a6,[o("p",null,m(e.$t("Customer can see this reason")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1}),o("div",l6,[n(w,{type:"info",onClick:l.cancelDiscount,soft:""},{default:d(()=>[R(m(e.$t("Cancel")),1)]),_:1},8,["onClick"]),n(w,{type:"primary",disabled:l.isDisabledApplyButton(),onClick:l.applyDiscount},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["disabled","onClick"])])])}const n6=nt(JI,[["render",s6]]),o6={name:"CustomDiscount",components:{IconButton:at,DynamicIcon:Y,DiscountModal:n6},props:{order:{type:Object,default:()=>({})},discountAttributes:{type:Object,default:()=>({type:"amount",label:"",reason:""})},hasCoupon:{type:Boolean,default:!1},shouldEnableEditing:{type:Boolean,default:!0}},data(){return{discountModalIsOpen:!1,discount:this.discountAttributes}},mounted(){},methods:{translate:u,isOnlyProrateCredit(){const e=this.order.config&&this.order.config.prorate_credit||0;return e>0&&this.order.manual_discount_total-e<=0},getDiscountButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?this.isOnlyProrateCredit()?u("Prorate Credit"):u("Discount"):this.order.manual_discount_total!==0?u("Edit Discount"):u("Add Discount")},manageDiscount(){this.discount.action=parseInt(this.order.manual_discount_total)>0?"edit":"add",this.shouldEnableEditing&&!this.hasCoupon&&this.order.order_items.length>0&&(this.discountModalIsOpen=!0)},removeDiscount(){this.discount={},ic(this.order,this.discount),this.$emit("update:custom-discount",this.discount)},applyDiscount(e,t){this.discount=t,ic(this.order,this.discount),this.discountModalIsOpen=e,this.$emit("update:custom-discount",this.discount)}}},i6={key:0},r6={key:1},d6={key:2},u6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},c6={style:{"padding-left":"16px"}},A6={style:{"font-size":"12px",color:"rgb(107,114,128)"}},p6={style:{"padding-left":"16px"}},f6={key:0};function m6(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("DiscountModal"),f=C("el-dialog");return r(),h(P,null,[a.order.manual_discount_total>0||a.order.manual_discount_total===0&&a.shouldEnableEditing?(r(),h("tr",i6,[o("td",null,[a.shouldEnableEditing&&!a.hasCoupon&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(_=>i.manageDiscount(),["prevent"]))},[R(m(i.getDiscountButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",r6,m(i.getDiscountButtonLabel()),1)),s.discount.label?(r(),h("span",d6,m(s.discount.label),1)):x("",!0),a.order.manual_discount_total&&a.shouldEnableEditing?(r(),h(P,{key:3},[t[4]||(t[4]=R(" | ",-1)),o("a",{href:"#",onClick:t[1]||(t[1]=Ge(_=>i.removeDiscount(),["prevent"]))},m(i.translate("Remove Discount")),1)],64)):x("",!0)]),o("td",null,m(s.discount.reason?s.discount.reason:"__"),1),o("td",null,[o("span",null,"- "+m(e.formatNumberForOrder(a.order.manual_discount_total,a.order)),1)])])):x("",!0),a.order.config&&a.order.config.prorate_credit>0&&a.order.manual_discount_total-a.order.config.prorate_credit>0?(r(),h(P,{key:1},[o("tr",u6,[o("td",c6,m(i.translate("Upgrade Discount")),1),t[5]||(t[5]=o("td",null,null,-1)),o("td",null,m(e.formatNumberForOrder(a.order.manual_discount_total-a.order.config.prorate_credit,a.order)),1)]),o("tr",A6,[o("td",p6,m(i.translate("Prorate Credit")),1),t[6]||(t[6]=o("td",null,null,-1)),o("td",null,m(e.formatNumberForOrder(a.order.config.prorate_credit,a.order)),1)])],64)):x("",!0),n(f,{"append-to-body":!0,width:"50%",modelValue:s.discountModalIsOpen,"onUpdate:modelValue":t[3]||(t[3]=_=>s.discountModalIsOpen=_),title:a.order.manual_discount_total===0?i.translate("Add discount"):i.translate("Edit discount")},{default:d(()=>[s.discountModalIsOpen?(r(),h("div",f6,[n(p,{discount:s.discount,totalAmount:a.order.subtotal,onWhenDiscountEditIsDone:i.applyDiscount,onEmitCancelDiscountModal:t[2]||(t[2]=_=>s.discountModalIsOpen=!1)},null,8,["discount","totalAmount","onWhenDiscountEditIsDone"])])):x("",!0)]),_:1},8,["modelValue","title"])],64)}const Ei=nt(o6,[["render",m6]]),h6={name:"ShippingModal",props:["shipping","shipping_type"],setup(e,{emit:t}){const a=T(e.shipping_type);return{availableOptions:T([{label:"Custom",value:"custom"}]),updatingIsDone:()=>parseInt(e.shipping.custom_price)<0?e.shipping.custom_price=0:(parseInt(e.shipping.custom_price)==0&&(e.shipping.custom_price=0),e.shipping.rate_name=e.shipping.rate_name==""||e.shipping.rate_name==null?"Custom":e.shipping.rate_name,e.shipping.type=a.value,t("whenShippingEditIsDone",!1)),removeShipping:()=>{e.shipping.type="",e.shipping.custom_price="",e.shipping.rate_name="",t("whenShippingEditIsDone",!1)},isDisabledApplyButton:()=>{const p=parseInt(e.shipping.custom_price);return isNaN(p)||p<0},shippingType:a}}},_6={class:"fct-shipping-modal"},v6=["innerHTML"],g6={class:"dialog-footer"};function y6(e,t,a,l,s,i){const c=C("el-radio"),p=C("el-radio-group"),f=C("el-form-item"),_=C("el-col"),g=C("el-row"),y=C("el-input"),v=C("el-form"),w=C("el-button");return r(),h("div",_6,[n(v,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(g,{gutter:20},{default:d(()=>[n(_,{md:24,sm:24,xs:24},{default:d(()=>[n(f,{label:e.$t(""),required:""},{default:d(()=>[n(p,{modelValue:l.shippingType,"onUpdate:modelValue":t[0]||(t[0]=k=>l.shippingType=k)},{default:d(()=>[(r(!0),h(P,null,te(l.availableOptions,(k,b)=>(r(),E(c,{label:k.value,key:b},{default:d(()=>[R(m(k.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),l.shippingType==="custom"?(r(),E(g,{key:0,gutter:15},{default:d(()=>[n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Name")},{default:d(()=>[n(y,{type:"text",modelValue:a.shipping.rate_name,"onUpdate:modelValue":t[1]||(t[1]=k=>a.shipping.rate_name=k)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(_,{md:12,sm:12,xs:24},{default:d(()=>[n(f,{label:e.$t("Price")},{default:d(()=>[n(y,{type:"number",min:1,modelValue:a.shipping.custom_price,"onUpdate:modelValue":t[2]||(t[2]=k=>a.shipping.custom_price=k),modelModifiers:{number:!0},onKeyup:l.isDisabledApplyButton},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,v6)]),_:1},8,["modelValue","onKeyup"])]),_:1},8,["label"])]),_:1})]),_:1})):x("",!0)]),_:1}),o("div",g6,[a.shipping.type?(r(),E(w,{key:0,type:"danger",onClick:l.removeShipping},{default:d(()=>[R(m(e.$t("Remove Shipping")),1)]),_:1},8,["onClick"])):x("",!0),n(w,{type:"primary",onClick:l.updatingIsDone,disabled:l.isDisabledApplyButton()},{default:d(()=>[R(m(e.$t("Apply")),1)]),_:1},8,["onClick","disabled"])])])}const b6=nt(h6,[["render",y6]]),w6={name:"Shipping",components:{IconButton:at,DynamicIcon:Y,ShippingModal:b6},props:{order:{type:Object,default:()=>({})},shippingAttributes:{type:Object,default:()=>({id:""})},shouldEnableEditing:{type:Boolean,default:!0},shippingMethodsProps:{type:Array,default:()=>[]},otherShippingMethodsProps:{type:Array,default:()=>[]}},data(){return{shippingModalIsOpen:!1,shipping:this.shippingAttributes,shippingMethods:this.shippingMethodsProps,otherShippingMethods:this.otherShippingMethodsProps,total_shipping:this.order.shipping_total/100}},computed:{currency(){const e=ze.get("currency_signs",{}),t=ze.get("shop.currency_sign","$");return this.order&&this.order.currency&&e[this.order.currency]?e[this.order.currency]:t},shippingTitle(){return this.getShippingTitle()}},watch:{shippingMethodsProps:{handler:function(e,t){this.shippingMethods=e},deep:!0},otherShippingMethodsProps:{handler:function(e,t){this.otherShippingMethods=e},deep:!0},order:{handler:function(e,t){this.total_shipping=e.shipping_total/100},deep:!0}},mounted(){},methods:{translate:u,showShippingModal(){this.shippingModalIsOpen=!0},hasFreeShipping(){return Object.keys(this.shipping).length>0&&parseInt(this.shipping.custom_price)==0},getShippingButtonLabel(){return!this.shouldEnableEditing&&this.order.order_items.length>0?u("Shipping"):this.shipping.id!==0?u("Edit Shipping"):u("Add Shipping")},getShippingTitle(){const e=this.order&&this.order.checkout_shipping&&this.order.checkout_shipping.method_title?this.order.checkout_shipping.method_title:"";if(!this.shipping.id)return e;const t=this.shipping.id,l=this.shippingMethods.concat(this.otherShippingMethods).find(function(s){return s.id==t});return l?l.title:e},updateShipping(){this.shippingModalIsOpen=!1;const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),Ae.post("orders/calculate-shipping",{shipping_id:this.shipping.id,order_items:e}).then(t=>{this.order.shipping_total=t.shipping_charge;const a={order_items:t.order_items,shipping_total:t.shipping_charge};this.total_shipping=this.order.shipping_total/100,this.$emit("update:shipping",a.order_items,a.shipping_total,this.shipping)}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.shippingModalIsOpen=!1})},getShippingMethodsNotFoundMessage(){const e=this.$router.resolve({name:"shipping"}).href;return u("No shipping methods found. You can add shipping methods from %1$s here %2$s",`<a href="${e}" target="_blank" class="link-text">`,"</a>")}}},C6={key:1},k6={key:2,class:"text-xs text-system-mid dark:text-gray-300 mt-0.5"},B6={key:0},x6={key:1,class:"max-w-[120px] block ml-auto text-right"},S6={key:2},F6={key:0},$6={key:0,class:"fct-shipping-methods-list-wrap"},E6={key:0,class:"charge"},U6={key:1,class:"fct-other-shipping-methods-list-wrap"},I6={key:0,class:"charge"},Q6={key:1,class:"fct-no-shipping-methods-found"},D6=["innerHTML"];function V6(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-input"),f=C("el-radio"),_=C("el-radio-group"),g=C("el-button"),y=C("el-dialog");return r(),h(P,null,[o("tr",null,[o("td",null,[a.shouldEnableEditing&&a.order.order_items.length>0?(r(),h("a",{key:0,href:"#",onClick:t[0]||(t[0]=Ge(v=>i.showShippingModal(),["prevent"]))},[R(m(i.getShippingButtonLabel())+" ",1),n(c,{name:"External"})])):(r(),h("span",C6,m(i.getShippingButtonLabel()),1)),i.shippingTitle?(r(),h("div",k6,m(i.shippingTitle),1)):x("",!0)]),t[7]||(t[7]=o("td",null,null,-1)),o("td",null,[i.hasFreeShipping()?(r(),h("span",B6,[o("del",null,m(e.formatNumberForOrder(a.order.shipping_total,a.order)),1),R(" "+m(i.translate("Free")),1)])):x("",!0),a.shouldEnableEditing&&!i.hasFreeShipping()?(r(),h("span",x6,[n(p,{modelValue:s.total_shipping,"onUpdate:modelValue":t[1]||(t[1]=v=>s.total_shipping=v),onChange:t[2]||(t[2]=v=>{a.order.shipping_total=v*100}),type:"number"},{prefix:d(()=>[R(m(i.currency),1)]),_:1},8,["modelValue"])])):(r(),h("span",S6,m(e.formatNumberForOrder(a.order.shipping_total-(a.order.tax_summary&&a.order.tax_summary.rcShippingAdjustment?a.order.tax_summary.rcShippingAdjustment:0),a.order)),1))])]),n(y,{"append-to-body":!0,width:"50%",modelValue:s.shippingModalIsOpen,"onUpdate:modelValue":t[6]||(t[6]=v=>s.shippingModalIsOpen=v),title:e.$t("Shipping and delivery options")},oa({default:d(()=>[s.shippingModalIsOpen?(r(),h("div",F6,[s.shippingMethods.length||s.otherShippingMethods.length?(r(),h(P,{key:0},[s.shippingMethods.length?(r(),h("div",$6,[o("h3",null,m(i.translate("Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[3]||(t[3]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(P,null,te(s.shippingMethods,(v,w)=>(r(),E(f,{label:v.id,key:w},{default:d(()=>[R(m(v.title)+" ",1),v.shipping_charge?(r(),h("span",E6,m(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0),s.otherShippingMethods.length?(r(),h("div",U6,[o("h3",null,m(i.translate("Other Shipping Methods")),1),n(_,{modelValue:s.shipping.id,"onUpdate:modelValue":t[4]||(t[4]=v=>s.shipping.id=v),class:"fct-shipping-methods-radio"},{default:d(()=>[(r(!0),h(P,null,te(s.otherShippingMethods,(v,w)=>(r(),E(f,{label:v.id,key:w},{default:d(()=>[R(m(v.title)+" ",1),v.shipping_charge?(r(),h("span",I6,m(e.formatNumberForOrder(v.shipping_charge,a.order)),1)):x("",!0)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])):x("",!0)],64)):(r(),h("div",Q6,[o("span",{innerHTML:i.getShippingMethodsNotFoundMessage()},null,8,D6)]))])):x("",!0)]),_:2},[s.shippingMethods.length||s.otherShippingMethods.length?{name:"footer",fn:d(()=>[n(g,{onClick:t[5]||(t[5]=v=>s.shippingModalIsOpen=!1)},{default:d(()=>[R(m(i.translate("Cancel")),1)]),_:1}),n(g,{type:"primary",onClick:i.updateShipping},{default:d(()=>[R(m(i.translate("Apply")),1)]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","title"])],64)}const Qd=nt(w6,[["render",V6]]),T6={key:0},M6={class:"fct-admin-sidebar-item"},L6={class:"fct-admin-summary-item-list"},R6={class:"fct-admin-summary-item"},O6={class:"font-medium"},P6={key:0,class:"fct-admin-summary-item"},H6={class:"font-medium"},N6={key:1,class:"fct-admin-summary-item"},K6={class:"font-medium"},G6={key:2,class:"fct-admin-summary-item"},z6={class:"font-medium"},j6={key:3,class:"fct-admin-summary-item"},q6={class:"font-medium"},Y6={key:4,class:"fct-admin-summary-item"},W6={class:"font-medium"},J6={key:5,class:"fct-admin-summary-item"},X6={class:"font-medium"},Z6={class:"font-medium"},e9={name:"UtmDetails",props:{order_operation:{type:Object}},computed:{metaItems(){const e=this.order_operation&&this.order_operation.meta;if(!e||typeof e!="object")return[];const t={gclid:u("Google Click ID (gclid)"),gbraid:u("Google iOS Web Click ID (gbraid)"),wbraid:u("Google iOS App Click ID (wbraid)"),gad_campaignid:u("Google Ads Campaign ID"),gad_source:u("Google Ads Source"),msclkid:u("Microsoft Click ID (msclkid)"),fbclid:u("Facebook Click ID (fbclid)")};return Object.keys(e).filter(a=>e[a]!==""&&e[a]!==null&&e[a]!==void 0).map(a=>({key:a,label:t[a]||a,value:e[a]}))}}},Xp=Object.assign(e9,{setup(e){return(t,a)=>e.order_operation?(r(),h("div",T6,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("UTM Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",M6,[o("ul",L6,[o("li",R6,[o("span",O6,m(t.$t("UTM Campaign")),1),o("span",null,m(e.order_operation.utm_campaign||"--"),1)]),e.order_operation.utm_medium?(r(),h("li",P6,[o("span",H6,m(t.$t("UTM Medium")),1),o("span",null,m(e.order_operation.utm_medium||"--"),1)])):x("",!0),e.order_operation.utm_source?(r(),h("li",N6,[o("span",K6,m(t.$t("UTM Source")),1),o("span",null,m(e.order_operation.utm_source||"--"),1)])):x("",!0),e.order_operation.utm_content?(r(),h("li",G6,[o("span",z6,m(t.$t("UTM Content")),1),o("span",null,m(e.order_operation.utm_content||"--"),1)])):x("",!0),e.order_operation.utm_id?(r(),h("li",j6,[o("span",q6,m(t.$t("UTM ID")),1),o("span",null,m(e.order_operation.utm_id||"--"),1)])):x("",!0),e.order_operation.utm_term?(r(),h("li",Y6,[o("span",W6,m(t.$t("UTM Term")),1),o("span",null,m(e.order_operation.utm_term||"--"),1)])):x("",!0),e.order_operation.refer_url?(r(),h("li",J6,[o("span",X6,m(t.$t("Refer Url")),1),o("span",null,m(e.order_operation.refer_url||"--"),1)])):x("",!0),(r(!0),h(P,null,te(t.metaItems,l=>(r(),h("li",{key:l.key,class:"fct-admin-summary-item"},[o("span",Z6,m(l.label),1),o("span",null,m(l.value),1)]))),128))])])]),_:1})]),_:1})])):x("",!0)}}),t9={name:"TaxBreakdownBox",components:{InfoFilled:ll},props:{taxSummary:{type:Object,required:!0},order:{type:Object,required:!0},taxBreakdownShouldShow:{type:Boolean,default:!1}},methods:{translate:u,formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)}}},a9={class:"fct-tax-sum-box"},l9={class:"fct-tax-sum-row fct-tax-breakdown-heading"},s9={class:"fct-tax-sum-row fct-tax-breakdown-col-headers"},n9={class:"fct-tax-breakdown-col-rate"},o9={class:"fct-tax-breakdown-col-base"},i9={class:"fct-tax-breakdown-col-tax"},r9={class:"fct-tax-breakdown-col-rate"},d9={class:"fct-tax-breakdown-col-base"},u9={class:"fct-tax-breakdown-col-tax"},c9={key:0,class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider fct-tax-sum-row--reversed"},A9={key:0},p9={key:1},f9={class:"fct-tax-sum-row total-pay total-payable-tax-row fct-tax-sum-row--divider"},m9={key:0,class:"fct-tax-sum-row fct-tax-sum-row--muted"},h9={key:1,class:"fct-tax-sum-row fct-tax-sum-row--divider"},_9={key:1,class:"fct-tax-sum-row fct-tax-sum-row--muted"},v9={key:2,class:"fct-tax-sum-row"},g9={key:5,class:"fct-tax-sum-row total-pay total-payable-tax-row"},y9={key:6,class:"fct-tax-sum-row fct-tax-sum-row--muted"},b9={key:2,class:"fct-tax-sum-row"},w9={class:"fct-tax-amount fct-tax-amount--reversed"},C9={key:3,class:"fct-tax-sum-row fct-tax-sum-row--reversed"},k9={key:4,class:"fct-tax-sum-row fct-tax-sum-row--reversed"};function B9(e,t,a,l,s,i){const c=C("InfoFilled"),p=C("el-icon");return r(),h("div",a9,[a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length?(r(),h(P,{key:0},[o("div",l9,[o("span",null,m(i.translate("Tax breakdown by rate")),1),n(p,{class:"fct-tax-breakdown-info"},{default:d(()=>[n(c)]),_:1})]),o("div",s9,[o("span",n9,m(i.translate("Rate")),1),o("span",o9,m(i.translate("Taxable base")),1),o("span",i9,m(i.translate("Tax")),1)]),(r(!0),h(P,null,te(a.taxSummary.foldedRateLines,(f,_)=>(r(),h("div",{key:"folded-rate-"+_,class:de(["fct-tax-sum-row fct-tax-breakdown-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",r9,m(f.label),1),o("span",d9,m(i.formatNumber(f.base)),1),o("span",u9,m(i.formatNumber(f.tax)),1)],2))),128)),a.order.is_reverse_charge_tax_order?(r(),h("div",c9,[o("span",null,m(i.translate("VAT reversed")),1),a.taxSummary.reversedTaxTotal>0?(r(),h("span",A9,m(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)):(r(),h("span",p9,m(i.translate("Charge reversed")),1))])):(r(),h(P,{key:1},[o("div",f9,[o("span",null,m(i.translate("Total tax")),1),o("span",null,m(i.formatNumber(a.taxSummary.totalOrderTax)),1)]),a.taxSummary.includedInPrices>0?(r(),h("div",m9,[o("span",null,m(i.translate("of which included in prices")),1),o("span",null,m(i.formatNumber(a.taxSummary.includedInPrices)),1)])):x("",!0),a.taxSummary.payableTax>0&&a.taxSummary.includedInPrices>0?(r(),h("div",h9,[o("span",null,m(i.translate("Payable now (added)")),1),o("span",null,m(i.formatNumber(a.taxSummary.payableTax)),1)])):x("",!0)],64))],64)):a.order.is_reverse_charge_tax_order?x("",!0):(r(),h(P,{key:1},[a.taxSummary.taxRateLines.length&&a.taxBreakdownShouldShow?(r(!0),h(P,{key:0},te(a.taxSummary.taxRateLines,f=>(r(),h("div",{key:"tax-rate-line-"+f.rate_id+"-"+f.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",null,m(f.label),1),o("span",null,m(i.formatNumber(f.order_tax)),1)],2))),128)):x("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.inclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",_9,[o("span",null,m(i.translate("Included in item prices")),1),o("span",null,m(i.formatNumber(a.taxSummary.inclusiveTax)),1)])):x("",!0),!a.taxSummary.taxRateLines.length&&a.taxSummary.exclusiveTax>0&&a.taxBreakdownShouldShow?(r(),h("div",v9,[o("span",null,m(i.translate("Added on products")),1),o("span",null,m(i.formatNumber(a.taxSummary.exclusiveTax)),1)])):x("",!0),a.taxSummary.feeTaxLineRows&&a.taxSummary.feeTaxLineRows.length&&a.taxBreakdownShouldShow?(r(!0),h(P,{key:3},te(a.taxSummary.feeTaxLineRows,(f,_)=>(r(),h("div",{key:_,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":f.inclusive}])},[o("span",null,m(f.display_label),1),o("span",null,m(i.formatNumber(f.tax_amount)),1)],2))),128)):x("",!0),a.taxSummary.shippingTax>0&&a.taxBreakdownShouldShow?(r(),h(P,{key:4},[a.taxSummary.shippingTaxLines&&a.taxSummary.shippingTaxLines.length?(r(!0),h(P,{key:0},te(a.taxSummary.shippingTaxLines,f=>(r(),h("div",{key:f.label,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,m(f.label),1),o("span",null,m(i.formatNumber(f.shipping_tax)),1)],2))),128)):(r(),h("div",{key:1,class:de(["fct-tax-sum-row",{"fct-tax-sum-row--muted":a.taxSummary.isShippingInclusive}])},[o("span",null,m(a.taxSummary.isShippingInclusive?i.translate("Included in shipping prices"):i.translate("Added on shipping")),1),o("span",null,m(i.formatNumber(a.taxSummary.shippingTax)),1)],2))],64)):x("",!0),a.taxSummary.payableTax>0?(r(),h("div",g9,[o("span",null,m(i.translate("Total payable tax")),1),o("span",null,m(i.formatNumber(a.taxSummary.payableTax)),1)])):x("",!0),a.taxSummary.inclusiveTax>0||a.taxSummary.inclusiveFeeTax>0?(r(),h("div",y9,[o("span",null,m(i.translate("Total tax in this order")),1),o("span",null,m(i.formatNumber(a.taxSummary.totalOrderTax)),1)])):x("",!0)],64)),a.order.is_reverse_charge_tax_order&&a.taxSummary.showRcShippingRow&&a.taxSummary.reversedShippingTax>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",b9,[o("span",null,m(i.translate("Added on shipping")),1),o("span",w9,m(i.formatNumber(a.taxSummary.reversedShippingTax)),1)])):x("",!0),a.order.is_reverse_charge_tax_order&&a.taxSummary.reversedTaxTotal>0&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)?(r(),h("div",C9,[o("span",null,m(i.translate("Tax reversed")),1),o("span",null,m(i.formatNumber(a.taxSummary.reversedTaxTotal)),1)])):x("",!0),a.order.is_reverse_charge_tax_order&&!(a.taxSummary.foldedRateLines&&a.taxSummary.foldedRateLines.length)&&!(a.taxSummary.reversedTaxTotal>0)&&!(a.taxSummary.showRcShippingRow&&a.taxSummary.reversedShippingTax>0)?(r(),h("div",k9,[o("span",null,m(i.translate("VAT reversed")),1),o("span",null,m(i.translate("Charge reversed")),1)])):x("",!0)])}const Kr=nt(t9,[["render",B9]]),x9={name:"Transaction",components:{ConvertedTime:Pa,Badge:fa,DynamicIcon:Y},props:{transactions:{type:Array,required:!0},order_id:{type:Number,required:!0},orderCurrency:{type:String,default:null}},emits:["reload"],data(){return{syncing_transaction:null}},computed:{Str(){return da}},methods:{translate:u,getCardBrand:dA,syncTransaction(e){this.syncing_transaction||(this.syncing_transaction=e.id,this.$post("orders/"+this.order_id+"/transactions/"+e.id+"/sync").then(t=>{this.$notify.success(t.message),this.$emit("reload")}).catch(t=>{var a;this.$notify.error(((a=t==null?void 0:t.data)==null?void 0:a.message)||u("Something went wrong!"))}).finally(()=>{this.syncing_transaction=null}))}}},S9={class:"fct-table-mobile-wrap fct-transaction-details-mobile-wrap"},F9={class:"fct-table-mobile-header"},$9={class:"fct-table-mobile-header-left"},E9={class:"fct-table-status-col"},U9={class:"fct-table-date-col"},I9={class:"id"},Q9={class:"fct-table-price-col"},D9={class:"p-0 m-0 text-xs text-gray-500"},V9={class:"fct-table-mobile-body"},T9={class:"fct-table-mobile-body-list"},M9={class:"fct-table-mobile-method-col"},L9={class:"label"},R9={class:"value"},O9={class:"flex items-center gap-2.5"},P9={key:0,class:"w-7"},H9=["title","src","alt"],N9={key:1,class:"capitalize"},K9={key:2},G9={class:"fct-table-mobile-gateway-col"},z9={class:"label"},j9={class:"value"},q9={key:0},Y9=["href"];function W9(e,t,a,l,s,i){const c=C("Badge"),p=C("el-tooltip"),f=C("ConvertedTime"),_=C("DynamicIcon"),g=C("el-button");return r(),h("div",S9,[(r(!0),h(P,null,te(a.transactions,(y,v)=>{var w,k,b,S;return r(),h("div",{class:"fct-table-mobile-row",key:v},[o("div",F9,[o("div",$9,[o("div",E9,[(w=y==null?void 0:y.meta)!=null&&w.reason?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate((k=y==null?void 0:y.meta)==null?void 0:k.reason),"popper-class":"fct-label-hint-popover fct-tooltip"},{default:d(()=>{var $,D;return[(($=y==null?void 0:y.meta)==null?void 0:$.disputed)==="yes"&&((D=y==null?void 0:y.meta)==null?void 0:D.dispute_resolved)==="no"?(r(),E(c,{key:0,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]}),_:2},1032,["content"])):(r(),E(c,{key:1,status:y.status},{default:d(()=>[R(m(y.status==="paid"?"Completed":y.status),1)]),_:2},1032,["status"]))]),o("div",U9,[o("span",I9,"#"+m(y.id),1),t[0]||(t[0]=o("span",{class:"bullet"},"•",-1)),n(f,{"date-time":((b=y==null?void 0:y.meta)==null?void 0:b.settled_at)||y.created_at},null,8,["date-time"])])]),o("div",Q9,[((S=y==null?void 0:y.meta)==null?void 0:S.mor_vat_removed)>0?(r(),h(P,{key:0},[R(m(e.formatNumberForOrder(y.total-y.meta.mor_vat_removed,a.orderCurrency))+" ",1),o("p",D9,m(i.translate("Tax reversed"))+": "+m(e.formatNumberForOrder(y.meta.mor_vat_removed,a.orderCurrency)),1)],64)):(r(),h(P,{key:1},[R(m(e.formatNumberForOrder(y.total,a.orderCurrency)),1)],64))]),y.transaction_type=="charge"&&y.status=="pending"&&y.vendor_charge_id?(r(),E(p,{key:0,effect:"dark",placement:"top",content:i.translate("Sync payment status from %1$s",y.payment_method),"popper-class":"fct-tooltip"},{default:d(()=>[n(g,{size:"small","aria-label":i.translate("Sync payment status from %1$s",y.payment_method),loading:s.syncing_transaction===y.id,onClick:$=>i.syncTransaction(y)},{default:d(()=>[n(_,{class:"w-4 h-4",name:"Refresh","aria-hidden":"true"})]),_:2},1032,["aria-label","loading","onClick"])]),_:2},1032,["content"])):x("",!0)]),o("div",V9,[o("ul",T9,[o("li",M9,[o("div",L9,m(i.translate("Payment Method:")),1),o("div",R9,[o("div",O9,[i.getCardBrand(y.card_brand,y.payment_method_type)?(r(),h("div",P9,[o("img",{class:"w-full",title:y.payment_method,src:i.getCardBrand(y.card_brand,y.payment_method_type),alt:y.card_brand},null,8,H9)])):(r(),h("span",N9,m(y.payment_method_type),1)),y.card_last_4&&y.card_last_4!="0"?(r(),h("span",K9,m("..."+y.card_last_4),1)):x("",!0)])])]),o("li",G9,[o("div",z9,m(i.translate("Gateway ID:")),1),o("div",j9,[y.vendor_charge_id===""?(r(),h("span",q9,"--")):(r(),h("a",{key:1,class:"link",target:"_blank",href:y.url},m(y.vendor_charge_id),9,Y9))])])])])])}),128))])}const Zp=nt(x9,[["render",W9]]),J9={key:1,class:"fct-single-order-page"},X9={key:1,class:"fct-single-order-wrapper fct-layout-width"},Z9={class:"single-page-header flex items-start justify-between"},eQ={class:"single-page-header-title-wrap"},tQ={key:1},aQ={key:2},lQ={class:"single-page-header-status-wrap"},sQ={class:"single-page-header-text"},nQ={class:"capitalize"},oQ={class:"fct-btn-group sm"},iQ={class:"single-page-body"},rQ={class:"fct-single-order"},dQ={class:"fct-single-order-main"},uQ={class:"fct-card-header-title is-small"},cQ={key:0,class:"fct-browse-product-form-group pb-5"},AQ={class:"fct-ordered-product-list-container"},pQ={key:0,class:"fct-ordered-product-list-wrapper"},fQ={class:"fct-media-content-list -mt-4 w-full"},mQ={class:"align-top"},hQ=["rowspan"],_Q={class:"product-thumbnail w-[46px] flex-shrink-0"},vQ=["href"],gQ=["src","alt"],yQ=["src","alt"],bQ={class:""},wQ={class:"product-details-content-row"},CQ={class:"product-details-content-first flex flex-col"},kQ={class:"product-title m-0"},BQ=["href"],xQ={key:0,class:"product-variation-title m-0"},SQ={key:2,class:"product-subscription-info"},FQ=["innerHTML"],$Q=["innerHTML"],EQ={key:0,class:"product-details-quantity"},UQ={key:1,class:"product-details-price-mobile"},IQ={class:"product-details-quantity"},QQ={key:0,class:"del"},DQ={class:"product-details-price-mobile"},VQ={key:0,class:"del"},TQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},MQ={key:0,class:"del"},LQ={class:"fct-order-item-qty-col text-right whitespace-nowrap"},RQ={key:0,class:"product-details-content-second shrink-0 grow-0 basis-[90px]"},OQ={class:"product-details-quantity"},PQ={key:0,class:"del"},HQ={key:1,class:"del line-through opacity-60 text-xs mr-0.5"},NQ={class:"fct-order-item-price-col text-right whitespace-nowrap"},KQ={class:"product-details-content-third shrink-0 grow-0 flex justify-end gap-1 basis-[100px]"},GQ={key:0,class:"flex items-center"},zQ={class:"del line-through text-xs font-normal opacity-60 leading-tight"},jQ={colspan:"2",class:""},qQ={class:"fct-tax-badge"},YQ={class:"text-right"},WQ={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},JQ={class:"pb-2"},XQ={key:1},ZQ={colspan:"2",class:""},eD={class:"text-xs text-system-mid dark:text-gray-300"},tD={class:"text-right text-xs text-system-mid dark:text-gray-300 whitespace-nowrap"},aD={colspan:"2",class:"pb-2"},lD={class:"fct-tax-badge"},sD={class:"text-right pb-2"},nD={key:1,class:"text-xs text-system-mid dark:text-gray-300 opacity-70"},oD={class:"pb-2"},iD={key:3},rD={colspan:"3"},dD={class:"product-details-action-row"},uD=["onClick"],cD=["onClick"],AD={key:1,class:"m-0 text-center"},pD={class:"fct-card-header-title is-small"},fD={class:"fct-table-border fct-table-order-details"},mD={key:0},hD={key:3},_D={key:4},vD={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},gD={key:5},yD={colspan:"3",class:"fct-tax-summary-cell"},bD={key:0,class:"fct-tax-simple-line",style:{display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},wD={style:{display:"flex","align-items":"center",gap:"6px"}},CD={href:"javascript:void(0)",class:"fct-tax-see-details"},kD={class:"total-amount-tr"},BD={class:"payment-tr"},xD={key:6,class:"payment-tr"},SD={key:7,class:"payment-tr"},FD={class:"font-semibold"},$D={key:8,class:"payment-tr"},ED={class:"font-semibold"},UD={key:9,class:"payment-tr total-refund-owed-tr"},ID={class:"flex flex-end m-0 items-center"},QD={class:"font-semibold"},DD={class:"fct-single-order-aside"},VD={class:"fct-admin-sidebar"},TD={key:0},MD={class:"fct-adjust-quantity-modal-content"},LD={class:"title"},RD={class:"fct-form-group"},OD={class:"dialog-footer"},PD={key:0},HD={name:"SingleOrder",props:["order_id"],components:{OrderBulkActions:Ed,Alert:el,Transaction:Ud,Plans:Yp,Badge:fa,Refresh:Zc,ElMessageBox:Fl,CopyToClipboard:Ea,Notes:Fi,Coupon:$i,CustomDiscount:Ei,OrderCustomerInformation:ui,ShippingComponent:Qd,UtmDetails:Xp,TaxBreakdownBox:Kr,OrderUpDownIndicator:sA,TransactionMobile:Zp,BundleProducts:To,Promotion:Od},provide(){return{triggerChange:this.triggerChange}},data(){return{notFound:{show:!1,message:"",buttonText:"",route:""},warningMessage:"",loading:!1,calculating:!1,customModal:!1,processing_refund:!1,nextInvoiceModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{item_name:"",item_price:0,quantity:1,is_physical:"yes"},transactionMedium:!1,otherData:{payment_method:"offline_payment",mark_paid_note:"",vendor_charge_id:""},paymentMethodOption:[{name:"Others",value:"others"}],timeout:"",widgets:[],order:!1,searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",actionableActivities:[],isSubscription:!1,subscriptionStatus:"",showManageActivity:!1,change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,showRefundModal:!1,isEditingItem:!1,shouldDisableEditing:!1,adjustQuantityModal:!1,adjustItem:[],selectedLabels:[],tmpAdjustedItem:{},coupons:[],appliedCoupons:[],hasCoupon:!1,shippingMethods:[],otherShippingMethods:[],uniqueItemsCount:0,markingOrderAsPaid:!1,sendingPaymentReminder:!1,canSendPaymentReminderFlag:!1,isMobile:window.innerWidth<768}},watch:{order:{handler(e,t){this.changes_made++},deep:!0},order_id:{handler(e,t){this.changeTitle("Order #"+e),this.changes_made=0,this.fetch()}}},computed:{parentOrderId(){return!this.order||!this.order.parent_id?null:this.order.parent_id!=="0"?this.order.parent_id:null},orderUuid(){return this.order&&this.order.uuid?this.order.uuid:""},orderUuidDisplay(){return this.orderUuid.length>12?this.orderUuid.substring(0,12):this.orderUuid},isOrderUuidTruncated(){return this.orderUuid.length>12},transactionType(){return"charge"},placeholderImage(){return`${ze.get("asset_url")}images/empty-image.svg`},canSendPaymentReminder(){return this.canSendPaymentReminderFlag},feeItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>e.payment_type==="fee")},taxSummary(){const e=this.order.tax_summary||{};return{inclusiveTax:e.inclusiveTax||0,exclusiveTax:e.exclusiveTax||0,taxRateLines:this.order.display_tax_lines||e.taxRateLines||[],feeTaxLines:e.feeTaxLines||[],feeTaxLineRows:e.feeTaxLineRows||[],inclusiveFeeTax:e.inclusiveFeeTax||0,shippingTax:e.shippingTax||0,shippingTaxLines:e.shippingTaxLines||[],payableTax:e.payableTax||0,totalOrderTax:e.totalOrderTax||0,isShippingInclusive:e.isShippingInclusive||!1,reversedTaxTotal:e.reversedTaxTotal||0,reversedShippingTax:e.reversedShippingTax||0,rcShippingAdjustment:e.rcShippingAdjustment||0,rcTotalAdjustment:e.rcTotalAdjustment||0,showRcShippingRow:e.showRcShippingRow||!1,foldedRateLines:e.foldedRateLines||[],includedInPrices:e.includedInPrices||0,displayMode:e.displayMode||"itemized",simpleLine:e.simpleLine||null}},taxBreakdownShouldShow(){const e=this.taxSummary;if(e.taxRateLines.length||e.shippingTaxLines.length)return!0;let t=0;return e.taxRateLines.length?t+=e.taxRateLines.length:(e.inclusiveTax>0&&t++,e.exclusiveTax>0&&t++),t+=e.feeTaxLineRows.filter(function(a){return a.tax_amount>0}).length,e.shippingTax>0&&t++,t>=2?!0:t===0?!1:!(e.payableTax>0||e.inclusiveTax>0||e.inclusiveFeeTax>0)},setupFeeSiblingMap(){if(!this.order||!Array.isArray(this.order.order_items))return{};var e={};return this.order.order_items.forEach(function(t){t.payment_type==="signup_fee"&&(t.line_meta&&t.line_meta.parent_item_id&&(e[t.line_meta.parent_item_id]=t),t.object_id&&!e["obj_"+t.object_id]&&(e["obj_"+t.object_id]=t))}),e}},methods:{confirmSendPaymentReminder(){Fl.confirm(u("Are you sure you want to send a payment reminder email for this order?"),u("Send Payment Reminder"),{type:"info",icon:Gc(Od),cancelButtonText:u("Cancel"),confirmButtonText:u("Send Now"),beforeClose:async(e,t,a)=>{var l;if(e==="confirm")try{t.confirmButtonLoading=!0,this.sendingPaymentReminder=!0;const s=await this.$post("email-notification/send-manual-reminder",{event:"renewal_reminder_overdue",entity_id:this.order.id});q.success(s.message||u("Payment reminder sent successfully"))}catch(s){q.error(((l=s.data)==null?void 0:l.message)||u("Failed to send payment reminder"))}finally{t.confirmButtonLoading=!1,this.sendingPaymentReminder=!1,a()}else a()}})},triggerChange(){this.changes_made=1},handleResize(){this.isMobile=window.innerWidth<768},formatNumber(e,t=!0,a=!1){return this.formatNumberForOrder(e,this.order,t,a)},getDueRefund(){var e;return this.formatNumber(Math.abs(parseFloat(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid))+parseFloat(this.order.total_refund)))},triggerRefundModal(){this.showRefundModal=!0},getNetPayment(){var t,a,l;const e=((a=(t=this.order)==null?void 0:t.business_info)==null?void 0:a.net_total_paid)??this.order.total_paid;return this.formatNumber(e-((l=this.order)==null?void 0:l.total_refund))},getTotalDue(){var e;return this.formatNumber(Math.abs(this.order.total_amount-((e=this.order)==null?void 0:e.total_paid)))},markOrderAsPaid(){this.markingOrderAsPaid||(this.markingOrderAsPaid=!0,Ae.post("orders/"+this.order_id+"/mark-as-paid",{...this.otherData,transaction_type:this.transactionType}).then(e=>{this.markingOrderAsPaid=!1,this.transactionMedium=!1,q.success(e.message),this.fetch()}).catch(e=>{var t;this.markingOrderAsPaid=!1,e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}))},handleCommand(e){e==="custom-payment-link"?this.nextInvoiceModal=!0:e==="send-payment-reminder"?this.confirmSendPaymentReminder():this.transactionMedium=!0},shouldSkipAdjustmentItem(e){return!(this.order.order_items.some(a=>a.payment_type==="subscription")&&e.payment_type==="adjustment")},handleAdjustQuantityModal(e){this.adjustItem={},this.adjustQuantityModal=!0,this.adjustItem=e},getImageUrl(e){var l,s,i,c;const t=(l=e==null?void 0:e.variants)==null?void 0:l.media;if(t&&Array.isArray(t.meta_value)&&((s=t.meta_value[0])!=null&&s.url))return t.meta_value[0].url;const a=(c=(i=e==null?void 0:e.variants)==null?void 0:i.product_detail)==null?void 0:c.featured_media;return!t&&a&&typeof a=="object"&&a!==null?a.url:this.placeholderImage},getClass(e){let t=null;return e.featured_media!=null&&(t=this.getImageUrl(e)),{"w-full":!0,"border border-solid border-gray-divider rounded":t&&t!==null&&t!==void 0}},shouldShowRefund(){var t;if(!this.order||(t=this.order.config)!=null&&t.upgraded_to)return!1;const e=parseInt(this.order.total_paid/100);return this.order.payment_status!=="refunded"&&e>0&&e>=parseInt(this.order.total_refund/100)},enableItemEditing(){this.isEditingItem=!0,this.fetchShippingMethods()},disableItemEditing(){this.isEditingItem=!1},handlePaymentActions(e){this.changes_made=0,e==="refund"?this.showRefundModal=!0:e==="create_next_invoice"&&(this.nextInvoiceModal=!0)},getOrderUrl(e){const t=ze.get("dashboard_url")+"/orders/"+e+"/view";window.location=t},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){this.tmpAdjustedItem={quantity:e,updatedStock:t,item:a}},saveAdjustedProductQuantity(e){this.adjustQuantityModal=!1,Object.keys(e).length>0&&(parseInt(e.updatedStock)<0?q.error(u("You have exceeded the stock limit! Current stock is : %s",e.updatedStock)):e.item.quantity=e.quantity,e.item.updated_stock=e.updatedStock,this.calculateLine())},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():Id(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){var a;this.loading=!0;const e={...this.order};delete e.customer,delete e.note,e.metaValue=((a=this.$refs.dynamicTemplates)==null?void 0:a.getFormStates())||{};const t={...e,deletedItems:this.deletedItems,discount:this.discount,shipping:this.shippingSettings};Ae.post("orders/"+this.order_id,t).then(l=>{q.success(l.message),this.fetch()}).catch(l=>{var s;l.status_code=="422"?q.validationErrors(l):q.error((s=l.data)==null?void 0:s.message)}).finally(()=>{this.loading=!1})},fetch(){this.notFound.show=!1,this.loading=!0,Ae.get("orders/"+this.order_id,{with:["widgets"]}).then(e=>{var t,a,l,s,i;this.coupons=e.order.applied_coupons||[],this.hasCoupon=this.coupons.length>0,this.appliedCoupons=this.coupons.map(c=>c.coupon_id),this.order=e.order,this.order.order_items=this.formatOrderItems(e.order.order_items),e.checkout_shipping&&(this.order.checkout_shipping=e.checkout_shipping),this.canSendPaymentReminderFlag=!!e.can_send_payment_reminder,this.isSubscription=((t=this.order)==null?void 0:t.subscriptions)&&this.order.subscriptions.length>0,this.isSubscription&&(this.subscriptionStatus=(a=this.order.subscriptions[0])==null?void 0:a.status),this.shouldDisableEditing=["completed","archived","canceled"].includes(this.order.status)||this.isSubscription||this.order.payment_status==="paid",["completed","archived","canceled"].includes(this.order.status)&&(this.warningMessage=u("Order cannot be edited once it is %s",this.order.status)),this.order.payment_status==="paid"&&(this.warningMessage=u("Order cannot be edited once paid.")),this.isSubscription&&(this.warningMessage=u("Subscription Order cannot be edited.")),this.orderSettings=e.order_settings,this.widgets=e.widgets,this.selectedProducts=this.availableProducts=[],this.discount.value=((l=e.discount_meta)==null?void 0:l.value)||0,this.discount.reason=((s=e.discount_meta)==null?void 0:s.reason)||"",this.discount.type=((i=e.discount_meta)==null?void 0:i.type)||"amount",this.selectedLabels=e.selected_labels||[],this.uniqueItemsCount=Tm(e.order),e.shipping_meta&&e.shipping_meta.type?this.shippingSettings=e.shipping_meta:e.checkout_shipping&&e.checkout_shipping.method_id&&(this.shippingSettings={id:e.checkout_shipping.method_id}),Wp(this.discount),this.order.order_items.find(c=>c.payment_type==="subscription"),this.order.order_items=this.order.order_items.map(c=>{var p;return{...c,quantity:Number(c.quantity),updated_stock:parseInt((c==null?void 0:c.available)||((p=c==null?void 0:c.variants)==null?void 0:p.available))+parseInt(c.quantity)}}),this.resetUnsaved(),this.renderActionables(),this.disableItemEditing(),xe(()=>{this.changes_made=0})}).catch(e=>{var t;e.code==="fluent_cart_entity_not_found"?(q.error(dt.get(e,"data.message")||u("Order not found")),this.$router.replace({name:"orders"})):e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1,(["completed","archived","canceled"].includes(this.order.status)||["unshippable"].includes(this.order.shipping_status))&&this.disableItemEditing()})},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t,a){a&&a.id&&(this.shippingSettings=a),this.changes_made++},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},clearActivityAction(e){Ae.put("activity/"+e.id+"/mark-read",{id:e.id,status:"read"}).then(t=>{this.actionableActivities=this.actionableActivities.filter(a=>a.id!==e.id),this.handleSuccess(t==null?void 0:t.message)}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)})},renderActionables(){var a;let e=(a=this==null?void 0:this.order)==null?void 0:a.activities;const t=["warning","error"];this.actionableActivities=e==null?void 0:e.filter(l=>(l==null?void 0:l.read_status)==="unread"&&t.includes(l==null?void 0:l.status))},getCustomerTotalOrders(e){return e>0?e+" "+(e==1?this.$t("order"):this.$t("orders")):this.$t("No orders")},onChangeLabel(e){this.selectedLabels=e,this.changes_made++},saveNoteModal(e){this.order.note=e},hasSubscriptionProduct(e,t){return e.filter(l=>l.variants&&l.variants.other_info&&l.variants.other_info.payment_type===t?!0:!!(l.payment_type&&l.payment_type===t)).length>0},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),Ae.get("orders/shipping_methods",{country_code:this.order.customer.country,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})},formatOrderItems:gm,getProductRowSpan(e){var t=1,a=this.getItemTaxRates(e);a.length>0?t+=a.length:e.tax_amount>0&&(t+=1),e.other_info&&e.other_info.manage_setup_fee==="yes"&&(t+=1);var l=this.getSubscriptionSetupFeeTaxRates(e);return l.length>0?t+=l.length:e.other_info&&e.other_info.signup_fee_tax>0&&e.other_info.manage_setup_fee==="yes"&&(t+=1),this.isEditingItem&&(t+=1),t},getItemTaxRates(e){var t=e.line_meta&&e.line_meta.tax_config?e.line_meta.tax_config.rates:null;return Array.isArray(t)?t.filter(function(a){return a.tax_amount>0}):[]},getSetupFeeSibling(e){return this.setupFeeSiblingMap[e.id]||this.setupFeeSiblingMap["obj_"+e.object_id]||null},getSubscriptionSetupFeeTaxRates(e){var t=this.getSetupFeeSibling(e);if(!t)return[];var a=t.line_meta&&t.line_meta.tax_config&&Array.isArray(t.line_meta.tax_config.rates)?t.line_meta.tax_config.rates:t.line_meta&&Array.isArray(t.line_meta.rates)?t.line_meta.rates:null;return Array.isArray(a)?a.filter(function(l){return l.tax_amount>0}):[]},isSubscriptionSetupFeeInclusive(e){var t=this.getSetupFeeSibling(e);if(!t||!t.line_meta)return!1;var a=t.line_meta.tax_config&&typeof t.line_meta.tax_config=="object"?t.line_meta.tax_config:t.line_meta;return!!a.inclusive},getItemDisplayLineTotal(e){return Math.max(0,parseInt(e.line_total||0))},shouldShowUnitPriceRoundingTooltip(e){var t=parseInt(e.quantity||1),a=parseInt(e.unit_price||0),l=parseInt(e.line_total||0);if(t<2||a<=0||l<=0)return!1;var s=Math.abs(a*t-l);return s>0&&s<=t},formatTaxRateBadge(e){return(e.label||u("Tax"))+" ("+e.rate_percent+"%)"},onBusinessInfoOrderUpdated(e){if(!e)return;const t={business_info:e.business_info,is_reverse_charge_tax_order:e.is_reverse_charge_tax_order,customer_tax_number:e.customer_tax_number,is_b2b_order:e.is_b2b_order,tax_total:e.tax_total,shipping_tax:e.shipping_tax,tax_behavior:e.tax_behavior,total_amount:e.total_amount,total_paid:e.total_paid,payment_status:e.payment_status,tax_summary:e.tax_summary,display_tax_lines:e.display_tax_lines,display_shipping_tax_lines:e.display_shipping_tax_lines};Object.keys(t).forEach(a=>{t[a]===void 0&&delete t[a]}),this.order=Object.assign({},this.order,t)}},mounted(){this.changeTitle("Order #"+this.order_id),this.fetch(),window.onbeforeunload=()=>{if(this.changes_made>1)return!0},(ze.get("payment_routes")??[]).filter(t=>!(t!=null&&t.upcoming)).forEach(t=>{var a;this.paymentMethodOption.unshift({name:(a=t==null?void 0:t.meta)==null?void 0:a.title,value:t==null?void 0:t.path})}),window.addEventListener("resize",this.handleResize)},beforeUnmount(){window.removeEventListener("resize",this.handleResize)}},ND=Object.assign(HD,{setup(e){const t=T(),a=()=>t.value.fetchBySearch(),l=()=>{a()};return(s,i)=>{var M,O;const c=C("el-breadcrumb-item"),p=C("el-tooltip"),f=C("el-breadcrumb"),_=C("el-button"),g=C("el-input"),y=C("router-link"),v=C("el-icon"),w=C("el-popover"),k=C("el-dropdown-item"),b=C("el-dropdown-menu"),S=C("el-dropdown"),$=C("el-option"),D=C("el-select"),F=C("el-form-item"),B=C("el-form"),U=C("el-dialog"),Q=C("el-skeleton-item"),V=C("el-skeleton"),I=Va("loading");return r(),h(P,null,[s.notFound.show?(r(),E(ci,{key:0,"button-text":s.notFound.buttonText,message:s.notFound.message,route:s.notFound.route},null,8,["button-text","message","route"])):x("",!0),s.notFound.show===!1?(r(),h("div",J9,[n(un,{isActive:s.changes_made>=1&&!s.showRefundModal?"is-active":"",onDiscard:s.reloadOrder,onSave:s.update,loading:s.loading,saveButtonText:A(u)("Update")},null,8,["isActive","onDiscard","onSave","loading","saveButtonText"]),s.loading?(r(),E(Z5,{key:0})):x("",!0),s.order?(r(),h("div",X9,[!s.loading&&s.order?(r(),h(P,{key:0},[o("div",Z9,[o("div",null,[o("div",eQ,[n(f,{"separator-icon":A(Al)},{default:d(()=>[n(c,{to:{name:"orders"}},{default:d(()=>[R(m(A(u)("Orders")),1)]),_:1}),s.parentOrderId?(r(),E(c,{key:0,to:{name:"view_order",params:{}}},{default:d(()=>[o("a",{onClick:i[0]||(i[0]=L=>s.getOrderUrl(s.parentOrderId))}," #"+m(s.parentOrderId),1)]),_:1})):x("",!0),n(c,null,{default:d(()=>[s.isOrderUuidTruncated?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-tooltip-long",content:s.orderUuid},{default:d(()=>[o("span",null,"#"+m(s.orderUuidDisplay),1)]),_:1},8,["content"])):s.orderUuid?(r(),h("span",tQ,"#"+m(s.orderUuidDisplay),1)):(r(),h("span",aQ,"#"+m(A(sa)(e.order_id)),1))]),_:1})]),_:1},8,["separator-icon"]),o("div",lQ,[n(fa,{status:s.order.status},null,8,["status"]),s.order.is_b2b_order?(r(),E(fa,{key:0,type:"blue",text:A(u)("B2B")},null,8,["text"])):x("",!0),n(sA,{order:s.order},null,8,["order"])])]),o("div",sQ,[n(Pa,{"date-time":s.order.created_at,"with-time":""},null,8,["date-time"]),i[21]||(i[21]=o("span",{class:"fct_separator"},null,-1)),s.order.invoice_no?(r(),h(P,{key:0},[o("span",null,m(s.order.invoice_no),1),i[20]||(i[20]=o("span",{class:"fct_separator"},null,-1))],64)):x("",!0),o("span",nQ,m(s.order.type),1)])]),o("div",oQ,[s.shouldShowRefund()?(r(),E(_,{key:0,onClick:i[1]||(i[1]=L=>s.handlePaymentActions("refund")),class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(m(A(u)("Refund")),1)]),_:1})):x("",!0),s.isEditingItem?(r(),E(_,{key:2,onClick:s.disableItemEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[R(m(A(u)("Disable Editing")),1)]),_:1},8,["onClick"])):(r(),E(_,{key:1,onClick:s.enableItemEditing,disabled:s.shouldDisableEditing,class:"bulk-action-hide-only-mobile"},{default:d(()=>[s.shouldDisableEditing?(r(),E(p,{key:0,placement:"top","popper-class":"fct-tooltip fct-disabled-edit-order-tooltip"},{content:d(()=>[R(m(s.warningMessage),1)]),default:d(()=>[R(" "+m(A(u)("Edit")),1)]),_:1})):(r(),h(P,{key:1},[R(m(A(u)("Edit")),1)],64))]),_:1},8,["onClick","disabled"])),n(Ed,{onReload:i[2]||(i[2]=L=>s.reloadOrder()),onAddItem:a,onAddProduct:s.addProduct,onEnableItemEditing:s.enableItemEditing,onDisableItemEditing:s.disableItemEditing,onHandlePaymentActions:s.handlePaymentActions,"is-editing-item":s.isEditingItem,order:s.order,triggerMode:s.isMobile?"":"button",shouldShowRefund:s.shouldShowRefund(),warningMessage:s.warningMessage},null,8,["onAddProduct","onEnableItemEditing","onDisableItemEditing","onHandlePaymentActions","is-editing-item","order","triggerMode","shouldShowRefund","warningMessage"])])]),o("div",iQ,[(r(!0),h(P,null,te(s.actionableActivities,L=>(r(),E(el,{class:"mb-5",type:"error",key:L.id,content:L==null?void 0:L.content,closable:"",onClose:H=>s.clearActivityAction(L)},null,8,["content","onClose"]))),128)),o("div",rQ,[o("div",dQ,[n(Se,{class:"overflow-hidden fct-order-items-card"},{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>{var L,H;return[o("h2",uQ,[R(m(A(u)("Order items"))+" ",1),((L=s.order)==null?void 0:L.fulfillment_type)==="physical"?(r(),E(fa,{key:0,status:(H=s.order)==null?void 0:H.shipping_status},{default:d(()=>{var j;return[R(m((j=s.order)==null?void 0:j.shipping_status),1)]}),_:1},8,["status"])):x("",!0)])]}),_:1}),n(ke,null,{default:d(()=>[s.isEditingItem?(r(),h("div",cQ,[n(g,{placeholder:A(u)("Search products..."),onKeyup:i[3]||(i[3]=L=>a()),modelValue:s.searchQuery,"onUpdate:modelValue":i[4]||(i[4]=L=>s.searchQuery=L)},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(_,{onClick:l,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(A(u)("Browse")),1)]),_:1})])):x("",!0),o("div",AQ,[s.order.order_items.length>0?(r(),h("div",pQ,[o("table",fQ,[o("tbody",null,[(r(!0),h(P,null,te(s.order.order_items,(L,H)=>{var j,W,G,Z,ne,ce,z,ue,ie,J,N,ae,oe,fe;return r(),h(P,{key:H},[L.payment_type!=="signup_fee"&&L.payment_type!=="fee"&&((j=L==null?void 0:L.other_info)==null?void 0:j.item_status)!=="adjusted"&&s.shouldSkipAdjustmentItem(L)?(r(),h(P,{key:0},[o("tr",mQ,[o("td",{class:"w-[64px] pr-3 align-top",rowspan:s.getProductRowSpan(L)},[o("div",_Q,[L!=null&&L.is_custom?(r(),h("a",{key:0,href:(W=L==null?void 0:L.other_info)==null?void 0:W.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},[o("img",{src:L.featured_media!=null?L.featured_media:s.getImageUrl(L),alt:L.title,class:de([s.getClass(L),"h-full object-contain rounded"])},null,10,gQ)],8,vQ)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:L==null?void 0:L.post_id}}},{default:d(()=>[o("img",{src:L.featured_media!=null?L.featured_media:s.getImageUrl(L),alt:L.title,class:de([s.getClass(L),"h-full object-contain rounded"])},null,10,yQ)]),_:2},1032,["to"]))])],8,hQ),o("td",bQ,[o("div",wQ,[o("div",CQ,[o("div",kQ,[L!=null&&L.is_custom?(r(),h("a",{key:0,href:(G=L==null?void 0:L.other_info)==null?void 0:G.view_url,target:"_blank",rel:"noopener noreferrer",class:"link"},m(L==null?void 0:L.post_title),9,BQ)):(r(),E(y,{key:1,class:"link",to:{name:"product_edit",params:{product_id:L==null?void 0:L.post_id}}},{default:d(()=>[R(m(L==null?void 0:L.post_title),1)]),_:2},1032,["to"]))]),(L!=null&&L.variation_display_title||L!=null&&L.title)&&(L==null?void 0:L.title)!==(L==null?void 0:L.post_title)?(r(),h("div",xQ," – "+m((L==null?void 0:L.variation_display_title)||(L==null?void 0:L.title)),1)):x("",!0),L.bundle_items.length>0?(r(),E(To,{key:1,product:L},null,8,["product"])):x("",!0),(L==null?void 0:L.payment_type)==="subscription"?(r(),h("div",SQ,[o("div",{innerHTML:L==null?void 0:L.payment_info},null,8,FQ),((Z=L==null?void 0:L.other_info)==null?void 0:Z.manage_setup_fee)==="yes"?(r(),h("div",{key:0,innerHTML:L==null?void 0:L.setup_info},null,8,$Q)):x("",!0)])):x("",!0)]),s.isEditingItem?(r(),h("div",EQ,[o("span",null,m(s.formatNumber(L.unit_price)),1),i[22]||(i[22]=o("span",null,"x",-1)),o("span",null,m(A(sa)(L.quantity)),1)])):x("",!0),s.isEditingItem?x("",!0):(r(),h("div",UQ,[o("div",IQ,[((ne=L==null?void 0:L.variants)==null?void 0:ne.length)>0?(r(),h("span",QQ,m(s.formatNumber(L.variants.compare_price)),1)):x("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[23]||(i[23]=o("span",null,"x",-1)),o("span",null,m(A(sa)(L.quantity)),1)])])),L.bundle_items.length>0?(r(),E(To,{key:2,product:L},null,8,["product"])):x("",!0)]),o("div",DQ,[((ce=L==null?void 0:L.variants)==null?void 0:ce.length)>0?(r(),h("span",VQ,m(s.formatNumber(L.variants.compare_price)),1)):x("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",TQ,m(s.formatNumber(L.line_meta.original_unit_price)),1)):x("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[25]||(i[25]=o("span",null,"×",-1)),o("span",null,m(A(sa)(L.quantity)),1),((z=L==null?void 0:L.other_info)==null?void 0:z.item_status)!=="adjusted"?(r(),h(P,{key:2},[i[24]||(i[24]=o("span",{class:"text-system-mid"},"·",-1)),L.coupon_discount>0?(r(),h("span",MQ,m(s.formatNumber(L.subtotal)),1)):x("",!0),o("span",null,m(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):x("",!0)])]),o("td",LQ,[s.isEditingItem?x("",!0):(r(),h("div",RQ,[o("div",OQ,[((ue=L==null?void 0:L.variants)==null?void 0:ue.length)>0?(r(),h("span",PQ,m(s.formatNumber(L.variants.compare_price)),1)):x("",!0),L.line_meta&&L.line_meta.original_unit_price?(r(),h("span",HQ,m(s.formatNumber(L.line_meta.original_unit_price)),1)):x("",!0),o("span",null,m(s.formatNumber(L.unit_price)),1),i[26]||(i[26]=o("span",null,"x",-1)),o("span",null,m(A(sa)(L.quantity)),1),s.shouldShowUnitPriceRoundingTooltip(L)?(r(),E(p,{key:2,effect:"dark",content:A(u)("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,{class:"fct-unit-price-rounding-icon"},{default:d(()=>[n(A(ll))]),_:1})]),_:1},8,["content"])):x("",!0)])]))]),o("td",NQ,[o("div",KQ,[((ie=L==null?void 0:L.other_info)==null?void 0:ie.item_status)!=="adjusted"?(r(),h(P,{key:0},[L.coupon_discount>0?(r(),h("div",GQ,[o("span",zQ,m(s.formatNumber(L.subtotal)),1)])):x("",!0),o("span",null,m(s.formatNumber(s.getItemDisplayLineTotal(L))),1)],64)):x("",!0)])])]),s.taxSummary.displayMode!=="simplified"?(r(),h(P,{key:0},[s.getItemTaxRates(L).length?(r(!0),h(P,{key:0},te(s.getItemTaxRates(L),(re,Ee)=>{var ye,Ce,ve;return r(),h("tr",{key:"tax-rate-"+Ee,class:de(L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive")},[o("td",jQ,[o("span",qQ,m(s.formatTaxRateBadge(re)),1)]),o("td",YQ,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!((Ce=(ye=L.line_meta)==null?void 0:ye.tax_config)!=null&&Ce.inclusive)||((ve=s.orderSettings)==null?void 0:ve.reverse_charge_price_mode)==="dynamic")}])},[L.line_meta&&L.line_meta.tax_config&&L.line_meta.tax_config.inclusive?(r(),h(P,{key:0},[R(m(A(u)("incl.")),1)],64)):(r(),h(P,{key:1},[R("+")],64)),R(" "+m(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):L.tax_amount>0?(r(),h("tr",WQ,[o("td",JQ,m(A(u)("Tax"))+": "+m(s.formatNumber(L.tax_amount)),1)])):x("",!0)],64)):x("",!0),((J=L==null?void 0:L.other_info)==null?void 0:J.manage_setup_fee)==="yes"?(r(),h("tr",XQ,[o("td",ZQ,[o("span",eD,m(L==null?void 0:L.other_info.signup_fee_name),1)]),o("td",tD," + "+m(s.formatNumber(((N=L==null?void 0:L.other_info)==null?void 0:N.setup_fee_per_item)==="yes"?L.other_info.signup_fee*L.quantity:L.other_info.signup_fee)),1)])):x("",!0),s.taxSummary.displayMode!=="simplified"?(r(),h(P,{key:2},[s.getSubscriptionSetupFeeTaxRates(L).length?(r(!0),h(P,{key:0},te(s.getSubscriptionSetupFeeTaxRates(L),(re,Ee)=>{var ye;return r(),h("tr",{key:"setup-tax-rate-"+Ee,class:de(s.isSubscriptionSetupFeeInclusive(L)?"is-inclusive":"is-exclusive")},[o("td",aD,[o("span",lD,m(A(u)("Setup fee"))+": "+m(s.formatTaxRateBadge(re)),1)]),o("td",sD,[o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||((ye=s.orderSettings)==null?void 0:ye.reverse_charge_price_mode)==="dynamic")}])},[s.isSubscriptionSetupFeeInclusive(L)?(r(),h(P,{key:0},[R(m(A(u)("incl.")),1)],64)):x("",!0),R(m(s.formatNumber(re.tax_amount)),1)],2)])],2)}),128)):((ae=L==null?void 0:L.other_info)==null?void 0:ae.signup_fee_tax)>0&&((oe=L==null?void 0:L.other_info)==null?void 0:oe.manage_setup_fee)==="yes"?(r(),h("tr",nD,[o("td",oD,[R(m(A(u)("Setup fee tax"))+": ",1),o("span",{class:de(["fct-tax-amount",{"fct-tax-amount--reversed":s.order.is_reverse_charge_tax_order&&(!s.isSubscriptionSetupFeeInclusive(L)||((fe=s.orderSettings)==null?void 0:fe.reverse_charge_price_mode)==="dynamic")}])},m(s.formatNumber(L.other_info.signup_fee_tax)),3)])])):x("",!0)],64)):x("",!0),s.isEditingItem?(r(),h("tr",iD,[o("td",rD,[o("div",dD,[o("a",{href:"#",onClick:Ge(re=>s.handleAdjustQuantityModal(L),["prevent"])},m(A(u)("Adjust Quantity")),9,uD),o("a",{href:"#",onClick:Ge(re=>s.deleteProduct(H,L),["prevent"])},m(A(u)("Remove Item")),9,cD)])])])):x("",!0),i[27]||(i[27]=o("tr",{class:"last:hidden"},[o("td",{colspan:"4",class:"pt-1"},[o("div",{class:"bg-gray-divider dark:bg-dark-400 h-[1px] w-full mb-1"})])],-1))],64)):x("",!0)],64)}),128))])])])):x("",!0),s.order.order_items.length==0?(r(),h("p",AD,m(A(u)("No items found.")),1)):x("",!0)])]),_:1})]),_:1}),n(Se,{class:"fct-order-payment-card"},{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h2",pD,[o("span",null,m(A(u)("Payment")),1),n(fa,{status:s.order.payment_status,size:"small"},null,8,["status"])])]),_:1}),n(ke,null,{default:d(()=>{var L,H,j,W,G,Z,ne,ce,z,ue,ie;return[o("table",fD,[o("tbody",null,[o("tr",null,[o("td",null,m(A(u)("Subtotal")),1),o("td",null,[s.order.order_items.length>0?(r(),h("span",mD,m(A(sa)(s.uniqueItemsCount))+" "+m(A(Io)("item","items",s.uniqueItemsCount)),1)):x("",!0)]),o("td",null,m(s.formatNumber(s.order.subtotal)),1)]),n(Qd,{order:s.order,shippingAttributes:s.shippingSettings,shouldEnableEditing:s.isEditingItem,"onUpdate:shipping":s.updateShipping,shippingMethodsProps:s.shippingMethods,otherShippingMethodsProps:s.otherShippingMethods},null,8,["order","shippingAttributes","shouldEnableEditing","onUpdate:shipping","shippingMethodsProps","otherShippingMethodsProps"]),s.order.fee_total>0?(r(!0),h(P,{key:0},te(s.feeItems,J=>(r(),h("tr",{key:"fee-"+J.id},[o("td",null,m(J.title),1),i[28]||(i[28]=o("td",null,null,-1)),o("td",null,m(s.formatNumber(J.subtotal)),1)]))),128)):x("",!0),s.order.order_items.length>0&&(s.isEditingItem||s.hasCoupon)?(r(),E($i,{key:1,order:s.order,couponsAttributes:s.coupons,hasCouponAttributes:s.hasCoupon,appliedCouponsAttributes:s.appliedCoupons,action:"edit_order",shouldManageCoupon:s.isEditingItem,"onUpdate:coupons":s.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","couponsAttributes","hasCouponAttributes","appliedCouponsAttributes","shouldManageCoupon","onUpdate:coupons"])):x("",!0),s.hasCoupon?x("",!0):(r(),E(Ei,{key:2,order:s.order,discountAttributes:s.discount,hasCoupon:s.hasCoupon,shouldEnableEditing:s.isEditingItem,"onUpdate:customDiscount":s.updateCustomDiscount},null,8,["order","discountAttributes","hasCoupon","shouldEnableEditing","onUpdate:customDiscount"])),!s.hasCoupon&&s.order.coupon_discount_total>0?(r(),h("tr",hD,[o("td",null,m(A(u)("Coupon Discount")),1),i[29]||(i[29]=o("td",null,null,-1)),o("td",null,"- "+m(s.formatNumber(s.order.coupon_discount_total)),1)])):x("",!0),s.isEditingItem?(r(),h("tr",_D,[o("td",vD,m(A(u)("Tax will be recalculated on save")),1)])):s.taxSummary.payableTax>0||s.taxSummary.inclusiveTax>0||s.taxSummary.inclusiveFeeTax>0||s.taxSummary.taxRateLines.length||s.taxSummary.shippingTax>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedTaxTotal>0||s.order.is_reverse_charge_tax_order&&s.taxSummary.reversedShippingTax>0?(r(),h("tr",gD,[o("td",yD,[s.taxSummary.displayMode==="simplified"&&s.taxSummary.simpleLine?(r(),h("div",bD,[o("span",wD,[o("span",null,m(s.taxSummary.simpleLine.label),1),s.taxSummary.simpleLine.hasDetails?(r(),E(w,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:d(()=>[o("a",CD,m(A(u)("See details"))+" ▾",1)]),default:d(()=>[n(Kr,{"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"])]),_:1})):x("",!0)]),o("span",null,m(s.taxSummary.simpleLine.value),1)])):(r(),E(Kr,{key:1,"tax-summary":s.taxSummary,order:s.order,"tax-breakdown-should-show":s.taxBreakdownShouldShow},null,8,["tax-summary","order","tax-breakdown-should-show"]))])])):x("",!0),o("tr",kD,[o("td",null,m(A(u)("Total")),1),i[30]||(i[30]=o("td",null,null,-1)),o("td",null,m(s.formatNumber(s.order.total_amount-(s.taxSummary.rcTotalAdjustment||0))),1)]),o("tr",BD,[o("td",null,m(A(u)("Total Paid")),1),i[31]||(i[31]=o("td",null,null,-1)),o("td",null,m(s.formatNumber(((H=(L=s.order)==null?void 0:L.business_info)==null?void 0:H.net_total_paid)??((j=s.order)==null?void 0:j.total_paid))),1)]),((W=s.order)==null?void 0:W.total_refund)>0?(r(),h("tr",xD,[o("td",null,m(A(u)("Total Refund")),1),i[32]||(i[32]=o("td",null,null,-1)),o("td",null,"- "+m(s.formatNumber((G=s.order)==null?void 0:G.total_refund)),1)])):x("",!0),(((ne=(Z=s.order)==null?void 0:Z.business_info)==null?void 0:ne.net_total_paid)??s.order.total_paid)-((ce=s.order)==null?void 0:ce.total_refund)!=0?(r(),h("tr",SD,[o("td",null,m(A(u)("Net Payment")),1),i[33]||(i[33]=o("td",null,null,-1)),o("td",FD,m(s.getNetPayment()),1)])):x("",!0),s.order.total_amount-((z=s.order)==null?void 0:z.total_paid)>0?(r(),h("tr",$D,[o("td",null,m(A(u)("Total Due")),1),i[34]||(i[34]=o("td",null,null,-1)),o("td",ED,m(s.getTotalDue()),1)])):x("",!0),s.order.total_amount-(((ue=s.order)==null?void 0:ue.total_paid)-((ie=s.order)==null?void 0:ie.total_refund))<0?(r(),h("tr",UD,[o("td",null,[o("p",ID,[n(A(nm),{class:"w-6 text-amber-500 mr-2"}),R(" "+m(A(u)("Total Refund Owed")),1)])]),i[35]||(i[35]=o("td",null,null,-1)),o("td",QD,m(s.getDueRefund()),1)])):x("",!0)])])]}),_:1})]),_:1}),s.order.transactions&&s.order.transactions.length?(r(),E(Se,{key:0,class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Transaction Details"),border_bottom:"",title_size:"small"},{action:d(()=>{var L;return[s.order.total_amount-((L=s.order)==null?void 0:L.total_paid)>0&&s.order.status!=="canceled"&&s.markingOrderAsPaid===!1?(r(),E(S,{key:0,trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:s.handleCommand},{dropdown:d(()=>[n(b,null,{default:d(()=>[n(k,{command:"custom-payment-link"},{default:d(()=>[R(m(A(u)("Custom Payment Link"))+" ",1),n(p,{effect:"dark",content:A(u)("Due amount is remaining, Get a custom payment link to send to the customer."),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(v,null,{default:d(()=>[n(A(ll))]),_:1})]),_:1},8,["content"])]),_:1}),n(k,{command:"mark-order-paid"},{default:d(()=>[R(m(A(u)("Mark order as paid")),1)]),_:1}),s.canSendPaymentReminder?(r(),E(k,{key:0,command:"send-payment-reminder",disabled:s.sendingPaymentReminder},{default:d(()=>[R(m(A(u)("Send Payment Reminder")),1)]),_:1},8,["disabled"])):x("",!0)]),_:1})]),default:d(()=>[n(_,{size:"small"},{default:d(()=>[R(m(A(u)("Collect Payments"))+" ",1),n(Y,{name:"ChevronDown"})]),_:1}),n(Y,{name:"More"})]),_:1},8,["onCommand"])):x("",!0)]}),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[n(Ud,{onReload:i[5]||(i[5]=L=>s.reloadOrder()),onTriggerRefundModal:s.triggerRefundModal,transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["onTriggerRefundModal","transactions","order_id","order-currency"]),n(Zp,{onReload:i[6]||(i[6]=L=>s.reloadOrder()),transactions:s.order.transactions,order_id:s.order.id,"order-currency":s.order.currency},null,8,["transactions","order_id","order-currency"])]),_:1})]),_:1})):x("",!0),n(U,{title:A(u)("Mark as paid"),modelValue:s.transactionMedium,"onUpdate:modelValue":i[10]||(i[10]=L=>s.transactionMedium=L)},{footer:d(()=>[Wt((r(),E(_,{plan:"",type:"primary",onClick:s.markOrderAsPaid,disabled:s.markingOrderAsPaid},{default:d(()=>[R(m(A(u)("Mark Paid")),1)]),_:1},8,["onClick","disabled"])),[[I,s.markingOrderAsPaid]])]),default:d(()=>[o("div",null,[n(B,{"label-position":"top"},{default:d(()=>[n(F,{"label-position":"top",label:A(u)("Payment method")},{default:d(()=>[n(D,{modelValue:s.otherData.payment_method,"onUpdate:modelValue":i[7]||(i[7]=L=>s.otherData.payment_method=L)},{default:d(()=>[(r(!0),h(P,null,te(s.paymentMethodOption,L=>(r(),E($,{key:L.value,label:L.name,value:L.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(F,{"label-position":"top",label:A(u)("Vendor charge id")},{default:d(()=>[n(g,{modelValue:s.otherData.vendor_charge_id,"onUpdate:modelValue":i[8]||(i[8]=L=>s.otherData.vendor_charge_id=L)},null,8,["modelValue"])]),_:1},8,["label"]),n(F,{"label-position":"top",label:A(u)("Notes")},{default:d(()=>[n(g,{rows:2,type:"textarea",placeholder:A(u)("Please enter the payment note..."),modelValue:s.otherData.mark_paid_note,"onUpdate:modelValue":i[9]||(i[9]=L=>s.otherData.mark_paid_note=L)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["title","modelValue"]),s.order.licenses?(r(),E(Se,{key:1,class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Licenses"),title_size:"small"},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(od,{licenses:s.order.licenses,columns:["product"]},null,8,["licenses"])]),_:1})]),_:1})):x("",!0),n(Se,{class:"overflow-hidden mb-0"},{default:d(()=>[n(Ve,{title:A(u)("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(iA,{onReload:s.reloadOrder,activities:s.order.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})]),o("div",DD,[o("div",VD,[(r(!0),h(P,null,te(s.order.subscriptions,(L,H)=>(r(),E(dI,{key:L.id,subscription:L,order:s.order,index:H,getOrderUrl:s.getOrderUrl},null,8,["subscription","order","index","getOrderUrl"]))),128)),s.order.customer?(r(),E(ui,{key:0,order:s.order,shouldEnableEditing:!0,onOnOrderUpdated:s.onBusinessInfoOrderUpdated},null,8,["order","onOnOrderUpdated"])):x("",!0),n(Fi,{orderId:s.order.id,note:s.order.note,shouldEnableEditing:!0},null,8,["orderId","note"]),n(di,{"bind-to-id":s.order.id,"bind-to-type":"Order",selectedLabels:s.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]),(M=s.order)!=null&&M.order_operation?(r(),E(Xp,{key:1,order_operation:(O=s.order)==null?void 0:O.order_operation},null,8,["order_operation"])):x("",!0)]),s.order?(r(),h("div",TD,[n(pn,{ref:"dynamicTemplates",filter:"single_order_page","widgets-query":{order_uuid:s.order.uuid,order_id:s.order.id},data:{order:s.order}},null,8,["widgets-query","data"])])):x("",!0)])]),n(U,{modelValue:s.adjustQuantityModal,"onUpdate:modelValue":i[13]||(i[13]=L=>s.adjustQuantityModal=L),title:A(u)("Adjust Quantity"),width:"35%","align-center":"","append-to-body":!0,class:"fct-adjust-quantity-modal",onClose:i[14]||(i[14]=()=>{s.adjustQuantityModal=!1,s.adjustItem={},s.tmpAdjustedItem={}})},{footer:d(()=>[o("div",OD,[n(_,{onClick:i[11]||(i[11]=L=>s.adjustQuantityModal=!1),type:"info",soft:""},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(_,{type:"primary",onClick:i[12]||(i[12]=L=>s.saveAdjustedProductQuantity(s.tmpAdjustedItem))},{default:d(()=>[R(m(A(u)("Done")),1)]),_:1})])]),default:d(()=>[o("div",MD,[o("div",LD,[i[36]||(i[36]=R(" Adjust the quantity for ",-1)),o("strong",null,m(s.adjustItem.variation_display_title||s.adjustItem.title),1)]),o("div",RD,[o("label",null,m(A(u)("Quantity")),1),s.isEditingItem?(r(),E(qp,{key:0,item:s.adjustItem,"onUpdate:value":s.updateQuantity},null,8,["item","onUpdate:value"])):x("",!0)])])]),_:1},8,["modelValue","title"]),n(jp,{ref_key:"productItemModal",ref:t,order_id:e.order_id,searchQueryParent:s.searchQuery,orderParent:s.order,"onUpdate:searchQuery":s.updateSearchQuery},null,8,["order_id","searchQueryParent","orderParent","onUpdate:searchQuery"]),n(U,{"append-to-body":!0,width:"40%",modelValue:s.createProductModal,"onUpdate:modelValue":i[15]||(i[15]=L=>s.createProductModal=L),title:A(u)("Add New Product")},{default:d(()=>[s.createProductModal?(r(),h("div",PD,[n(Ci,{customModal:"order_modal","onUpdate:createProductModal":s.updateProductModal,onProcess_custom:s.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"]),n(U,{"append-to-body":!0,modelValue:s.showRefundModal,"onUpdate:modelValue":i[17]||(i[17]=L=>s.showRefundModal=L),title:A(u)("Refund Transaction"),onClose:i[18]||(i[18]=()=>{s.changes_made=0,s.showRefundModal=!1,s.fetch()})},{default:d(()=>[Wt(n(Q5,{"element-loading-text":A(u)("Refund initiating on remote..."),order_id:e.order_id,order:s.order,showRefundModal:s.showRefundModal,onProcessing_refund:i[16]||(i[16]=L=>s.processing_refund=L),subscription:s.subscription,is_subscription:s.isSubscription,subscription_status:s.subscriptionStatus},null,8,["element-loading-text","order_id","order","showRefundModal","subscription","is_subscription","subscription_status"]),[[I,s.processing_refund]])]),_:1},8,["modelValue","title"]),s.loading?(r(),E(V,{key:0,animated:""},{default:d(()=>[n(Q),n(Q),n(Q)]),_:1})):x("",!0),n(U,{modelValue:s.nextInvoiceModal,"onUpdate:modelValue":i[19]||(i[19]=L=>s.nextInvoiceModal=L),title:A(u)("Custom payment link")},{default:d(()=>[n(G5,{order_id:e.order_id,order:s.order,onReload:s.fetch},null,8,["order_id","order","onReload"])]),_:1},8,["modelValue","title"])])],64)):x("",!0)])):x("",!0)])):x("",!0)],64)}}}),KD={class:"fct-create-order-wrapper fct-layout-width"},GD={class:"single-page-header"},zD={class:"single-page-header-title-wrap"},jD={class:"single-page-body"},qD={class:"fct-create-order"},YD={class:"fct-create-order-main"},WD={class:"fct-browse-product-form-group pb-5 mx-5"},JD={key:0,class:"fct-table-wrap fct-table-transparent-header"},XD={class:"fct-product-info-card"},ZD={class:"fct-product-info-media"},eV=["src","alt"],tV={class:"fct-product-info-details"},aV={class:"fct-product-info-name"},lV={class:"product-sub-name product-sub-name--wrap"},sV={class:"mt-1"},nV={key:0,class:"line-through mr-3"},oV={key:1},iV={key:0},rV={class:"fct-input-number-wrap"},dV={key:0},uV={key:0},cV={key:1},AV={key:0},pV={class:"fct-table-border fct-table-order-details"},fV={key:0},mV={key:3},hV={colspan:"3",style:{"text-align":"right","font-style":"italic",opacity:"0.65","font-size":"0.85em"}},_V={class:"fct-create-order-aside"},vV={class:"fct-admin-sidebar"},gV={key:0},yV={name:"CreateOrder",components:{OrderBulkActions:Ed,Transaction:Ud,Badge:fa,IconButton:at,CopyToClipboard:Ea,Notes:Fi,Coupon:$i,CustomDiscount:Ei,OrderCustomerInformation:ui,Shipping:Qd},data(){return{loading:!1,calculating:!1,customModal:!1,cartItems:{},discount:{},shippingSettings:{},customItem:{title:"",price:0,quantity:1,is_physical:"yes"},timeout:"",widgets:[],order:{applied_coupon:[],customer_id:"",customer:{id:null,full_name:"",email:"",phone:""},status:"processing",subtotal:0,manual_discount_total:0,shipping_tax:0,shipping_total:0,tax_total:0,total_amount:0,order_items:[],payment_status:"pending",payment_method:"offline_payment",shipping_status:"unshipped"},searching:!1,orderSettings:!1,orderAddModal:!1,availableProducts:[],selectedProducts:[],deletedItems:[],searchQuery:"",change_order_infos:!1,change_payment_infos:!1,changes_made:0,createProductModal:!1,coupons:[],appliedCoupons:[],hasCoupon:!1,selectedLabels:[],selectedCustomerCountry:"",selectedCustomerAddress:null,shippingMethods:[],otherShippingMethods:[]}},watch:{order:{handler(){this.changes_made++},deep:!0}},computed:{beforeRouteLeave(e,t,a){this.redirectRouteName=e.name,this.changes_made?this.outerVisible=!0:a()},hasSubscriptionItem(){return this.order.order_items.some(e=>e.payment_type==="subscription")}},methods:{getImageUrl(e,t){return e&&e!==null&&e!==void 0?e:t+"images/empty-image.svg"},getClass(e){return{"w-full":!0,"border border-solid border-gray-divider rounded":e&&e!==null&&e!==void 0}},resetUnsaved(){this.changes_made=0},updateCustomModal(e){this.customModal=e},updateProductModal(e){this.createProductModal=e},updateSearchQuery(e){this.searchQuery=e,this.calculateLine()},updateQuantity(e,t,a){parseInt(t)<0?this.handleError(`You have exceeded the stock limit! Current stock is : ${t}`):a.quantity=e,a.updated_stock=t,this.calculateLine()},calculateLine(){return this.hasCoupon?this.$refs.reApplyCouponRef.reApplyCoupon():Id(this.order,this.hasCoupon)},deleteProduct(e,t){t.id&&this.deletedItems.push(t.id),this.order.order_items.splice(e,1),this.calculateLine()},processCustom(e){e.order_id=this.order_id,this.order.order_items.unshift(e),this.customModal=!1,this.calculateLine()},update(){delete this.order.customer.orders,this.loading=!0;const e={...this.order};delete e.customer,Ae.post("orders",{...e,discount:this.discount,shipping:this.shippingSettings,labels:this.selectedLabels,user_tz:lt.tz.guess(),trigger:"on_admin_create"}).then(t=>{q.success(t.message),setTimeout(()=>{this.$router.push({name:"view_order",params:{order_id:t==null?void 0:t.order_id}})},300)}).catch(t=>{var a;t.status_code=="422"?q.validationErrors(t):q.error((a=t.data)==null?void 0:a.message)}).finally(()=>{this.loading=!1,this.changes_made=0})},reloadOrder(){return window.location.reload()},addProduct(){this.createProductModal=!this.createProductModal},onChangeLabel(e){this.selectedLabels=e},saveNoteModal(e){this.order.note=e},updateCustomDiscount(e){this.discount=e,this.changes_made++},updateCoupons(e,t,a){this.coupons=e,this.appliedCoupons=t,this.hasCoupon=a},updateShipping(e,t){var a;(a=this.order)==null||a.order_items.forEach((l,s)=>{l.shipping_charge=dt.get(e,`${l.id}.shipping_charge`)}),this.order.shipping_total=t,this.changes_made++},isDisabled(e){return(e==null?void 0:e.payment_type)==="subscription"},updateCustomPrice(e){const t=parseFloat(e.custom_price);!isNaN(t)&&t>=0?(e.has_custom_price||(e.original_price=e.price,e.original_unit_price=e.unit_price,e.has_custom_price=!0),e.price=t,e.unit_price=Math.round(t*100)):e.has_custom_price&&(e.price=e.original_price,e.unit_price=e.original_unit_price,e.has_custom_price=!1),this.calculateLine()},fetchShippingMethods(){const e=[];this.order.order_items.length>0&&this.order.order_items.forEach(t=>{e.push({id:t.object_id,quantity:t.quantity,unit_price:t.unit_price,discount_total:t.discount_total})}),Ae.get("orders/shipping_methods",{country_code:this.selectedCustomerCountry,order_items:e}).then(t=>{this.shippingMethods=t.shipping_methods,this.otherShippingMethods=t.other_shipping_methods}).finally(()=>{})}},mounted(){this.fetchShippingMethods(),window.onbeforeunload=()=>{if(this.changes_made>0)return!0}}},bV=Object.assign(yV,{setup(e){const t=T(),a=T(!0),l=()=>t.value.fetchBySearch(),s=()=>{l()};return(i,c)=>{const p=C("el-breadcrumb-item"),f=C("el-breadcrumb"),_=C("el-input"),g=C("el-button"),y=C("router-link"),v=C("el-table-column"),w=C("el-input-number"),k=C("el-table"),b=C("el-dialog"),S=Va("loading");return r(),h("div",KD,[n(un,{isActive:i.changes_made>0?"is-active":"",onDiscard:i.reloadOrder,onSave:i.update,loading:i.loading},null,8,["isActive","onDiscard","onSave","loading"]),o("div",GD,[o("div",zD,[n(f,{"separator-icon":A(Al)},{default:d(()=>[n(p,{to:{name:"orders"}},{default:d(()=>[R(m(i.$t("Orders")),1)]),_:1}),n(p,null,{default:d(()=>[R(m(i.$t("Create Order")),1)]),_:1})]),_:1},8,["separator-icon"])])]),o("div",jD,[o("div",qD,[o("div",YD,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:i.$t("Products"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",WD,[n(_,{placeholder:i.$t("Search products..."),onKeyup:c[0]||(c[0]=$=>l()),modelValue:i.searchQuery,"onUpdate:modelValue":c[1]||(c[1]=$=>i.searchQuery=$)},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["placeholder","modelValue"]),n(g,{onClick:s,type:"info",soft:"",class:"el-button--x-small"},{default:d(()=>[R(m(i.$t("Browse")),1)]),_:1})]),i.order.order_items.length>0?(r(),h("div",JD,[Wt((r(),E(k,{data:i.order.order_items,class:"fct-table w-full","row-key":"id","default-expand-all":"","element-loading-text":i.$t("Recalculating with product latest info...")},{default:d(()=>[n(v,{"min-width":"450",label:i.$t("Product")},{default:d($=>{var D,F,B,U;return[o("div",XD,[o("div",ZD,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:$.row.post_id}}},{default:d(()=>[o("img",{src:i.getImageUrl($.row.featured_media,i.appVars.asset_url),alt:$.row.title,class:de(i.getClass($.row.featured_media))},null,10,eV)]),_:2},1032,["to"])]),o("div",tV,[o("div",aV,[n(y,{class:"link",to:{name:"product_edit",params:{product_id:$.row.post_id}}},{default:d(()=>[R(m($.row.post_title)+" ",1),o("span",lV,"- "+m($.row.variation_display_title||$.row.title),1)]),_:2},1032,["to"])]),o("div",sV,[R(m(i.formatNumber($.row.price))+" ",1),parseInt($.row.unit_price)>parseInt($.row.price)?(r(),h("span",nV,m(i.formatNumber($.row.unit_price)),1)):x("",!0),$.row.payment_type==="subscription"&&((F=(D=$.row)==null?void 0:D.other_info)==null?void 0:F.manage_setup_fee)==="yes"?(r(),h("div",oV,[o("span",null,m($.row.other_info.signup_fee_name)+" : "+m(i.formatNumber($.row.other_info.signup_fee)),1),((U=(B=$.row)==null?void 0:B.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",iV,[c[6]||(c[6]=o("span",null,"x",-1)),o("span",null,m($.row.quantity),1)])):x("",!0)])):x("",!0)])])])]}),_:1},8,["label"]),n(v,{width:"120",label:i.$t("Quantity")},{default:d($=>[o("div",rV,[n(qp,{item:$.row,"onUpdate:value":i.updateQuantity,isDisabled:i.isDisabled($.row),min:1},null,8,["item","onUpdate:value","isDisabled"])])]),_:1},8,["label"]),n(v,{width:120,label:i.$t("Total")},{default:d($=>{var D,F,B,U;return[o("div",null,m(i.formatNumber($.row.line_total)),1),$.row.payment_type=="subscription"&&((F=(D=$.row)==null?void 0:D.other_info)==null?void 0:F.manage_setup_fee)=="yes"?(r(),h("div",dV,[c[7]||(c[7]=o("span",null,"+",-1)),((U=(B=$.row)==null?void 0:B.other_info)==null?void 0:U.setup_fee_per_item)=="yes"?(r(),h("span",uV,[o("span",null,m(i.formatNumber($.row.other_info.signup_fee*$.row.quantity)),1)])):(r(),h("span",cV,m(i.formatNumber($.row.other_info.signup_fee)),1))])):x("",!0)]}),_:1},8,["label"]),i.hasSubscriptionItem?(r(),E(v,{key:0,width:"140",label:i.$t("Custom Price")},{default:d($=>[$.row.payment_type==="subscription"?(r(),h("div",AV,[n(w,{modelValue:$.row.custom_price,"onUpdate:modelValue":D=>$.row.custom_price=D,min:0,precision:2,step:.01,"controls-position":"right",placeholder:i.$t("Custom price"),size:"small",onChange:D=>i.updateCustomPrice($.row),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder","onChange"])])):x("",!0)]),_:1},8,["label"])):x("",!0),n(v,{width:50},{default:d($=>[n(at,{bg:"transparent",border:"transparent",tag:"a",size:"x-small",onClick:Ge(D=>i.deleteProduct($.$index,$.row),["prevent"])},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data","element-loading-text"])),[[S,i.calculating]])])):x("",!0)]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{border_bottom:"",title:i.$t("Payment"),title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("table",pV,[o("tbody",null,[o("tr",null,[o("td",null,m(i.$t("Subtotal")),1),o("td",null,[i.order.order_items.length>0?(r(),h("span",fV,m(A(sa)(i.order.order_items.length))+" "+m(i.order.order_items.length===1?i.$t("item"):i.$t("items")),1)):x("",!0)]),o("td",null,m(i.formatNumber(i.order.subtotal)),1)]),i.order.order_items.length>0&&!i.discount.value?(r(),E($i,{key:0,order:i.order,couponsAttributes:[],hasCouponAttributes:!1,appliedCouponsAttributes:[],action:"create_order",shouldManageCoupon:!0,"onUpdate:coupons":i.updateCoupons,ref:"reApplyCouponRef"},null,8,["order","onUpdate:coupons"])):x("",!0),i.hasCoupon?x("",!0):(r(),E(Ei,{key:1,order:i.order,hasCoupon:i.hasCoupon,"onUpdate:customDiscount":i.updateCustomDiscount},null,8,["order","hasCoupon","onUpdate:customDiscount"])),x("",!0),i.selectedCustomerCountry&&i.order.order_items.length>0?(r(),h("tr",mV,[o("td",hV,m(i.$t("Tax will be calculated on save")),1)])):x("",!0)]),o("tfoot",null,[o("tr",null,[o("td",null,m(i.$t("Total")),1),c[8]||(c[8]=o("td",null,null,-1)),o("td",null,m(i.formatNumber(i.order.total_amount)),1)])])])]),_:1})]),_:1})]),o("div",_V,[o("div",vV,[n(Fi,{note:i.order.note,onWhenNoteEditIsDone:c[2]||(c[2]=$=>{i.saveNoteModal($)})},null,8,["note"]),n(ui,{order:i.order,onOnAddressSelected:c[3]||(c[3]=$=>{if(i.fetchShippingMethods(),$===null){i.selectedCustomerCountry="",i.selectedCustomerAddress=null;return}i.selectedCustomerCountry=$.country,i.selectedCustomerAddress=$,$.type==="shipping"?i.order.shipping_address_id=$.id:i.order.billing_address_id=$.id}),onOnAddressRemove:c[4]||(c[4]=()=>{i.selectedCustomerCountry="",i.selectedCustomerAddress=null,i.order.billing_address_id=null,i.order.shipping_address_id=null,i.fetchShippingMethods()})},null,8,["order"]),n(di,{selectedLabels:i.selectedLabels,"onUpdate:updateLabel":i.onChangeLabel},null,8,["selectedLabels","onUpdate:updateLabel"])])])]),n(jp,{ref_key:"productItemModal",ref:t,searchQueryParent:i.searchQuery,orderParent:i.order,"onUpdate:searchQuery":i.updateSearchQuery},null,8,["searchQueryParent","orderParent","onUpdate:searchQuery"]),n(b,{"append-to-body":!0,modelValue:i.createProductModal,"onUpdate:modelValue":c[5]||(c[5]=$=>i.createProductModal=$),title:i.$t("Add New Product")},{default:d(()=>[i.createProductModal?(r(),h("div",gV,[n(Ci,{customModal:"order_modal","onUpdate:createProductModal":i.updateProductModal,onProcess_custom:i.processCustom},null,8,["onUpdate:createProductModal","onProcess_custom"])])):x("",!0)]),_:1},8,["modelValue","title"])])])}}});class wV extends tl{constructor(){super(...arguments);Pe(this,"data",{form:bd()})}get controllerKey(){return"Customer"}}function ef(){return wV.init()}const CV={class:"setting-wrap"},kV={class:"setting-wrap-inner"},BV={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},xV={class:"grid gap-3 mb-6"},SV={class:"grid gap-3 mb-6"},FV={class:"grid gap-3 mb-6"},$V={class:"grid gap-3"},Jl=Object.assign({name:"StoreSettings"},{__name:"StoreSettings",setup(e){const t=ef(),{form:a}=t.data,l=bs(),s=T([]),i=T([]),c=T(!0),p=T(!1),f=T(!0),_=T({}),g=nl(),y=T(g.name),v=T(g.meta.title||"Store Settings"),w=()=>y.value==="reminders",k=K(()=>y.value==="appearance"),b=()=>w()?"email-notification/reminders":"settings/store",S=()=>{var U;p.value=!0;let B=a.values;Array.isArray(B.store_logo)&&B.store_logo.length>0&&(B.store_logo=(U=B.store_logo)==null?void 0:U[0]),w()||(B.settings_name=y.value),Ae.post(b(),{...B}).then(Q=>{if(q.success(u("Settings saved successfully")),y.value==="store_setup"){const V=["currency","currency_position","currency_separator","decimal_separator","decimal_points","order_mode","store_name","store_logo","weight_unit","dimension_unit"],I={};if(V.forEach(function(H){a.values[H]!==void 0&&(I[H]=a.values[H])}),I.currency){const H=ze.get("currency_signs",{});H[I.currency]!==void 0&&(I.currency_sign=H[I.currency])}I.decimal_points!==void 0&&(I.is_zero_decimal=parseInt(I.decimal_points,10)===0);const M=ze.get("shop",{}),L=["currency","currency_position","decimal_separator","decimal_points"].some(function(H){return I[H]!==void 0&&I[H]!==M[H]});ze.mergeConfig({shop:Object.assign({},M,I)}),ft.setLocale(),L&&window.dispatchEvent(new CustomEvent("fluentCartCurrencyChange"))}}).catch(Q=>{var V;Q.status_code=="422"?q.validationErrors(Q):q.error((V=Q.data)==null?void 0:V.message),a.setValidationErrors(Q),_.value=Q}).finally(()=>{p.value=!1,f.value=!1,c.value=!1})},$=T(!1),D=()=>{c.value=!0,$.value=!1;const B=w()?{}:{settings_name:y.value};Ae.get(b(),B).then(U=>{a.setSchema(U.fields).setDefaults(U.settings).initForm(),s.value=U.settings,i.value=U.fields,c.value=!1,f.value=!1,p.value=!1}).catch(U=>{$.value=!0,c.value=!1,f.value=!1,p.value=!1})},F=()=>{l.bind(["mod+s"],B=>{B.preventDefault(),S()})};return be(()=>g.name,(B,U)=>{var Q;y.value=B,v.value=((Q=g.meta)==null?void 0:Q.title)||"Store Settings",l.unbind("mod+s"),F(),D()}),Ie(()=>{F(),D()}),zc(()=>{l.unbind("mod+s")}),(B,U)=>{const Q=C("el-skeleton-item"),V=C("el-skeleton"),I=C("el-form");return r(),h("div",CV,[n(Ua,{heading:v.value,loading:p.value,onOnSave:S},null,8,["heading","loading"]),o("div",kV,[n(Ia),$.value?(r(),E(Se,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[o("p",null,m(A(u)("There is an error in the form fields. Please try reloading the page.")),1)]),_:1})]),_:1})):(r(),h(P,{key:0},[f.value?(r(),h("div",BV,[n(V,{loading:f.value,animated:""},{template:d(()=>[o("div",xV,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",SV,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",FV,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",$V,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),f.value?x("",!0):(r(),h(P,{key:1},[A(a).isReady?(r(),E(I,{key:0,class:"relative"},{default:d(()=>[c.value?(r(),E(Se,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(V,{rows:5,animated:""},{default:d(()=>[n(Q),n(Q,{variant:"text"}),n(Q,{variant:"text"})]),_:1})]),_:1})]),_:1})):x("",!0),c.value?x("",!0):(r(),E(Si,{key:1,form:A(a),showSubmitButton:!k.value,onOnSubmitButtonClick:S,submitButtonText:A(u)("Save"),loading:p.value,onOnChange:U[0]||(U[0]=M=>{}),"validation-errors":_.value},null,8,["form","showSubmitButton","submitButtonText","loading","validation-errors"]))]),_:1})):x("",!0)],64))],64))])])}}}),EV={};function UV(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const IV=nt(EV,[["render",UV]]),QV={name:"Licensing",components:{Refresh:Zc,Badge:fa,DynamicIcon:Y,CopyToClipboard:Ea,SettingsHeader:Ua,CardBody:ke,CardContainer:Se,AdminNotice:Ia},props:["disabled"],data(){return{loading:!0,verifying:!1,licenseData:{},licenseKey:"",showNewLicenseInput:!1,errorMessage:""}},computed:{purchaseLink(){return ze.get("purchase_fluent_cart_link")}},mounted(){this.disabled||this.getSettings()},methods:{formatDate:Us,translate:u,getSettings(){this.errorMessage="",this.loading=!0,Ae.get("settings/license",{verify:!0}).then(e=>{this.licenseData=e}).catch(e=>{q.error(e)}).finally(()=>{this.loading=!1})},verifyLicense(){if(!this.licenseKey){q.error(u("Please provide a license key")),this.errorMessage=u("Please provide a license key");return}this.verifying=!0,this.errorMessage="",Ae.post("settings/license",{license_key:this.licenseKey}).then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.data)}).finally(()=>{this.verifying=!1})},deactivateLicense(){this.verifying=!0,Ae.delete("settings/license").then(e=>{this.licenseData=e,e.notice&&window.dispatchEvent(new CustomEvent("fct-license-updated",{detail:e.notice}))}).catch(e=>{q.error(e)}).finally(()=>{this.verifying=!1})},maskLicense(e){if(!e)return"";const t=e.slice(0,4),a=e.slice(-4),l="*".repeat(e.length-8);return`${t}${l}${a}`}}},DV={class:"setting-wrap"},VV={class:"setting-wrap-inner"},TV={key:0,class:"fluent_cart_configure_integration_body"},MV={key:0,class:"fct-license-box-content"},LV=["href"],RV={class:"fct-license-box-content-details"},OV={class:"label"},PV={class:"license-key"},HV={class:"label"},NV={key:1,class:"w-full items-start"},KV={key:1,class:"fct-license-box-content"},GV={class:"fct-license-box-content-details"},zV={key:0},jV={class:"label"},qV={class:"license-key"},YV={class:"label"},WV={key:2,class:"fct-license-box-content"},JV={key:0},XV=["href"],ZV=["innerHTML"];function eT(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("DynamicIcon"),g=C("CopyToClipboard"),y=C("el-input"),v=C("el-button"),w=C("CardBody"),k=C("CardContainer"),b=Va("loading");return r(),h("div",DV,[n(c,{heading:i.translate("Licensing"),"show-save-button":!1},null,8,["heading"]),o("div",VV,[n(p),n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),o("div",null,[!a.disabled&&!s.loading?Wt((r(),h("div",TV,[o("div",{class:de(["fluent_cart_license_box","fct_license_"+s.licenseData.status])},[s.licenseData.status=="expired"?(r(),h("div",MV,[s.showNewLicenseInput?(r(),h("div",NV,[o("h3",null,m(i.translate("Your License Key")),1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[1]||(t[1]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"])])):(r(),h(P,{key:0},[n(_,{name:"GradientWarningCircle"}),o("h3",null,m(i.translate("Looks like your license key has been Expired!")),1),o("p",null,[R(m(i.translate("Have a new license Key?"))+" ",1),o("a",{onClick:t[0]||(t[0]=Ge(S=>s.showNewLicenseInput=!s.showNewLicenseInput,["prevent"])),href:"#"},m(i.translate("Click here")),1),t[7]||(t[7]=R()),s.licenseData.renew_url?(r(),h(P,{key:0},[t[6]||(t[6]=R("or ",-1)),o("a",{href:s.licenseData.renew_url,target:"_blank"},m(i.translate("Purchase a new license")),9,LV)],64)):x("",!0)]),o("div",RV,[o("p",null,[o("span",OV,m(i.translate("License Key")),1),o("span",PV,[R(m(i.maskLicense(s.licenseData.license_key))+" ",1),n(g,{text:s.licenseData.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),o("p",null,[o("span",HV,m(i.translate("Expired At")),1),R(" "+m(i.formatDate(s.licenseData.expires,!0)),1)])])],64))])):s.licenseData.status=="valid"?(r(),h("div",KV,[n(_,{name:"GradientCheckCircle"}),o("h3",null,m(i.translate("Congratulations! Your license key is valid and activated")),1),o("p",null,[R(m(i.translate("Want to deactivate this license?"))+" ",1),o("a",{onClick:t[2]||(t[2]=Ge(S=>i.deactivateLicense(),["prevent"])),href:"#"},m(i.translate("Click here")),1)]),o("div",GV,[s.licenseData.license_key?(r(),h("p",zV,[o("span",jV,m(i.translate("License Key")),1),o("span",qV,m(i.maskLicense(s.licenseData.license_key)),1)])):x("",!0),o("p",null,[o("span",YV,m(i.translate("Expires")),1),R(" "+m(s.licenseData.expires!=="lifetime"?i.formatDate(s.licenseData.expires,!0):s.licenseData.expires),1)])])])):(r(),h("div",WV,[o("h3",null,m(i.translate("Please Provide a license key of"))+" FluentCart ",1),n(y,{modelValue:s.licenseKey,"onUpdate:modelValue":t[3]||(t[3]=S=>s.licenseKey=S),placeholder:i.translate("License Key")},null,8,["modelValue","placeholder"]),s.showNewLicenseInput?x("",!0):(r(),h("p",JV,[R(m(i.translate("Don't have a license key?"))+" ",1),o("a",{target:"_blank",href:i.purchaseLink},[R(m(i.translate("Purchase one here"))+" ",1),n(_,{name:"External",class:"w-4 h-4"})],8,XV)]))])),o("p",{class:"fluent_cart_warning text-red-500 m-0",innerHTML:s.errorMessage},null,8,ZV),s.licenseData.status==="expired"&&s.showNewLicenseInput?(r(),E(v,{key:3,type:"primary",onClick:t[4]||(t[4]=S=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+m(i.translate("Click Here to Renew your License")),1)]),_:1})):["valid","expired"].includes(s.licenseData.status)?x("",!0):(r(),E(v,{key:4,type:"primary",onClick:t[5]||(t[5]=S=>i.verifyLicense())},{default:d(()=>[n(_,{name:"Lock",class:"w-5 h-5"}),R(" "+m(i.translate("Verify License")),1)]),_:1}))],2)])),[[b,s.verifying]]):x("",!0)])]),_:1})]),_:1})])])}const tT=nt(QV,[["render",eT]]),aT={class:"fct-single-order-loader-wrap fct-layout-width"},lT={class:"single-page-header fct-page-loader-header flex items-start justify-between"},sT={class:"single-page-body"},nT={class:"fct-single-order"},oT={class:"fct-single-order-main"},iT={class:"fct-single-order-aside"},rT={class:"fct-admin-sidebar"},dT={__name:"SingleProductLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),h("div",aT,[o("div",lT,[n(s,{animated:"",class:"flex flex-col items-start gap-2"},{template:d(()=>[n(l,{class:"max-w-180"}),n(l,{class:"max-w-[100px]"})]),_:1}),n(s,{animated:"",class:"flex gap-2 max-w-[100px]"},{template:d(()=>[n(l,{class:"w-2/4"}),n(l,{class:"w-2/4"})]),_:1})]),o("div",sT,[o("div",nT,[o("div",oT,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Title")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Pricing")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:5})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Inventory Management")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:6})]),_:1})]),_:1}),n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small",title:t.$t("Downloadable Asset(s)")},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"p"})]),_:1})]),_:1})]),_:1})]),o("div",iT,[o("div",rT,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:""},{template:d(()=>[n(l,{variant:"image",class:"rounded w-full h-[138px] mb-2"}),n(l,{variant:"image",class:"rounded w-[90px] h-[90px]"})]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Group By"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Product Organizer"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:"",rows:3})]),_:1})]),_:1})])])])])])}}},uT={class:"fct-product-route-wrap"},cT={__name:"ProductRoute",props:{product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=Zs({show:!1,message:"",buttonText:"",route:""}),l=T(!1),s=T(!1),i=T(!1),c=nl(),p=T(!0),f=()=>{i.value=!0,a.show=!1,Ae.get("products/"+t.product_id+"/pricing",{with:["product_menu"]}).then(v=>{l.value=v.product,l.value.variants=_(l.value.variants),s.value=v.taxonomies,l.value.post_date=lt.utc(l.value.post_date).local().format("YYYY-MM-DDTHH:mm:ssZ"),p.value&&jQuery("#fct_admin_menu_holder").append(v.product_menu),g(!0)}).catch(v=>{var w;(v==null?void 0:v.code)==="fluent_cart_entity_not_found"?(a.show=!0,a.buttonText=dt.get(v,"data.buttonText"),a.message=dt.get(v,"data.message"),a.route=dt.get(v,"data.route"),jQuery(".fct-admin-product-header").remove()):v.status_code=="422"?q.validationErrors(v):q.error((w=v.data)==null?void 0:w.message)}).finally(()=>{i.value=!1})},_=v=>(v.forEach((w,k)=>{w.item_price=w.item_price?Number(w.item_price):0,w.item_cost=w.item_cost?Number(w.item_cost):0,w.compare_price=w.compare_price?Number(w.compare_price):"",w.other_info&&(w.other_info.signup_fee=w.other_info.signup_fee?Number(w.other_info.signup_fee):0),w.rowId=k}),v),g=(v=!1)=>{let w=jQuery(".fct-admin-product-menu"),k=c.name;w.length&&(w.find("li").removeClass("active-menu"),w.find(`li.fct_menu_${k}`).addClass("active-menu")),v&&l.value&&(jQuery("#wp-admin-bar-root-default .fct_view_link").remove(),jQuery("#wp-admin-bar-root-default").append('<li class="fct_view_link" id="wp-admin-bar-view"><a class="ab-item" href="'+l.value.guid+'" target="_blank">View Product</a></li>'))};return be(()=>t.product_id,(v,w)=>{v!==w&&f()}),Ie(()=>{f(),g(),window.addEventListener("hashchange",g)}),cl(()=>{jQuery(".fct-admin-product-header").remove(),window.removeEventListener("hashchange",g)}),ri("reload",()=>{p.value=!1,f()}),(v,w)=>{const k=C("router-view");return r(),h("div",uT,[A(c).name==="product_edit"&&i.value?(r(),E(dT,{key:0})):x("",!0),a.show?(r(),E(ci,{key:1,"button-text":a.buttonText,message:a.message,route:a.route},null,8,["button-text","message","route"])):x("",!0),l.value&&a.show==!1?(r(),E(k,{key:2,product:l.value,taxonomies:s.value},null,8,["product","taxonomies"])):x("",!0)])}}};class AT extends Vs{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="ID"}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital"),subscribable:u("Subscribable"),bundle:u("Bundle"),non_bundle:u("Non Bundle")}}getToggleableColumns(){return[{label:u("Type"),value:"product_type"},{label:u("Variation"),value:"variation_type"},{label:u("Stock"),value:"stock_availability"},{label:u("Price"),value:"item_price"},{label:u("Status"),value:"post_status"},{label:u("Date"),value:"post_date"}]}getSearchHint(){return u("Search by Id, product title or variation title")}getFetchUrl(){return"products"}parseResponse(t){return t.products}getTableName(){return"product_table"}with(){return["admin_product_list"]}}function tf(e){return AT.init(e)}const pT={key:0,class:"fct-dummy-product-content"},fT={key:0,class:"title"},mT={class:"text"},hT={class:"fct-dummy-product-loading"},_T={class:"fct-loading-bars"},vT=["id"],gT={key:1,class:"fct-form-group"},yT={class:"required"},bT={class:"dialog-footer"},wT={__name:"CreateDummyProduct",props:{products:{}},emits:["onProductCreated"],setup(e,{emit:t}){const a=t,l=Jt().ctx,s=T(!1),i=T([]),c=T(null),p=T(0),f=T(!1),_=T(null),g=T(0),y=k=>{s.value=k},v=(k=0)=>{if(c.value===null){w();return}f.value=!0;const b=i.value[c.value];if(_.value=b,k>b.count-1){setTimeout(()=>{w(),s.value=!1,a("onProductCreated")},1e3);return}p.value=k,l.$post("products/create-dummy",{category:b.category,index:k}).then(S=>{g.value=parseFloat(((k+1)/b.count*100).toFixed(0)),v(k+1)}).catch(S=>{S.code===400?w():v(k+1),l.handleError(S)})},w=()=>{g.value=0,p.value=0,f.value=!1,_.value=null};return Ie(()=>{i.value=ze.get("dummy_product_info")}),(k,b)=>{const S=C("el-button"),$=C("el-progress"),D=C("el-option"),F=C("el-select"),B=C("el-dialog");return r(),h(P,null,[n(S,{onClick:b[0]||(b[0]=U=>y(!0))},{default:d(()=>[n(Y,{name:"Stars",class:"hidden lg:inline"}),R(" "+m(k.$t("Add Dummy Product")),1)]),_:1}),n(B,{modelValue:s.value,"onUpdate:modelValue":b[4]||(b[4]=U=>s.value=U),title:k.$t("Create Dummy Product"),"append-to-body":!0},oa({default:d(()=>[f.value?(r(),h("div",pT,[_.value!=null?(r(),h("div",fT,m(A(u)("Inserting %1$s of %2$s %3$s Product",p.value+1,_.value.count,_.value.title)),1)):x("",!0),o("div",mT,[R(m(k.$t("Can close the window - product will continue to insert."))+" ",1),o("div",hT,[o("div",_T,[(r(),h(P,null,te(8,U=>o("div",{key:U,class:"bar-block",id:`bar-block-${U+1}`},null,8,vT)),64))]),R(" "+m(A(u)("Uploading... %1$s",`${g.value}%`)),1)])]),n($,{percentage:g.value,"striped-flow":"","stroke-width":6,striped:"","show-text":!1},null,8,["percentage"])])):(r(),h("div",gT,[o("label",yT,m(k.$t("Product Category")),1),n(F,{modelValue:c.value,"onUpdate:modelValue":b[1]||(b[1]=U=>c.value=U),clearable:"",placeholder:k.$t("Select a Product Category")},{default:d(()=>[(r(!0),h(P,null,te(i.value,(U,Q)=>(r(),E(D,{key:Q,label:U.title,value:Q},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]))]),_:2},[f.value?void 0:{name:"footer",fn:d(()=>[o("div",bT,[n(S,{onClick:b[2]||(b[2]=U=>y(!1))},{default:d(()=>[R(m(k.$t("Cancel")),1)]),_:1}),n(S,{type:"primary",onClick:b[3]||(b[3]=()=>{v()}),disabled:!c.value},{default:d(()=>[R(m(k.$t("Create Products")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["modelValue","title"])],64)}}},CT={class:"table-cell"},kT={class:"fct-product-info-card w-full"},BT={class:"fct-product-info-media"},xT={class:"fct-product-info-details grow-0 shrink-0 basis-[calc(100%-52px)]",style:{overflow:"hidden"}},ST={class:"fct-product-info-name flex flex-col items-start gap-3"},FT={class:"table-cell"},$T={class:"table-cell"},ET={class:"table-cell"},UT={class:"table-cell"},IT={class:"table-cell"},QT={class:"table-cell"},DT={class:"table-cell"},VT={__name:"ProductsLoader",props:{nextPageCount:{type:Number,default:0},productTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-table"),f=C("el-skeleton");return r(),E(f,{animated:""},{template:d(()=>[n(p,{data:A(a),class:"w-full compact-table responsive fct-loader-table"},{empty:d(()=>s[0]||(s[0]=[])),default:d(()=>[n(i,{selectable:()=>!1,type:"selection",width:"45"}),n(i,{label:l.$t("Products"),width:"380"},{default:d(()=>[o("div",CT,[o("div",kT,[o("div",BT,[n(c,{variant:"image",class:"w-10 h-10.5 flex-none rounded-md"})]),o("div",xT,[o("div",ST,[n(c,{variant:"p",class:"max-w-[190px]"}),n(c,{variant:"p",class:"max-w-[100px]"})])])])])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(i,{key:0,label:l.$t("Type"),width:"170"},{default:d(()=>[o("div",FT,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(i,{key:1,label:l.$t("Variation"),width:"150"},{default:d(()=>[o("div",$T,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(i,{key:2,label:l.$t("Price"),width:"130"},{default:d(()=>[o("div",ET,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(i,{key:3,label:l.$t("Stock"),width:"100"},{default:d(()=>[o("div",UT,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(i,{key:4,label:l.$t("Status"),width:"130"},{default:d(()=>[o("div",IT,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(i,{key:5,label:l.$t("Date"),width:"100"},{default:d(()=>[o("div",QT,[n(c,{variant:"p",class:"w-4/5"})])]),_:1},8,["label"])):x("",!0),n(i,{label:l.$t("Actions"),width:"90",align:"right"},{default:d(()=>[o("div",DT,[n(c,{variant:"p",class:"w-3/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},TT={},MT={class:"px-4 py-3"},LT={class:"flex items-center justify-between mb-3"},RT={class:"grid grid-cols-3 gap-5 mt-5"};function OT(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",MT,[o("div",LT,[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})]),o("div",RT,[(r(),h(P,null,te(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const PT=nt(TT,[["render",OT]]),HT={class:"fct-product-action show-on-mobile absolute right-0 top-1"},NT={class:"more-btn pr-3"},KT={class:"flex items-center gap-2"},GT={key:0},zT={key:1},jT={key:2},qT={key:0},YT={key:1},WT={key:0},JT={key:1},XT={key:0},ZT={key:1},eM={class:"flex items-center gap-0.5"},tM={key:0},aM={key:1},lM=["innerHTML"],sM=["innerHTML"],nM={class:"fct-product-id hidden",title:"Product ID"},oM={class:"more-btn pr-3"},iM={__name:"ProductsTable",props:{productTable:{type:Object,required:!0}},emits:["delete","duplicate","selectionChange"],setup(e,{expose:t,emit:a}){const l=a,s=T(null),i=y=>{y.action==="delete"?ul(u("Are you sure you want to delete this product : %s ?",y.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{l("delete",y.product.ID)}).catch(v=>{}):y.action==="duplicate"&&l("duplicate",y.product)},c=y=>y.min_price===y.max_price?Kt(y.min_price,!0):`${Kt(y.min_price,!0)} - ${Kt(y.max_price,!0)}`,p=y=>{switch(y){case"physical":return u("Physical");case"digital":return u("Digital");case"bundle":return u("Bundle");default:da.headline(y)}},f=y=>{switch(y){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");case"advanced_variations":return u("Advanced Variations");default:return y?da.headline(y):""}},_=y=>{l("selectionChange",y)};return t({clearSelection:()=>{var y,v;(v=(y=s.value)==null?void 0:y.clearSelection)==null||v.call(y)}}),(y,v)=>{const w=C("el-table-column"),k=C("router-link"),b=C("el-dropdown-item"),S=C("el-dropdown-menu"),$=C("el-dropdown"),D=C("el-tooltip"),F=C("el-table");return r(),E(F,{ref_key:"elTableRef",ref:s,data:e.productTable.getTableData(),class:"w-full compact-table",onSelectionChange:_},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:e.productTable.emptyMessage},null,8,["text"])]),default:d(()=>[n(w,{type:"selection",width:"45"}),n(w,{label:A(u)("Products"),width:"380"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[n(id,{product:B.row,class:"fct-product-table-product-info"},null,8,["product"])]),_:2},1032,["to"]),o("div",HT,[n($,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[B.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),n(b,{command:{action:"duplicate",product:B.row}},{default:d(()=>[n(Y,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:B.row},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",NT,[n(Y,{name:"More"})])]),_:2},1024)])]),_:1},8,["label"]),e.productTable.isColumnVisible("product_type")?(r(),E(w,{key:0,label:A(u)("Type"),width:"170"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>{var U,Q;return[o("div",KT,[((Q=(U=B.row.detail)==null?void 0:U.other_info)==null?void 0:Q.is_bundle_product)==="yes"?(r(),h("span",GT,m(A(u)("Bundle"))+" - ",1)):x("",!0),B.row.detail?(r(),h("span",zT,m(p(B.row.detail.fulfillment_type)),1)):(r(),h("span",jT,m(A(u)("N/A")),1))])]}),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),E(w,{key:1,label:A(u)("Variation"),width:"150"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[B.row.detail?(r(),h("span",qT,m(f(B.row.detail.variation_type)),1)):(r(),h("span",YT,m("N/A")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("item_price")?(r(),E(w,{key:2,label:A(u)("Price"),width:"130"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[B.row.detail?(r(),h("span",WT,m(c(B.row.detail)),1)):(r(),h("span",JT,m(A(u)("Set Price")),1))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),E(w,{key:3,label:A(u)("Stock"),width:"100"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[B.row.detail?(r(),h("span",XT,[B.row.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(m(A(u)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(m(A(sa)(A(dt).sum(B.row.variants,"available"))),1)],64))])):(r(),h("span",ZT,m("")))]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_status")?(r(),E(w,{key:4,label:A(u)("Status"),width:"130"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[o("div",eM,[(r(),E(fa,{key:B.row.ID,status:B.row.post_status==="future"?"scheduled":B.row.post_status},null,8,["status"])),B.row.post_status==="future"?(r(),E(D,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(m(A(u)("Publishes On: %s",A(Us)(B.row.post_date,!0))),1)]),default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),e.productTable.isColumnVisible("post_date")?(r(),E(w,{key:5,label:A(u)("Date"),width:"100"},{default:d(B=>[n(Ba,{class:"hover:no-underline",to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[n(Pa,{"date-time":B.row.post_date,"with-time":!1},null,8,["date-time"])]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),(r(!0),h(P,null,te(e.productTable.getCustomColumns(),B=>(r(),E(w,{label:B.label},{default:d(U=>[B.render_template?(r(),h("div",tM,[(r(),E(gl(rA),{templateContent:B.template,data:{column:B,product:U.row,index:U.$index}},null,8,["templateContent","data"]))])):(r(),h("div",aM,[B.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:U.row.ID}}},{default:d(()=>[o("div",{innerHTML:A(dt).get(U.row,B.accessor)},null,8,lM)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(dt).get(U.row,B.accessor)},null,8,sM))]))]),_:2},1032,["label"]))),256)),n(w,{label:A(u)("Actions"),width:"90",align:"right"},{default:d(B=>[o("span",nM,"ID: "+m(B.row.ID),1),n($,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:d(()=>[n(S,null,{default:d(()=>[B.row.ID?(r(),E(b,{key:0,class:"item-link"},{default:d(()=>[n(k,{to:{name:"product_edit",params:{product_id:B.row.ID}}},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),n(b,{command:{action:"duplicate",product:B.row}},{default:d(()=>[n(Y,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:2},1032,["command"]),n(b,{command:{action:"delete",product:B.row},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",oM,[n(Y,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])}}},rM={class:"fct-product-table-mobile-wrap"},dM={class:"fct-product-table-mobile-header"},uM={key:0,class:"fct-product-table-post-status-col"},cM={class:"flex items-center gap-1.5"},AM={class:"fct-product-action"},pM={class:"more-btn"},fM=["onClick"],mM={class:"fct-product-table-mobile-body-header"},hM={class:"fct-product-table-date-col"},_M={class:"invoice-no",title:"Product ID"},vM={key:0,class:"fct-product-table-price-col"},gM={key:0},yM={key:1},bM={class:"fct-product-table-product-col"},wM=["onClick"],CM={key:0,class:"fct-product-table-product-type"},kM={class:"title"},BM={key:0,class:"value"},xM={key:1,class:"value"},SM={key:1,class:"fct-product-table-variation-col"},FM={class:"title"},$M={key:0,class:"value"},EM={key:1,class:"value"},UM={key:2,class:"fct-product-table-stock-col"},IM={class:"title"},QM={key:0,class:"value"},DM={key:1},VM={key:0,class:"fct-product-table-mobile-footer"},TM={class:"fct-product-table-stock-col"},MM={key:0,class:"title"},LM=["innerHTML"],RM=["innerHTML"],OM={__name:"ProductsTableMobile",props:{productTable:{type:Object,required:!0}},emits:["delete"],setup(e,{emit:t}){const a=t,l=p=>{p.action==="delete"&&ul(u("Are you sure you want to delete this product : %s ?",p.product.post_title),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{a("delete",p.product.ID)}).catch(f=>{})},s=p=>p.min_price===p.max_price?Kt(p.min_price,!0):`${Kt(p.min_price,!0)} - ${Kt(p.max_price,!0)}`,i=p=>{switch(p){case"physical":return u("Physical");case"digital":return u("Digital");default:da.headline(p)}},c=p=>{switch(p){case"simple":return u("Simple");case"simple_variations":return u("Simple Variations");default:da.headline(p)}};return(p,f)=>{const _=C("el-tooltip"),g=C("router-link"),y=C("el-dropdown-item"),v=C("el-dropdown-menu"),w=C("el-dropdown");return r(),h("div",rM,[(r(!0),h(P,null,te(e.productTable.getTableData(),(k,b)=>(r(),h("div",{key:k.id,class:"fct-product-table-mobile-row"},[o("div",dM,[e.productTable.isColumnVisible("post_status")?(r(),h("div",uM,[o("div",cM,[(r(),E(fa,{key:k.ID,status:k.post_status,onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},null,8,["status","onClick"])),k.post_status==="future"?(r(),E(_,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(m(A(u)("Publishes On: %s",A(Us)(k.post_date,!0))),1)]),default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 h-4"})]),_:2},1024)):x("",!0)])])):x("",!0),o("div",AM,[n(w,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(v,null,{default:d(()=>[k.ID?(r(),E(y,{key:0,class:"item-link"},{default:d(()=>[n(g,{to:{name:"product_edit",params:{product_id:k.ID}}},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),n(y,{command:{action:"delete",product:k},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",pM,[n(Y,{name:"More"})])]),_:2},1024)])]),o("div",{class:"fct-product-table-mobile-body",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[o("div",mM,[o("div",hM,[e.productTable.isColumnVisible("post_date")?(r(),h(P,{key:0},[n(Pa,{class:"date","date-time":k.post_date,"with-time":!1},null,8,["date-time"]),f[0]||(f[0]=o("span",{class:"bullet"},"•",-1))],64)):x("",!0),o("span",_M,"#"+m(k.ID),1)]),e.productTable.isColumnVisible("item_price")?(r(),h("div",vM,[k.detail?(r(),h("span",gM,m(s(k.detail)),1)):(r(),h("span",yM,m(A(u)("Set Price")),1))])):x("",!0)]),o("div",bM,[n(id,{product:k},null,8,["product"])])],8,fM),o("div",{class:"fct-product-table-mobile-footer",onClick:S=>p.$router.push({name:"product_edit",params:{product_id:k.ID}})},[e.productTable.isColumnVisible("product_type")?(r(),h("div",CM,[o("div",kM,m(A(u)("Type")),1),k.detail?(r(),h("span",BM,m(i(k.detail.fulfillment_type)),1)):(r(),h("span",xM,m("N/A")))])):x("",!0),e.productTable.isColumnVisible("variation_type")?(r(),h("div",SM,[o("div",FM,m(A(u)("Variation")),1),k.detail?(r(),h("span",$M,m(c(k.detail.variation_type)),1)):(r(),h("span",EM,m("N/A")))])):x("",!0),e.productTable.isColumnVisible("stock_availability")?(r(),h("div",UM,[o("div",IM,m(A(u)("Stock")),1),k.detail?(r(),h("span",QM,[k.detail.manage_stock.toString()==="0"?(r(),h(P,{key:0},[R(m(A(u)("Unlimited")),1)],64)):(r(),h(P,{key:1},[R(m(A(sa)(A(dt).sum(k.variants,"available"))),1)],64))])):(r(),h("span",DM,m("")))])):x("",!0)],8,wM),e.productTable.getCustomColumns()?(r(),h("div",VM,[(r(!0),h(P,null,te(e.productTable.getCustomColumns(),S=>(r(),h("div",TM,[S.label?(r(),h("div",MM,m(S.label),1)):x("",!0),S.render_template?(r(),E(gl(rA),{key:1,templateContent:S.template,data:S,column:S,row:k},null,8,["templateContent","data","column","row"])):(r(),h(P,{key:2},[S.as_link!==!1?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"product_edit",params:{product_id:k.ID}}},{default:d(()=>[o("div",{innerHTML:A(dt).get(k,S.accessor)},null,8,LM)]),_:2},1032,["to"])):(r(),h("div",{key:1,innerHTML:A(dt).get(k,S.accessor)},null,8,RM))],64))]))),256))])):x("",!0)]))),128))])}}},PM={class:"product-action-modal"},HM={class:"fct-alert-content"},NM={class:"fct-alert-title"},KM={class:"fct-alert-text"},GM={class:"fct-alert-subtext"},zM={key:1,class:"product-info"},jM={class:"info-text"},qM={key:0},YM={key:1},WM={key:2},JM={key:2,class:"options-wrapper"},XM={key:4,class:"products-preview"},ZM={class:"preview-title"},e7={class:"product-list"},t7={class:"product-name"},a7={key:0,class:"remaining-count"},l7={key:5,class:"progress-section"},s7={class:"progress-text"},n7={key:6,class:"results-section"},o7={class:"dialog-footer"},i7={key:0,class:"el-icon-delete"},r7={__name:"ProductActionModal",props:{modelValue:{type:Boolean,default:!1},action:{type:String,required:!0,validator:e=>["duplicate","delete"].includes(e)},productId:{type:[Number,String],default:null},productName:{type:String,default:""},products:{type:Array,default:()=>[]},productIds:{type:Array,default:()=>[]}},emits:["update:modelValue","completed"],setup(e,{emit:t}){const a=e,l=t,s=T(a.modelValue),i=T(!1),c=T(!1),p=T(!1),f=T(0),_=T(0),g=T(0),y=T({importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0}),v=ze.get("app_config.isProActive"),w=ze.get("modules_settings.stock_management.active"),k=K(()=>a.action==="duplicate"),b=K(()=>a.action==="delete"),S=K(()=>a.products&&a.products.length>0||a.productIds&&a.productIds.length>0),$=K(()=>a.products&&a.products.length>0?a.products.length:a.productIds&&a.productIds.length>0?a.productIds.length:1),D=K(()=>S.value?u(k.value?"Bulk Duplicate Products":"Bulk Delete Products"):u(k.value?"Duplicate Product":"Delete Product")),F=K(()=>b.value?u(S.value?"Delete Products":"Delete Product"):u(S.value?"Duplicate Products":"Duplicate Product")),B=K(()=>a.products.slice(0,5)),U=K(()=>{const ne=$.value-5;return ne>0?ne:0}),Q=K(()=>$.value===0?0:Math.round(f.value/$.value*100)),V=K(()=>{if(g.value>0&&f.value===$.value)return"exception";if(f.value===$.value)return"success"});be(()=>a.modelValue,ne=>{s.value=ne,ne&&(y.value={importStockManagement:!0,importLicenseSettings:!0,importDownloadableFiles:!0},c.value=!1,p.value=!1,f.value=0,_.value=0,g.value=0,i.value=!1)}),be(s,ne=>{l("update:modelValue",ne)});const I=()=>{!c.value&&!i.value&&(s.value=!1,(p.value&&_.value>0||!S.value&&!p.value)&&l("completed"))},M=()=>{S.value?j():O()},O=()=>{i.value=!0,k.value?L():H()},L=()=>{Ae.post(`products/${a.productId}/duplicate`,{import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles}).then(ne=>{q.success(ne.message||u("Product duplicated successfully")),l("completed"),I()}).catch(ne=>{var ce,z;((ce=ne.status_code)==null?void 0:ce.toString())==="422"?q.validationErrors(ne):q.error(((z=ne.data)==null?void 0:z.message)||u("Failed to duplicate product"))}).finally(()=>{i.value=!1})},H=()=>{Ae.delete(`products/${a.productId}`).then(ne=>{q.success(ne.message||u("Product deleted successfully")),l("completed"),I()}).catch(ne=>{var ce,z;((ce=ne.status_code)==null?void 0:ce.toString())==="422"?q.validationErrors(ne):q.error(((z=ne.data)==null?void 0:z.message)||u("Failed to delete product"))}).finally(()=>{i.value=!1})},j=async()=>{c.value=!0,f.value=0,_.value=0,g.value=0,k.value?await W():await G(),c.value=!1,p.value=!0,Z()},W=async()=>{const ne={import_stock_management:y.value.importStockManagement,import_license_settings:y.value.importLicenseSettings,import_downloadable_files:y.value.importDownloadableFiles},ce=a.productIds&&a.productIds.length>0?a.productIds:a.products.map(z=>z.ID);for(const z of ce){try{await Ae.post(`products/${z}/duplicate`,ne),_.value++}catch{g.value++}f.value++}},G=async()=>{const ne=a.products&&a.products.length>0?a.products:[];for(const ce of ne){try{await Ae.delete(`products/${ce.ID}`),_.value++}catch{g.value++}f.value++}},Z=()=>{const ne=k.value;_.value>0&&g.value===0?q.success({message:ne?u("All products duplicated successfully"):u("All products deleted successfully")}):_.value>0&&g.value>0?q.warning({message:ne?u("Some products were duplicated successfully"):u("Some products were deleted successfully")}):q.error({message:ne?u("Failed to duplicate products"):u("Failed to delete products")})};return(ne,ce)=>{const z=C("el-checkbox"),ue=C("el-progress"),ie=C("el-alert"),J=C("el-button"),N=C("el-dialog");return r(),E(N,{modelValue:s.value,"onUpdate:modelValue":ce[3]||(ce[3]=ae=>s.value=ae),title:D.value,"append-to-body":!0,width:"500px",onClose:I,"modal-class":"fct-duplicate-product-modal"},{footer:d(()=>[o("div",o7,[n(J,{onClick:I,disabled:c.value},{default:d(()=>[R(m(c.value||p.value?A(u)("Close"):A(u)("Cancel")),1)]),_:1},8,["disabled"]),p.value?x("",!0):(r(),E(J,{key:0,type:b.value?"danger":"primary",loading:i.value||c.value,disabled:i.value||c.value,onClick:M},{default:d(()=>[b.value?(r(),h("i",i7)):x("",!0),R(" "+m(F.value),1)]),_:1},8,["type","loading","disabled"]))])]),default:d(()=>[o("div",PM,[b.value?(r(),E(el,{key:0,icon:"WarningFill",type:"error"},{content:d(()=>[o("div",HM,[o("h3",NM,m(A(u)("Are you sure?")),1),o("p",KM,[R(m(A(u)("You are about to permanently delete"))+" ",1),o("strong",null,m($.value),1),R(" "+m(A(u)($.value===1?"product":"products"))+". ",1)]),o("p",GM,m(A(u)("This action cannot be undone.")),1)])]),_:1})):x("",!0),k.value?(r(),h("div",zM,[o("div",jM,[R(m(A(u)(S.value?"You are about to duplicate":"Select which settings to import from"))+" ",1),S.value?(r(),h("strong",qM,m($.value),1)):(r(),h("strong",YM,m(e.productName),1)),S.value?(r(),h("span",WM,m(A(u)($.value===1?"product":"products")),1)):x("",!0)])])):x("",!0),k.value?(r(),h("div",JM,[n(z,{modelValue:y.value.importDownloadableFiles,"onUpdate:modelValue":ce[0]||(ce[0]=ae=>y.value.importDownloadableFiles=ae),label:A(u)("Import Downloadable Files"),size:"large"},null,8,["modelValue","label"]),n(z,{modelValue:y.value.importLicenseSettings,"onUpdate:modelValue":ce[1]||(ce[1]=ae=>y.value.importLicenseSettings=ae),label:A(u)("Import License Settings"),size:"large"},null,8,["modelValue","label"]),A(w)==="yes"?(r(),h(P,{key:0},[A(v)?(r(),E(z,{key:0,modelValue:y.value.importStockManagement,"onUpdate:modelValue":ce[2]||(ce[2]=ae=>y.value.importStockManagement=ae),label:A(u)("Import Stock Management"),size:"large"},null,8,["modelValue","label"])):(r(),E(z,{key:1,disabled:!0,size:"large"},{default:d(()=>[R(m(A(u)("Import Stock Management"))+" ",1),n(Y,{name:"Crown",class:"w-4 h-4 text-warning-500"})]),_:1}))],64)):x("",!0)])):x("",!0),k.value?(r(),E(el,{key:3,type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",null,m(A(u)(S.value?"All duplicated products will be created as drafts":"The duplicated product will be created as a draft")),1)]),_:1})):x("",!0),b.value&&S.value&&!c.value&&!p.value?(r(),h("div",XM,[o("p",ZM,m(A(u)("Products to be deleted:")),1),o("ul",e7,[(r(!0),h(P,null,te(B.value,ae=>(r(),h("li",{key:ae.ID,class:"product-item"},[o("span",t7,m(ae.post_title),1)]))),128)),U.value>0?(r(),h("li",a7,m(A(u)("... and %s more",U.value)),1)):x("",!0)])])):x("",!0),S.value&&c.value?(r(),h("div",l7,[n(ue,{percentage:Q.value,status:V.value},null,8,["percentage","status"]),o("p",s7,m(A(u)(b.value?"Deleting":"Duplicating"))+" "+m(f.value)+" / "+m($.value),1)])):x("",!0),S.value&&p.value?(r(),h("div",n7,[_.value>0?(r(),E(ie,{key:0,title:A(u)(b.value?"Successfully deleted %s product(s)":"Successfully duplicated %s product(s)",_.value),type:"success",closable:!1,"show-icon":""},null,8,["title"])):x("",!0),g.value>0?(r(),E(ie,{key:1,title:A(u)(b.value?"Failed to delete %s product(s)":"Failed to duplicate %s product(s)",g.value),type:"error",closable:!1,"show-icon":"",style:{"margin-top":"10px"}},null,8,["title"])):x("",!0)])):x("",!0)])]),_:1},8,["modelValue","title"])}}},d7={class:"fct-all-products-page fct-layout-width"},u7={class:"fct-all-products-wrap"},c7={key:0,class:"bulk-actions-bar"},A7={class:"bulk-left flex items-center gap-2"},p7={class:"bulk-right"},f7={key:1,class:"fct-products-table-wrap"},m7={__name:"AllProducts",setup(e){const t=tf({instance:Jt()}),a=T(!1),l=T(!1),s=T("duplicate"),i=T(null),c=T([]),p=T(""),f=T(!1),_=()=>{f.value=window.innerWidth<768},g=Q=>{Ae.delete(`products/${Q}`).then(V=>{q.success(V),t.fetch()}).catch(V=>{var I;V.status_code.toString()==="422"?q.validationErrors(V):q.error((I=V.data)==null?void 0:I.message)})},y=Q=>{i.value=Q,c.value=[],s.value="duplicate",l.value=!0},v=()=>{t.fetch(),i.value=null,c.value=[]},w=()=>{var Q,V;t.fetch(),c.value=[],p.value="",(V=(Q=U.value)==null?void 0:Q.clearSelection)==null||V.call(Q)},k=Q=>{c.value=Q},b=()=>{if(c.value.length===0){q.warning({message:u("Please select at least one product to duplicate")});return}i.value=null,s.value="duplicate",l.value=!0},S=()=>{if(c.value.length===0){q.warning({message:u("Please select at least one product to delete")});return}i.value=null,s.value="delete",l.value=!0},$=()=>{if(!p.value){q.warning({message:u("Please select a bulk action")});return}p.value==="duplicate"?b():p.value==="delete"&&S()},D=K(()=>c.value.map(Q=>Q.ID)),F=K(()=>c.value.length>0),B=K(()=>c.value.length>0),U=T(null);return Ie(()=>{_(),window.addEventListener("resize",_)}),Bt(()=>{window.removeEventListener("resize",_)}),(Q,V)=>{const I=C("el-icon"),M=C("el-button"),O=C("el-dropdown-item"),L=C("el-dropdown-menu"),H=C("el-dropdown"),j=C("el-option"),W=C("el-select"),G=C("el-dialog");return r(),h("div",d7,[n(ol,{title:A(u)("Products")},{action:d(()=>[n(Ot,{permission:"products/view"},{default:d(()=>[n(H,{trigger:"click","popper-class":"fct-dropdown",onCommand:V[3]||(V[3]=()=>{}),placement:"bottom-end"},{dropdown:d(()=>[n(L,null,{default:d(()=>[n(Ot,{permission:"products/create"},{default:d(()=>[n(O,{class:"item-link"},{default:d(()=>[n(wT,{onOnProductCreated:V[0]||(V[0]=Z=>A(t).fetch()),products:A(t).getTableData()},null,8,["products"])]),_:1}),n(O,{onClick:V[1]||(V[1]=Z=>Q.$router.push({name:"product_bulk_insert"}))},{default:d(()=>[n(Y,{name:"Insert"}),R(" "+m(A(u)("Bulk Product Insert")),1)]),_:1}),n(O,{onClick:V[2]||(V[2]=Z=>Q.$router.push({name:"product_bulk_edit"}))},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Bulk Product Edit")),1)]),_:1})]),_:1})]),_:1})]),default:d(()=>[n(M,null,{default:d(()=>[R(m(A(u)("More actions"))+" ",1),n(I,null,{default:d(()=>[n(A(Hn))]),_:1})]),_:1})]),_:1})]),_:1}),n(Ot,{permission:"products/create"},{default:d(()=>[n(M,{type:"primary",onClick:V[4]||(V[4]=()=>{a.value=!0})},{default:d(()=>[R(m(A(u)("Add Product")),1)]),_:1})]),_:1})]),_:1},8,["title"]),n(Ot,{permission:"products/view"},{default:d(()=>[o("div",u7,[n(Ts,{table:A(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(PT,{key:0})):x("",!0),n(OM,{"product-table":A(t),onDelete:g,onDuplicate:y},null,8,["product-table"])]),default:d(()=>[n(Xl,{name:"slide-fade"},{default:d(()=>[F.value?(r(),h("div",c7,[o("div",A7,[n(W,{size:"small",class:"bulk-select min-w-[180px]",placeholder:A(u)("Select Bulk Action"),modelValue:p.value,"onUpdate:modelValue":V[5]||(V[5]=Z=>p.value=Z)},{default:d(()=>[n(j,{label:A(u)("Duplicate"),value:"duplicate"},null,8,["label"]),n(j,{label:A(u)("Delete"),value:"delete"},null,8,["label"])]),_:1},8,["placeholder","modelValue"]),n(M,{size:"small",type:p.value==="delete"?"danger":"primary",disabled:!p.value,onClick:$},{default:d(()=>[p.value==="delete"?(r(),E(Y,{key:0,name:"Delete",class:"w-4 h-4"})):p.value==="duplicate"?(r(),E(Y,{key:1,name:"Copy",class:"w-4 h-4"})):x("",!0),R(" "+m(A(u)("Confirm")),1)]),_:1},8,["type","disabled"])]),o("div",p7,m(c.value.length)+" "+m(A(u)("item(s) selected")),1)])):x("",!0)]),_:1}),A(t).isLoading()?(r(),E(VT,{key:0,productTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["productTable","next-page-count"])):(r(),h("div",f7,[n(iM,{ref_key:"productTableRef",ref:U,"product-table":A(t),onDelete:g,onDuplicate:y,onSelectionChange:k},null,8,["product-table"])]))]),_:1},8,["table"])])]),_:1}),n(Ot,{permission:"products/create"},{default:d(()=>{var Z,ne;return[n(G,{"append-to-body":!0,modelValue:a.value,"onUpdate:modelValue":V[6]||(V[6]=ce=>a.value=ce),title:A(u)("Add New Product")},{default:d(()=>[a.value?(r(),E(Ci,{key:0})):x("",!0)]),_:1},8,["modelValue","title"]),n(r7,{modelValue:l.value,"onUpdate:modelValue":V[7]||(V[7]=ce=>l.value=ce),action:s.value,"product-id":(Z=i.value)==null?void 0:Z.ID,"product-name":(ne=i.value)==null?void 0:ne.post_title,products:B.value?c.value:[],"product-ids":B.value?D.value:[],onCompleted:V[8]||(V[8]=ce=>B.value?w():v())},null,8,["modelValue","action","product-id","product-name","products","product-ids"])]}),_:1})])}}},h7=nt(m7,[["__scopeId","data-v-33110cc0"]]);let _7=0;function ml(){return"_cid_"+ ++_7}const is={IN_STOCK:"in-stock",OUT_OF_STOCK:"out-of-stock"};class Dd extends tl{constructor(){super(...arguments);Pe(this,"data",{visibleColumns:[],options:{status:[{title:"Published",value:"published"},{title:"Draft",value:"draft"}],fulfilment:[{title:"Physical",value:"physical"},{title:"Digital",value:"digital"}],variation:[{title:"Simple",value:"simple"},{title:"Simple Variations",value:"simple_variations"}]},dummies:{productDetail:{variation_type:"simple",manage_stock:1,fulfillment_type:"physical",stock_availability:is.IN_STOCK},variation:{variation_title:"",sku:"",item_price:0,compare_price:0,serial_index:1,fulfillment_type:"",manage_stock:1,total_stock:100,available:100,committed:0,on_hold:0,stock_status:is.IN_STOCK},variationDetail:{description:"",payment_type:"onetime",installment:"no",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},variationImage:{id:"",url:"",title:""},gallery:{id:"",url:"",title:""},downloadableFile:{title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:"",serial:1}}});Pe(this,"ensureProductVariantIsArray",a=>{Array.isArray(a.variants)||(a.variants=[])})}getDummyVariation(a){var i;const l=a==null?void 0:a.variants,s={...this.data.dummies.variation};return s.serial_index=Array.isArray(l)?l.length+1:1,s.fulfillment_type=(i=a==null?void 0:a.detail)==null?void 0:i.fulfillment_type,s.other_info={...this.data.dummies.variationDetail},s.media=[],s._cid=ml(),s}addVariationToProduct(a){this.ensureProductVariantIsArray(a),a.variants.push(this.getDummyVariation(a))}handleVariationChanged(a,l){l==="simple_variations"?this.addVariationToProduct(a):a.variants=[]}getColumnWidthStorageKey(){return""}saveColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s={};a.forEach(i=>{i.key&&(s[i.key]=i.width)}),Vt.set(l,s)}restoreColumnWidths(a){const l=this.getColumnWidthStorageKey();if(!l)return;const s=Vt.get(l);s&&typeof s=="object"&&a.forEach(i=>{i.key&&s[i.key]!==void 0&&(i.width=s[i.key])})}getColumnStorageKey(){return""}getToggleableColumns(){return[]}setupColumnVisibility(){const a=this.getColumnStorageKey();if(!a)return;const l=Vt.get(a);Array.isArray(l)?this.data.visibleColumns=l:this.data.visibleColumns=this.getToggleableColumns().map(s=>s.value)}handleColumnVisibilityChange(){const a=this.getColumnStorageKey();a&&Vt.set(a,this.data.visibleColumns)}isColumnVisible(a){return this.data.visibleColumns.includes(a)}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}syncStockStatus(a){var i;if(!Array.isArray(a.variants))return;if(!((i=a.detail)==null?void 0:i.manage_stock)){for(const c of a.variants)c.stock_status=is.IN_STOCK;a.detail&&(a.detail.stock_availability=is.IN_STOCK);return}let s=!0;for(const c of a.variants){const p=parseInt(c.available,10)||0;c.stock_status=p>0?is.IN_STOCK:is.OUT_OF_STOCK,p>0&&(s=!1)}a.detail&&(a.detail.stock_availability=s?is.OUT_OF_STOCK:is.IN_STOCK)}addDummyDownloadableFiles(a){const l=a;Array.isArray(l.downloadable_files)||(l.downloadable_files=[]),l.downloadable_files.push(this.downloadableFileSchema)}}const v7=["id","post_id","variation_title","fulfillment_type"],g7=["sku","item_price","compare_price","item_cost","manage_cost","shipping_class","other_info","manage_stock","serial_index","total_stock","available","committed","on_hold","stock_status","sold_individually","media","downloadable","payment_type"],y7=["total_stock","available","committed","on_hold","manage_stock"];function b7(e){const t=new Map;return(Array.isArray(e)?e:[]).forEach(a=>{a&&a.id!==void 0&&a.id!==null&&t.set(String(a.id),a)}),t}function af(e,t,a){if(!Array.isArray(e))return[];const l=b7(t);return e.filter(Boolean).filter(s=>s.id===void 0||s.id===null?!0:l.has(String(s.id))).map(s=>{const i=l.get(String(s.id))||{},c={};return v7.forEach(p=>{const f=s[p]!==void 0?s[p]:i[p];f!==void 0&&(c[p]=f)}),(c.post_id===void 0||c.post_id===null)&&(c.post_id=a),g7.forEach(p=>{if(s[p]!==void 0){if(p==="other_info"){c.other_info={...i.other_info||{},...s.other_info||{}};return}c[p]=s[p]}}),c})}function w7(e,t,a){const l=Array.isArray(t)?t:[],i={...(Array.isArray(e)?e.filter(Boolean):[])[0]||{}},c=(i.id!==void 0?l.find(p=>p&&String(p.id)===String(i.id)):null)||l[0]||{};return i.id===void 0&&(i.id=c.id),i.other_info===void 0&&(i.other_info=c.other_info),y7.forEach(p=>{delete i[p]}),af([i],l,a)}function C7(e){return e==null||e===""?null:e}class k7 extends Dd{constructor(){super(...arguments);Pe(this,"data",{product:{},original_product:{},product_changes:{},validationErrors:{},excerptWordCount:0,maxExcerptWordCount:0,hasChange:!1,saving:!1,product_snapshot:{},discardKey:0,savedVariationLength:0,productDownloadableModel:null,metaValue:null,hasChangeLongDescEditor:!1,reloader:()=>{},onProductUpdatedListener:{}});Pe(this,"router",sl());Pe(this,"_mergeOtherInfo",(a,l)=>{const s=JSON.parse(JSON.stringify(l));Object.keys(s).forEach(i=>{a[i]=s[i]}),Object.keys(a).forEach(i=>{i in s||delete a[i]})});Pe(this,"_mergeSnapshot",a=>{const l=this.data.product,s=new Set(["ID","guid","variants","detail","downloadable_files","product_terms","taxonomies","variantOptions"]);if(Object.keys(a).forEach(i=>{if(s.has(i))return;const c=a[i];l[i]=c!==null&&typeof c=="object"?JSON.parse(JSON.stringify(c)):c}),a.detail&&l.detail){const i=JSON.parse(JSON.stringify(a.detail));Object.keys(i).forEach(c=>{c!=="other_info"&&(l.detail[c]=i[c])}),i.other_info&&(l.detail.other_info||(l.detail.other_info={}),this._mergeOtherInfo(l.detail.other_info,i.other_info))}if(Array.isArray(a.variants)&&Array.isArray(l.variants)){const i={};a.variants.forEach(p=>{p.id&&(i[p.id]=p)});const c=new Set(["id","post_id","rowId","media","created_at","updated_at"]);l.variants.forEach(p=>{const f=i[p.id];f&&Object.keys(f).forEach(_=>{if(c.has(_))return;const g=f[_];_==="other_info"&&p.other_info?this._mergeOtherInfo(p.other_info,g):p[_]=g!==null&&typeof g=="object"?JSON.parse(JSON.stringify(g)):g})})}});Pe(this,"addDummyVariant",()=>{var a,l;return{post_id:this.product.detail.post_id,serial_index:this.variantsLength()+1,variation_title:"",item_price:"",compare_price:"",manage_cost:"yes",item_cost:"",profit:"--",profit_margin:"--",manage_stock:this.product.detail.manage_stock,stock_status:"in-stock",total_stock:1,on_hold:0,committed:0,available:1,fulfillment_type:this.product.detail.fulfillment_type,media:[],other_info:{description:"",payment_type:"onetime",tax_class:"standard",tax_exempt:"no",tax_inclusion:"",times:"",repeat_interval:"yearly",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no",package_slug:"",weight:null,weight_unit:((l=(a=window.fluentCartAdminApp)==null?void 0:a.shop)==null?void 0:l.weight_unit)||"kg"},downloadable:"true"}});Pe(this,"formatPricing",a=>(a.forEach((l,s)=>{l.item_price=l.item_price?Number(l.item_price):0,l.item_cost=l.item_cost?Number(l.item_cost):0,l.compare_price=l.compare_price?Number(l.compare_price):0,l.other_info&&(l.other_info.signup_fee=l.other_info.signup_fee?Number(l.other_info.signup_fee):0),l.rowId=s}),a));Pe(this,"onChangePricing",(a,l,s)=>{this.ensureVariationIndex(l),this.product.variants[l][a]=s,a==="item_price"&&this.onChangePricingPayment(this.product.variants[l],s,l),this.data.product_changes.detail||(this.data.product_changes.detail.id=this.product.detail.id),this.data.product_changes.variants[l][a]=s,this.data.product_changes.variants[l].id=this.product.variants[l].id,(a==="item_price"||a==="compare_price")&&this.validateComparePrice(l),this.setHasChange(!0)});Pe(this,"updateLongDescEditorChange",a=>{this.setHasChangeLongDescEditor(!0),Ae.post(`products/${this.product.ID}/update-long-desc-editor-mode`,{active_editor:a??"wp-editor"}).then(l=>{q.success(l.message)}).catch(l=>{l&&l.message&&q.error(l)}).finally(()=>{this.setHasChangeLongDescEditor(!1)})});Pe(this,"onChangePricingPayment",(a,l,s)=>{var i;if(a.item_price!==""&&a.other_info.repeat_interval!==""){let c=parseInt(a.other_info.times)?u("for %s Times",(i=a==null?void 0:a.other_info)==null?void 0:i.times):u("Until Cancel");const p=`${Kt(a.item_price,!0)} ${a.other_info.repeat_interval} ${c}`;return this.data.product_changes.variants[s].billing_summary=p,this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=p}return this.data.product_changes.variants[s].billing_summary="",this.data.product_changes.variants[s].id=a.id,this.data.product_changes.detail.id=this.product.detail.id,a.other_info.billing_summary=""});Pe(this,"onUploadPricingMedia",(a,l,s)=>{this.product.variants[l][a]=[],this.product.variants[l][a]=[...this.product.variants[l][a],...s];const i=this.product.variants[l].id;Ae.post(`products/variants/${i}/setMedia`,{media:this.product.variants[l].media}).then(c=>{q.success(c.message)}).catch(c=>{var p;c.status_code=="422"?q.validationErrors(c):q.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})});Pe(this,"afterCreatingOrUpdatingPricing",(a,l)=>{l.created_at=l.created_at??new Date().toLocaleDateString()+""+new Date().toLocaleTimeString(),a!==void 0&&a!=null?this.product.variants[a]=l:(l.rowId=this.variantsLength()>0?this.data.product.variants[this.variantsLength()-1].rowId+1:this.variantsLength(),this.data.product.variants.push(l),a=this.variantsLength()-1),this.data.productDownloadableModel.setDownloadableFiles(this.data.product.downloadable_files)});Pe(this,"createOrUpdatePricing",a=>{this.setSaving(!0),this.setValidationErrors({});let l="";return a.id!=null?l=Ae.post(`products/variants/${a.id}`,{variants:a}):l=Ae.post("products/variants",{variants:a}),l.then(s=>(q.success(s.message),Object.values(this.data.onProductUpdatedListener).forEach(i=>{typeof i=="function"&&i(this.product)}),this.saveSnapshot(),s)).catch(s=>{var i;s.status_code=="422"?(q.validationErrors(s),this.setValidationErrors(s.data)):q.error((i=s.data)==null?void 0:i.message)}).finally(()=>{this.setSaving(!1)})});Pe(this,"updatePricingValue",(a,l,s,i,c)=>{if(s.includes(".")&&(s=s.split(".").pop()),this.ensureVariationIndex(s),s!==void 0&&this.clearValidationError(`${s}.${a}`),i[a]=l,a==="item_price"&&this.onChangePricingPayment(i,l,s),a==="item_cost"){const p=parseFloat(l);i.item_cost=isNaN(p)||p<0?0:p}parseFloat(i.item_cost)>parseFloat(i.item_price)&&(i.item_cost=0),this.data.product_changes.variants[s][a]=a==="item_cost"?i[a]:l,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,this.product.detail.variation_type==="simple"&&(a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.variants[s].fulfillment_type=l),this.product.variants[0]=i,this.setHasChange(!0)),(a==="item_price"||a==="compare_price")&&this.validateComparePrice(s)});Pe(this,"updatePricingOtherValue",(a,l,s=null,i,c="")=>{this.ensureVariationIndex(s),["payment_type","times","repeat_interval","trial_days","installment","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable","tax_class","tax_exempt","tax_inclusion","weight","length","width","height","package_slug","weight_unit","manage_stock"].includes(a)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),i.other_info[a]=l,this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),this.data.product_changes.variants[s].other_info[a]=l,i.other_info.payment_type==="subscription"&&(a==="times"&&parseInt(l)<0&&(i.other_info.times=0),i.other_info.times=i.other_info.times??"",i.other_info.repeat_interval=i.other_info.repeat_interval??"",i.other_info.trial_days=i.other_info.trial_days??0,i.other_info.billing_summary=i.other_info.billing_summary??"",i.other_info.manage_setup_fee=i.other_info.manage_setup_fee??"no",i.other_info.signup_fee_name=i.other_info.signup_fee_name??"",i.other_info.signup_fee=i.other_info.signup_fee??"",i.other_info.setup_fee_per_item=i.other_info.setup_fee_per_item??"no"),this.data.product_changes.variants[s].other_info=i.other_info,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id,["payment_type","times","repeat_interval","manage_setup_fee","signup_fee_name","signup_fee","billing_summary","setup_fee_per_item","purchasable"].includes(a)&&this.onChangePricingPayment(i,l,s)),["media"].includes(a)&&(i.media=[],i.media=[...i.media,...l],this.data.product_changes.variants[s].media=i.media,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),["description"].includes(a)&&(s!==void 0&&this.clearValidationError(`${s}.other_info.${a}`),this.data.product_changes.variants[s].other_info||(this.data.product_changes.variants[s].other_info={}),i.other_info[a]=l,this.data.product_changes.variants[s].other_info[a]=l,this.data.product_changes.variants[s].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),this.product.detail.variation_type==="simple"&&(this.product.variants[0]=i,this.data.product_changes.variants=[],this.data.product_changes.variants[0]=i,this.data.product_changes.variants[0].id=i.id,this.data.product_changes.detail.id=this.product.detail.id),c==="add"&&this.setHasChange(!0)});Pe(this,"afterDeletingPricing",a=>{this.product.variants.splice(a,1)});Pe(this,"deletePricing",(a,l)=>Mn.ofDelete(u("Are you sure, you want to delete this price?")).then(()=>{if(a!==void 0)return Ae.delete(`products/variants/${a}`).then(s=>{q.success(s.message),this.afterDeletingPricing(l),this.saveSnapshot()}).catch(s=>{throw(s==null?void 0:s.status_code)=="422"?q.validationErrors(s):q.error(s==null?void 0:s.data),s})}));Pe(this,"getDownloadableHeaderClass",()=>{var l;const a=this.product.downloadable_files&&Array.isArray(this.product.downloadable_files)&&this.product.downloadable_files.length>0;return{"!border-0":((l=this.product.detail)==null?void 0:l.manage_downloadable)=="0"||!a}});Pe(this,"onChangeInventoryStatus",a=>{this.product.variants.filter(l=>l.manage_stock=a),this.setHasChange(!0)});Pe(this,"ensureVariationIndex",a=>{var l;(l=this.data.product_changes)!=null&&l.detail||(this.data.product_changes.detail={}),this.data.product_changes.variants||(this.data.product_changes.variants=[]),this.data.product_changes.variants[a]||(this.data.product_changes.variants[a]={})});Pe(this,"resolveStockVariant",(a,l)=>l||(Array.isArray(this.product.variants)?this.product.variants[a]:void 0));Pe(this,"onChangeNewStock",(a,l,s,i=null)=>{const c=this.resolveStockVariant(s,i);if(!c)return;l===""&&(c.new_stock=0);const p=parseInt(c.total_stock??0),f=parseInt(c.new_stock??0);c.adjusted_quantity=f-p});Pe(this,"onChangeAdjustedQuantity",(a,l,s,i=null)=>{const c=this.resolveStockVariant(s,i);if(!c)return;l===""&&(l=0);const p=parseInt(c.total_stock??0)+parseInt(l);c.new_stock=p<0?0:p});Pe(this,"onChangeInputField",(a,l,s=!0)=>{var i,c,p,f,_;if(a==="post_title"&&this.product.detail.variation_type==="simple"&&Array.isArray(this.product.variants)&&this.variantsLength()>0&&(this.product.variants[0].variation_title=l,(i=this.data.product_changes)!=null&&i.variants||(this.data.product_changes.variants=[]),this.ensureVariationIndex(0),this.data.product_changes.variants[0].variation_title=l,this.data.product_changes.variants[0].id=this.product.variants[0].id),a==="post_date"&&(this.product[a]=lt(l).format("YYYY-MM-DDTHH:mm:ssZ"),this.data.product_changes[a]=this.product[a]),a==="default_variation_id"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.data.product_changes.detail.default_variation_id=C7(l),this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="manage_downloadable"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),this.product.detail.manage_downloadable=l,this.data.product_changes.detail.manage_downloadable=l,this.data.product_changes.detail.id=this.product.detail.id,this.setHasChange(!0)),a==="fulfillment_type"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail.fulfillment_type=l,this.data.product_changes.detail.fulfillment_type=l,this.data.product_changes.detail.id=this.product.detail.id,this.product.variants.forEach((g,y)=>{this.product.variants[y].fulfillment_type=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].fulfillment_type=l,this.data.product_changes.variants[y].id=g.id})),a==="shipping_class"&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),this.product.detail||(this.product.detail={}),(c=this.product.detail)!=null&&c.other_info||(this.product.detail.other_info={}),this.product.detail.other_info[a]=l,(p=this.data.product_changes.detail)!=null&&p.other_info||(this.data.product_changes.detail.other_info={}),this.data.product_changes.detail.other_info[a]=l,this.product.variants.forEach((g,y)=>{this.product.variants[y].shipping_class=l,this.ensureVariationIndex(y),this.data.product_changes.variants[y].shipping_class=l,this.data.product_changes.variants[y].id=g.id})),["group_pricing_by","use_pricing_table","active_editor","sold_individually","fluent_player_video"].includes(a)&&(this.data.product_changes.detail||(this.data.product_changes.detail={}),(f=this.product.detail)!=null&&f.other_info||(this.product.detail.other_info={}),(_=this.data.product_changes.detail)!=null&&_.other_info||(this.data.product_changes.detail.other_info={}),this.product.detail.other_info[a]=l,this.data.product_changes.detail.other_info[a]=l,this.data.product_changes.detail.id=this.product.detail.id),a==="post_excerpt"){this.product[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id,this.data.product_changes[a]=this.product[a];const g=l.trim();g.length===0?this.setExcerptWordCount(0):this.setExcerptWordCount(g.split(" ").length)}else this.product[a]=l,this.data.product_changes[a]=l,this.data.product_changes.detail||(this.data.product_changes.detail={}),this.data.product_changes.detail.id=this.product.detail.id;s&&this.setHasChange(!0)});Pe(this,"hasValidationError",a=>this.validationErrors&&this.validationErrors.hasOwnProperty(a));Pe(this,"clearValidationError",a=>{this.validationErrors&&this.validationErrors.hasOwnProperty(a)&&delete this.validationErrors[a]});Pe(this,"validateComparePrice",a=>{var p,f;if(a==null)return!0;const l=(f=(p=this.product)==null?void 0:p.variants)==null?void 0:f[a];if(!l)return!0;const s=`variants.${a}.compare_price`,i=parseFloat(l.item_price),c=parseFloat(l.compare_price);return isNaN(c)||c<=0?(this.clearValidationError(s),!0):!isNaN(i)&&c<i?(this.validationErrors[s]=[u("Compare price must be greater than or equal to item price.")],!1):(this.clearValidationError(s),!0)});Pe(this,"discard",()=>{const a=this.data.product_snapshot;!a||!Object.keys(a).length||(this._mergeSnapshot(a),this.data.product_changes={},this.data.discardKey++,this.setHasChange(!1))});Pe(this,"update",async(a=null)=>{var c,p,f,_;let l=this.data.product_changes;l={...this.product},l.metaValue=this.data.metaValue,this.data.product_changes.post_status||(this.data.product_changes.post_status=this.product.post_status),this.data.product_changes.post_title||(this.data.product_changes.post_title=this.product.post_title),this.data.product_changes.detail?((c=this.data.product_changes.detail)!=null&&c.fulfillment_type||(this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type),(p=this.data.product_changes.detail)!=null&&p.variation_type||(this.data.product_changes.detail.variation_type=this.product.detail.variation_type)):(this.data.product_changes.detail={},this.data.product_changes.detail.fulfillment_type=this.product.detail.fulfillment_type,this.data.product_changes.detail.variation_type=this.product.detail.variation_type),l=this.data.product_changes,l.metaValue=this.data.metaValue,this.setValidationErrors({}),this.setSaving(!0),delete l.taxonomies,delete l.product_terms,delete l.variantOptions,delete l.downloadable_files,((f=l.detail)==null?void 0:f.variation_type)==="simple"?l.variants=w7(l.variants,this.product.variants,this.product.ID):l.variants&&(l.variants=af(l.variants,this.product.variants,this.product.ID)),((_=l.downloadable_files)==null?void 0:_.length)<1&&(l.variantOptions=[]);const s=Ae.post(`products/${this.product.ID}/pricing`,l);let i=document.querySelector(".fct-admin-product-info .badge");s.then(g=>{q.success(a||g.message),this.setHasChange(!1),i&&(i.innerText=g.data.post_status),this.product.view_url=g.data.viewUrl,i&&g.data.post_status==="publish"&&(i.classList.remove("warning"),i.classList.add("success")),i&&g.data.post_status==="future"&&(i.innerText=u("Publishes on: %s",Us(g.data.post_date,!0)),i.classList.remove("success"),i.classList.add("warning")),i&&(g.data.post_status==="draft"?(i.classList.remove("success"),i.classList.add("info")):(i.classList.remove("info"),i.classList.add("success"))),this.product.detail.variation_type==="simple"&&Array.isArray(g.data.variants)&&g.data.variants.length>0&&(this.product.variants[0].id=g.data.variants[0].id,this.product.variants[0].created_at=g.data.variants[0].created_at),this.product.variants=this.product.variants.filter((y,v,w)=>v===w.findIndex(k=>k.id===y.id)),this.data.product_changes={},this.saveSnapshot(),Object.values(this.data.onProductUpdatedListener).forEach(y=>{typeof y=="function"&&y(this.product)})}).catch(g=>{var y,v;((y=g==null?void 0:g.status_code)==null?void 0:y.toString())==="422"?(q.validationErrors(g),this.setValidationErrors(g)):q.error(((v=g==null?void 0:g.data)==null?void 0:v.message)||(g==null?void 0:g.message)||u("Failed to save product"))}).finally(async()=>{this.setSaving(!1)})});Pe(this,"delete",()=>{ul(u("Are you sure you want to delete this product?"),u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{this.setHasChange(!1),Ae.delete(`products/${this.product.ID}`).then(a=>{q.success(a.message),this.router.push({name:"products"})}).catch(a=>{var l;a.status_code=="422"?q.validationErrors(a):q.error((l=a.data)==null?void 0:l.message)})}).catch(()=>{})});Pe(this,"updateVariationType",(a,l)=>{var p,f;const s=this.product.detail[a];this.product.detail[a]=l;let i={variation_type:l,variation_ids:[(f=(p=this.product)==null?void 0:p.variants[0])==null?void 0:f.id],action:"change_variation_type"};const c=Ae.post(`products/detail/${this.product.detail.id}`,i);return c.then(_=>{q.info(_.message),a==="variation_type"&&l==="simple"?(this.product.variants=this.product.variants.slice(0,1),this.variantsLength()>0&&(this.product.variants[0].manage_stock=this.product.detail.manage_stock)):a==="variation_type"&&l==="advanced_variations"&&(this.product.variants=[])}).catch(_=>{var g;this.product.detail[a]=s,_.status_code=="422"?q.validationErrors(_):q.error((g=_.data)==null?void 0:g.message)}).finally(()=>{}),c});Pe(this,"getMaxExcerptWordCount",()=>{Ae.get("products/get-max-excerpt-word-count").then(a=>{this.setMaxExcerptWordCount(a.count)}).catch(a=>{})});Pe(this,"shouldShowShippingMethodAlert",()=>ze.get("available_shipping_method_count").toString()!=="0"?!1:this.hasPhysicalVariation());Pe(this,"hasDigitalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="digital"));Pe(this,"isAllDigitalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="digital"));Pe(this,"hasPhysicalVariation",()=>this.product.variants.some(a=>a.fulfillment_type==="physical"));Pe(this,"isTaxEnabled",()=>ze.get("is_tax_enabled"));Pe(this,"isAllPhysicalVariation",()=>this.product.variants.every(a=>a.fulfillment_type==="physical"));Pe(this,"isBundleProduct",()=>dt.get(this.data.product,"detail.other_info.is_bundle_product")==="yes")}addOnProductUpdatedListener(a,l){this.data.onProductUpdatedListener[a]=l}triggerProductUpdated(a=null){const l=this.data.onProductUpdatedListener;(Array.isArray(a)?a:Object.keys(l)).forEach(i=>{const c=l[i];typeof c=="function"&&c(this.product)})}setProductDownloadableModel(a){this.data.productDownloadableModel=a}setReloader(a){this.data.reloader=a}saveSnapshot(){this.data.product_snapshot=JSON.parse(JSON.stringify(this.data.product))}get product(){return this.data.product}get validationErrors(){return this.data.validationErrors}get excerptWordCount(){return this.data.excerptWordCount}get maxExcerptWordCount(){return this.data.maxExcerptWordCount}get hasChange(){return this.data.hasChange}get hasChangeLongDescEditor(){return this.data.hasChangeLongDescEditor}get saving(){return this.data.saving}beforeInit(){this.data.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"publish",post_date:new Date,comment_status:"close",variants:!1},this.vueInstance=Jt().ctx}setProduct(a){let l=document.querySelector(".fct-admin-product-info .badge");l&&a.post_status==="future"&&(l.innerText=u("Publishes on: %s",Us(a.post_date,!0)),l.classList.add("warning")),this.data.product=a,this.data.original_product={...a}}setValidationErrors(a){this.data.validationErrors=a}setExcerptWordCount(a){this.data.excerptWordCount=a}setMaxExcerptWordCount(a){this.data.maxExcerptWordCount=a}setHasChange(a){this.data.hasChange=a}setHasChangeLongDescEditor(a){this.data.hasChangeLongDescEditor=a}setSaving(a){this.data.saving=a}isInDraft(){return this.product.post_status==="draft"}viewUrl(){return this.product.view_url??""}variantsLength(){return this.product.variants.length??0}updateVariantSerialIndexes(a){a.forEach((i,c)=>{i.serial_index=c+1});const l=Array.isArray(this.data.product_changes.variants)?this.data.product_changes.variants:[],s=new Map;l.filter(Boolean).forEach(i=>{i.id!==void 0&&i.id!==null&&s.set(String(i.id),i)}),this.data.product_changes.variants=a.map(i=>({...s.get(String(i.id))||{},id:i.id,serial_index:i.serial_index})),this.setHasChange(!0)}bulkUpdateVariants(a){return Ae.post("products/variants/bulk-update",{updates:a})}addDummyDownloadableFile(){super.addDummyDownloadableFiles(this.product),this.setHasChange(!0)}updateMedia(a,l){this.product[a]=l,this.data.product_changes[a]=l,this.setHasChange(!0)}shippingSettingsUrl(){return ze.get("admin_url")+"settings/shipping"}}function B7(){return k7.init()}function x7(){Ie(()=>{document.addEventListener("keydown",t)}),cl(()=>{document.removeEventListener("keydown",t)});let e;function t(l){(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.keyCode===83&&(l.preventDefault(),typeof e=="function"&&e())}function a(l){e=l}return{onSave:a}}const S7={id:"gt",class:"fct-custom-gutenberg-editor-wrap w-full",style:{height:"400px",position:"relative"}},F7={key:0,class:"iframe-loader"},$7=["src"],E7={class:"iframe-controls"},U7={class:"dialog-header"},I7={id:"gt",class:"fct-custom-gutenberg-editor-wrap",style:{position:"relative"}},Q7={key:0,class:"iframe-loader"},D7=["src"],V7={__name:"GutenbergEditor",props:{post_id:{required:!0},product:{type:Object},reload:Function,productEditModel:Object},setup(e){const t=e,a=T(!1),l=T(!0),s=T(!0),i=T(),c=T(0);let p=!1;const f=T(null),_=T(null);nl();const g=()=>{i.value=ze.get("wp_admin_url",window.location.origin+"/wp-admin")},y=()=>{setTimeout(()=>{l.value=!1},500)},v=()=>{var D;s.value=!1,setTimeout(()=>{},500);try{const F=(D=_.value)==null?void 0:D.contentDocument;F&&F.addEventListener("click",B=>{const U=B.target.closest("a[href]");if(U&&!U.target&&!U.getAttribute("onclick")){const Q=U.getAttribute("href");Q&&(Q.startsWith("/")||Q.startsWith("http"))&&(B.preventDefault(),window.parent.postMessage({type:"navigateTo",content:Q},"*"))}},!0)}catch{}},w=()=>{a.value=!0,s.value=!0,p=!1},k=()=>{p||(p=!0,s.value=!1,a.value=!1,b(),t.productEditModel.data.reloader())},b=()=>{l.value=!0,c.value+=1},S=()=>{s.value=!0,_.value&&(_.value.src=_.value.src.toString())},$=D=>{const{type:F,content:B}=D.data;F==="gutenbergContentChanged"&&b(),F==="navigateTo"&&(k(),window.location.href=B)};return Ie(()=>{g(),window.addEventListener("message",$)}),cl(()=>{window.removeEventListener("message",$)}),(D,F)=>{const B=C("el-icon"),U=C("el-button"),Q=C("el-breadcrumb-item"),V=C("el-breadcrumb"),I=C("el-dialog");return r(),h(P,null,[o("div",S7,[F[2]||(F[2]=o("div",{class:"fct-custom-gutenberg-editor-wrap-overlay"},null,-1)),l.value?(r(),h("div",F7,[o("span",null,[R(m(A(u)("Loading preview..."))+" ",1),n(B,{class:"is-loading"},{default:d(()=>[n(A(en))]),_:1})])])):x("",!0),o("iframe",{ref_key:"previewIframeRef",ref:f,class:"scrollbar-none preview-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true&is-preview-mode=true&fct-preview=${c.value}`,width:"100%",height:"400px",onLoad:y,style:ra({visibility:l.value?"hidden":"visible"})},null,44,$7)]),o("div",E7,[n(U,{onClick:w},{default:d(()=>[R(m(A(u)("Show Content Editor")),1)]),_:1})]),n(I,{"append-to-body":!0,"show-close":!1,"modal-class":"fct-custom-gutenberg-editor-dialog",width:"800px",modelValue:a.value,"onUpdate:modelValue":F[0]||(F[0]=M=>a.value=M),onClose:k,onOpen:F[1]||(F[1]=()=>{S()})},{header:d(()=>[o("div",U7,[n(V,{separator:"/"},{default:d(()=>[n(Q,null,{default:d(()=>[o("span",{class:"fct-custom-gutenberg-editor-product-title",onClick:k},m(e.product.post_title),1)]),_:1}),n(Q,null,{default:d(()=>F[3]||(F[3]=[R("Editor",-1)])),_:1,__:[3]})]),_:1}),s.value?x("",!0):(r(),E(U,{key:0,class:"fct-custom-gutenberg-editor-close-btn",onClick:k},{default:d(()=>[n(Y,{name:"Cross"}),R(" "+m(A(u)("Close")),1)]),_:1}))])]),default:d(()=>[o("div",I7,[s.value?(r(),h("div",Q7,[o("span",null,[R(m(A(u)("Loading editor..."))+" ",1),n(B,{class:"is-loading"},{default:d(()=>[n(A(en))]),_:1})])])):x("",!0),o("iframe",{ref_key:"dialogIframeRef",ref:_,class:"dialog-iframe",src:`${i.value}/post.php?post=${e.post_id}&action=edit&custom-editor=true`,width:"100%",height:"700px",sandbox:"allow-same-origin allow-scripts allow-forms allow-popups",onLoad:v,style:ra({visibility:s.value?"hidden":"visible"})},null,44,D7)])]),_:1},8,["modelValue"])],64)}}},T7={class:"fct-product-info-wrap"},M7={class:"fct-admin-input-wrapper"},L7={class:"fct-admin-input-wrapper"},R7={class:"form-note"},O7={class:"fct-excerpt-word-counter mt-[7px]"},P7={class:"editor-tabs-nav"},H7={class:"fct-custom-long-desc-wrap fct-admin-input-wrapper"},N7={class:"custom-wp-editor-wrapper relative"},K7={class:"relative rounded overflow-hidden"},G7={class:"editor-tab-content fct-wp-editor-tab-content"},z7={class:"editor-tab-content fct-gutenberg-tab-content"},j7={__name:"ProductInfo",props:{product:Object,productEditModel:Object,reload:Function},setup(e){const t=e,a=T(!1),l=T("wp-editor");T("#gt"),nl();const s=T(),i=c=>{t.productEditModel.updateLongDescEditorChange(c),l.value=c};return be(()=>t.product.post_title,c=>{const p=document.querySelector(".fct-admin-product-header .product-name");p&&(p.textContent=c&&c.trim()?c:u("Product Name"))}),Ie(()=>{var c,p,f,_,g,y;a.value=!0,t.productEditModel.getMaxExcerptWordCount(),((c=t.product)==null?void 0:c.post_excerpt)!==void 0&&((p=t.product)==null?void 0:p.post_excerpt.toString().length)>0&&t.productEditModel.setExcerptWordCount((f=t.product)==null?void 0:f.post_excerpt.toString().split(" ").length),(y=(g=(_=t.product)==null?void 0:_.detail)==null?void 0:g.other_info)!=null&&y.active_editor&&(l.value=t.product.detail.other_info.active_editor)}),be(()=>t.productEditModel.data.discardKey,()=>{s.value&&s.value.resetContent(t.product.post_content)}),(c,p)=>{const f=C("el-input"),_=C("el-form-item"),g=C("el-form"),y=Va("loading");return r(),h("div",T7,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[6]||(p[6]=Ge(()=>{},["prevent"]))},{default:d(()=>[o("div",M7,[n(_,{label:A(u)("Title"),required:""},{default:d(()=>[n(f,{class:de(e.productEditModel.hasValidationError("post_title")?"is-error":""),id:"post_title",placeholder:A(u)("Title"),type:"text",modelValue:e.product.post_title,"onUpdate:modelValue":p[0]||(p[0]=v=>e.product.post_title=v),onInput:p[1]||(p[1]=v=>{e.productEditModel.onChangeInputField("post_title",v)}),onFocus:p[2]||(p[2]=v=>e.productEditModel.clearValidationError("post_title"))},null,8,["class","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_title"},null,8,["validation-errors"])]),_:1},8,["label"])]),o("div",L7,[n(_,{label:A(u)("Short description")},{default:d(()=>[n(f,{class:"fct-short-desc-input",onInput:p[3]||(p[3]=v=>{e.productEditModel.onChangeInputField("post_excerpt",v)}),modelValue:e.product.post_excerpt,"onUpdate:modelValue":p[4]||(p[4]=v=>e.product.post_excerpt=v),rows:2,type:"textarea",onFocus:p[5]||(p[5]=v=>e.productEditModel.clearValidationError("post_excerpt"))},null,8,["modelValue"]),o("div",null,[o("div",R7,[o("p",O7,m(A(u)("%1$s Words of %2$s",A(u)(e.productEditModel.data.excerptWordCount),A(u)(e.productEditModel.maxExcerptWordCount))),1)]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":"post_excerpt"},null,8,["validation-errors"])])]),_:1},8,["label"])])]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Long Description")},{action:d(()=>[Wt((r(),h("div",P7,[n(ad,null,{default:d(()=>[n(Qo,{label:A(u)("Classic Editor"),class:de(l.value==="wp-editor"?"active":""),onClick:p[7]||(p[7]=v=>i("wp-editor"))},null,8,["label","class"]),n(Qo,{label:A(u)("Builder"),class:de(l.value==="gutenberg"?"active":""),onClick:p[8]||(p[8]=v=>i("gutenberg"))},null,8,["label","class"])]),_:1})])),[[y,e.productEditModel.hasChangeLongDescEditor]])]),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(g,{"label-position":"top","require-asterisk-position":"right",onSubmit:p[10]||(p[10]=Ge(()=>{},["prevent"]))},{default:d(()=>[o("div",H7,[n(_,null,{default:d(()=>[o("div",N7,[o("div",K7,[Wt(o("div",G7,[n(ls,{ref_key:"wpEditor",ref:s,modelValue:e.product.post_content,onUpdate:p[9]||(p[9]=v=>{e.productEditModel.onChangeInputField("post_content",v)})},null,8,["modelValue"])],512),[[Tl,l.value==="wp-editor"]]),Wt(o("div",z7,[n(V7,{post_id:e.product.ID,product:e.product,reload:e.reload,productEditModel:e.productEditModel},null,8,["post_id","product","reload","productEditModel"])],512),[[Tl,l.value==="gutenberg"]])])])]),_:1})])]),_:1})]),_:1})]),_:1})])}}},q7=["aria-label"],Y7=["src","alt"],W7={class:"fmp-featured__edit-icon"},J7=["src","alt"],X7={key:0,class:"fmp-count"},Z7={key:0,class:"fmp-preview-grid"},eL=["data-fct-media-kind"],tL=["src","alt"],aL={key:0,class:"fmp-preview-play","aria-hidden":"true"},lL={key:1,class:"fmp-preview-more"},sL={key:1,class:"fmp-add-full",type:"button"},nL={class:"fmp-modal-body"},oL={key:0,class:"fmp-grid-loading",role:"status","data-fct-gallery-loading":""},iL=["data-fct-media-kind"],rL=["src","alt"],dL={key:0,class:"fmp-grid-play","aria-hidden":"true"},uL={key:3,class:"fmp-grid-move"},cL=["data-fct-media-move-index","disabled","aria-label","onClick"],AL=["data-fct-media-move-index","disabled","aria-label","onClick"],pL=["disabled","aria-label","title","onClick"],fL={key:2,class:"fmp-empty"},mL={class:"fmp-sr-only",role:"status","aria-live":"polite","data-fct-gallery-live":""},hL={class:"fmp-url-list"},_L=["src","alt"],vL={class:"fmp-url-info"},gL={class:"fmp-url-title"},yL={class:"fmp-url-text"},bL=["onClick","title"],wL={class:"fmp-url-add"},CL={class:"dialog-footer"},kL=["aria-disabled"],BL={class:"fct-media-picker-footer-actions"},xL={class:"fct-btn-group sm"},go=4,yl={__name:"BulkMediaPicker",props:{modelValue:{type:Array,default:()=>[]},compact:{type:Boolean,default:!0},maxThumbs:{type:Number,default:3},multiple:{type:Boolean,default:!0},showUrlTab:{type:Boolean,default:!0},title:{type:String,default:""},featured:{type:Boolean,default:!1},square:{type:Boolean,default:!1},showApplyToAll:{type:Boolean,default:!1},defaultApplyToAll:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},busy:{type:Boolean,default:!1},extraPreviews:{type:Array,default:()=>[]},extraItems:{type:Array,default:()=>[]},extraItemsLoading:{type:Boolean,default:!1}},emits:["update:modelValue","change","open","save","extra-reorder","extra-remove"],setup(e,{emit:t}){const a=gs.getUrl("images/placeholder.svg"),l=N=>{N.target&&N.target.src!==a&&(N.target.src=a)},s=e,i=t,c=T(!1),p=T([]),f=T("gallery"),_=T(""),g=T(!1),y=K(()=>s.title||u("Manage Media")),v=K(()=>s.selectedCount>0?u("Apply to all (%1$s)",s.selectedCount):u("Apply to all")),w=K(()=>p.value.filter(N=>N.id>0)),k=K(()=>p.value.filter(N=>!N.id)),b=K(()=>s.showUrlTab),S=K(()=>Array.isArray(s.modelValue)?s.modelValue:[]),$=K(()=>S.value.filter(N=>N&&N.url)),D=N=>({kind:"image",id:N.id,url:N.url,title:N.title||"",image:N}),F=K(()=>Pd(S.value.map(N=>({id:N.id,url:N.url,title:N.title||"",kind:"image"})),(Array.isArray(s.extraPreviews)?s.extraPreviews:[]).filter(N=>N&&N.url).map(N=>({id:N.id,url:N.url,title:N.title||"",kind:N.kind||"image",position:Rm(N.position)})))),B=T([]),U=K(()=>(Array.isArray(s.extraItems)?s.extraItems:[]).filter(N=>N&&N.url)),Q=K(()=>s.extraItemsLoading),V=(N=U.value)=>{B.value=Pd(p.value.map(D),N.map(ae=>({...ae})))},I=()=>{const{images:N,order:ae}=Om(B.value);p.value=N.map(oe=>oe.image),i("extra-reorder",ae.map(oe=>({tab:oe.tab,id:oe.id,position:oe.position})))};let M=!1;be(U,N=>{if(c.value){if(!M){M=!0,V();return}B.value=Hm(B.value,N)}});const O=T(""),L=N=>N.title||(N.kind==="video"?u("Video"):u("Image")),H=(N,ae)=>{const oe=document.querySelector(".fct-bulk-media-picker-modal");if(!oe)return;const fe=ye=>oe.querySelector(`[data-fct-media-move="${ye}"][data-fct-media-move-index="${N}"]`),re=fe(ae<0?"earlier":"later"),Ee=re&&!re.disabled?re:fe(ae<0?"later":"earlier");Ee&&Ee.focus()},j=(N,ae)=>{if(Q.value)return;const oe=B.value[N],fe=N+ae;!oe||!Pm(B.value,N,fe)||(I(),O.value=u("%1$s moved to position %2$s of %3$s",L(oe),fe+1,B.value.length),xe(()=>H(fe,ae)))},W=K(()=>B.value.findIndex(N=>N.kind==="image")),G=()=>{p.value=JSON.parse(JSON.stringify(S.value)),f.value="gallery",_.value="",g.value=s.defaultApplyToAll,c.value=!0,M=!1,O.value="",V([]),i("open")},Z=()=>{if(s.busy||Q.value)return;(JSON.stringify(p.value)!==JSON.stringify(S.value)||g.value)&&(i("update:modelValue",p.value),i("change",p.value,{applyToAll:g.value})),i("save"),c.value=!1},ne=()=>{s.busy||(c.value=!1)},ce=N=>{s.busy||N()},z=N=>{if(Q.value)return;const ae=B.value[N];ae&&(B.value.splice(N,1),ae.kind!=="image"&&i("extra-remove",ae),I())},ue=N=>{if(Q.value)return;const ae=N.filter(re=>re.url).map(re=>({id:re.id,title:re.title,url:re.url}));if(!s.multiple){p.value=ae.slice(0,1),V();return}const oe=new Set(p.value.map(re=>re.url));let fe=!1;for(const re of ae)oe.has(re.url)||(Hd(B.value,D(re)),oe.add(re.url),fe=!0);fe&&I()},ie=()=>{if(Q.value)return;const N=_.value.trim();if(!N)return;if(p.value.some(fe=>fe.url===N)){_.value="";return}const ae=N.split("/").pop().split("?")[0]||"image",oe={id:0,url:N,title:ae};s.multiple?(Hd(B.value,D(oe)),I()):(p.value=[oe],V()),_.value=""},J=N=>{const ae=B.value.findIndex(oe=>oe.kind==="image"&&oe.url===N);ae!==-1&&z(ae)};return(N,ae)=>{const oe=C("el-tag"),fe=C("el-button"),re=C("el-tab-pane"),Ee=C("el-input"),ye=C("el-tabs"),Ce=C("el-checkbox"),ve=C("el-dialog");return r(),h(P,null,[o("div",{class:de(["fct-media-picker",{"is-compact":e.compact,"is-featured":e.featured,"is-square":e.square}]),onClick:G},[e.featured?(r(),h(P,{key:0},[e.modelValue&&e.modelValue.length?(r(),h("button",{key:0,type:"button",class:"fmp-featured","aria-label":A(u)("Edit media")},[o("img",{src:e.modelValue[0].url||A(a),alt:e.modelValue[0].title||"",class:"fmp-featured__image",onError:l},null,40,Y7),o("span",W7,[n(Y,{name:"Edit"})]),e.modelValue.length>1?(r(),E(oe,{key:0,class:"fmp-featured__count",size:"small",round:""},{default:d(()=>[R(m(e.modelValue.length)+" "+m(N.$t("images")),1)]),_:1})):x("",!0)],8,q7)):(r(),E(fe,{key:1,class:"fct-mp-add-featured"},{default:d(()=>[n(Y,{name:"GalleryAdd"})]),_:1}))],64)):e.compact?(r(),h(P,{key:1},[$.value.length?(r(),h("div",{key:0,class:de(["fmp-stack",{"is-square":e.square}])},[(r(!0),h(P,null,te($.value.slice(0,e.maxThumbs),(Ue,Ke)=>(r(),h("span",{key:Ke,class:"fmp-thumb-wrap",style:ra({zIndex:e.maxThumbs-Ke})},[o("img",{src:Ue.url,alt:Ue.title||"",class:"fmp-thumb",onError:l},null,40,J7)],4))),128)),$.value.length>e.maxThumbs?(r(),h("span",X7,"+"+m($.value.length-e.maxThumbs),1)):x("",!0),ae[4]||(ae[4]=Dn('<span class="fmp-edit-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none" width="14" height="14"><path d="M11.7282 3.23787C12.3492 2.56506 12.6597 2.22865 12.9896 2.03243C13.7857 1.55896 14.766 1.54423 15.5754 1.99359C15.9108 2.17982 16.2309 2.50676 16.8709 3.16062C17.511 3.81449 17.8311 4.14143 18.0134 4.48409C18.4533 5.31092 18.4388 6.31232 17.9754 7.12558C17.7833 7.46262 17.454 7.7798 16.7953 8.41416L8.95894 15.9619C7.71081 17.1641 7.08675 17.7651 6.3068 18.0698C5.52685 18.3744 4.66942 18.352 2.95455 18.3071L2.72123 18.301C2.19917 18.2874 1.93814 18.2806 1.7864 18.1084C1.63467 17.9362 1.65538 17.6703 1.69681 17.1385L1.71931 16.8497C1.83592 15.3529 1.89423 14.6046 2.1865 13.9318C2.47878 13.2591 2.98294 12.7129 3.99127 11.6204L11.7282 3.23787Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M10.8333 3.33334L16.6666 9.16668" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"></path><path d="M11.6667 18.3333L18.3334 18.3333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></span>',1))],2)):(r(),E(fe,{key:1,class:"fct-mp-add-compact"},{default:d(()=>[n(Y,{name:"GalleryAdd"})]),_:1}))],64)):(r(),h(P,{key:2},[F.value.length?(r(),h("div",Z7,[(r(!0),h(P,null,te(F.value.slice(0,go),(Ue,Ke)=>(r(),h("div",{class:de(["fmp-preview-item",{"is-video":Ue.kind==="video"}]),key:`${Ue.kind}-${Ue.id??Ke}`,"data-fct-media-kind":Ue.kind},[o("img",{src:Ue.url||A(a),alt:Ue.title||"",onError:l},null,40,tL),Ue.kind==="video"?(r(),h("span",aL,ae[5]||(ae[5]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):x("",!0),Ke===go-1&&F.value.length>go?(r(),h("span",lL,"+"+m(F.value.length-go),1)):x("",!0)],10,eL))),128))])):(r(),h("button",sL,[ae[6]||(ae[6]=Dn('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" fill="none" width="20" height="20"><path d="M9.5 10C10.6046 10 11.5 9.10457 11.5 8C11.5 6.89543 10.6046 6 9.5 6C8.39543 6 7.5 6.89543 7.5 8C7.5 9.10457 8.39543 10 9.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13.5 2H9.5C4.5 2 2.5 4 2.5 9V15C2.5 20 4.5 22 9.5 22H15.5C20.5 22 22.5 20 22.5 15V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16.25 5H21.75" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M19 7.75V2.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path><path d="M3.16992 18.9501L8.09992 15.6401C8.88992 15.1101 10.0299 15.1701 10.7399 15.7801L11.0699 16.0701C11.8499 16.7401 13.1099 16.7401 13.8899 16.0701L18.0499 12.5001C18.8299 11.8301 20.0899 11.8301 20.8699 12.5001L22.4999 13.9001" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)),o("span",null,m(N.$t("Add Media")),1)]))],64))],2),c.value?(r(),E(ve,{key:0,modelValue:c.value,"onUpdate:modelValue":ae[3]||(ae[3]=Ue=>c.value=Ue),title:y.value,width:"600px","append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!e.busy,"before-close":ce,onClose:ne,class:"fct-bulk-media-picker-modal"},{default:d(()=>[o("div",nL,[n(ye,{modelValue:f.value,"onUpdate:modelValue":ae[1]||(ae[1]=Ue=>f.value=Ue)},{default:d(()=>[n(re,{label:N.$t("Gallery"),name:"gallery"},{default:d(()=>[Q.value?(r(),h("p",oL,m(N.$t("Loading gallery items...")),1)):x("",!0),B.value.length?(r(),E(A(sn),{key:1,list:B.value,class:de(["fmp-grid",{"is-locked":Q.value}]),tag:"div",animation:200,disabled:Q.value,onEnd:I},{default:d(()=>[(r(!0),h(P,null,te(B.value,(Ue,Ke)=>(r(),h("div",{class:de(["fmp-grid-item",{"is-video":Ue.kind==="video"}]),key:`${Ue.kind}-${Ue.id??""}-${Ue.url||Ke}`,"data-fct-media-kind":Ue.kind},[o("img",{src:Ue.url||A(a),alt:Ue.title||"",onError:l},null,40,rL),Ue.kind==="video"?(r(),h("span",dL,ae[7]||(ae[7]=[o("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[o("path",{d:"M8 5v14l11-7z"})],-1)]))):x("",!0),Ke===W.value?(r(),E(oe,{key:1,type:"primary",size:"small",class:"fmp-featured-tag"},{default:d(()=>[R(m(N.$t("Featured")),1)]),_:1})):Ke===0?(r(),E(oe,{key:2,type:"info",size:"small",class:"fmp-featured-tag"},{default:d(()=>[R(m(N.$t("Plays first")),1)]),_:1})):x("",!0),B.value.length>1?(r(),h("div",uL,[o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"earlier","data-fct-media-move-index":Ke,disabled:Q.value||Ke===0,"aria-label":A(u)("Move %1$s earlier",L(Ue)),onClick:Ge(We=>j(Ke,-1),["stop"])},ae[8]||(ae[8]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,cL),o("button",{type:"button",class:"fmp-move-btn","data-fct-media-move":"later","data-fct-media-move-index":Ke,disabled:Q.value||Ke===B.value.length-1,"aria-label":A(u)("Move %1$s later",L(Ue)),onClick:Ge(We=>j(Ke,1),["stop"])},ae[9]||(ae[9]=[o("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("path",{d:"M9 6l6 6-6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,AL)])):x("",!0),o("button",{type:"button",class:"fmp-remove-btn",disabled:Q.value,"aria-label":A(u)("Remove %1$s",L(Ue)),title:N.$t("Remove"),onClick:Ge(We=>z(Ke),["stop"])}," × ",8,pL)],10,iL))),128))]),_:1},8,["list","class","disabled"])):(r(),h("div",fL,[o("p",null,m(N.$t("No media added yet.")),1)])),o("span",mL,m(O.value),1)]),_:1},8,["label"]),b.value?(r(),E(re,{key:0,name:"imported-urls"},{label:d(()=>[R(m(N.$t("Add by URL"))+" ",1),k.value.length?(r(),E(oe,{key:0,size:"small",round:"",style:{"margin-left":"6px"}},{default:d(()=>[R(m(k.value.length),1)]),_:1})):x("",!0)]),default:d(()=>[o("div",hL,[(r(!0),h(P,null,te(k.value,Ue=>(r(),h("div",{class:"fmp-url-item",key:Ue.url},[o("img",{src:Ue.url,alt:Ue.title||"",class:"fmp-url-thumb"},null,8,_L),o("div",vL,[o("span",gL,m(Ue.title),1),o("span",yL,m(Ue.url),1)]),o("button",{type:"button",class:"fmp-url-delete",onClick:Ge(Ke=>J(Ue.url),["stop"]),title:N.$t("Remove")}," × ",8,bL)]))),128)),o("div",wL,[n(Ee,{modelValue:_.value,"onUpdate:modelValue":ae[0]||(ae[0]=Ue=>_.value=Ue),placeholder:N.$t("Paste image URL..."),size:"small",disabled:Q.value,onKeyup:xa(ie,["enter"])},null,8,["modelValue","placeholder","disabled"]),n(fe,{size:"small",onClick:ie,disabled:Q.value||!_.value.trim()},{default:d(()=>[R(m(N.$t("Add")),1)]),_:1},8,["disabled"])])])]),_:1})):x("",!0),ga(N.$slots,"extra-tabs",{activeTab:f.value})]),_:3},8,["modelValue"])]),o("div",CL,[o("div",{class:de(["fmp-add-media",{"is-disabled":Q.value}]),"aria-disabled":Q.value?"true":null},[n(uA,{attachments:w.value,multiple:e.multiple,onOnMediaSelected:ue},null,8,["attachments","multiple"])],10,kL),o("div",BL,[e.showApplyToAll?(r(),h("label",{key:0,class:de(["fct-media-picker-apply-to-group-label",{"is-enabled":g.value}])},[n(Ce,{modelValue:g.value,"onUpdate:modelValue":ae[2]||(ae[2]=Ue=>g.value=Ue),"aria-label":N.$t("Apply media to all variants in this group")},null,8,["modelValue","aria-label"]),R(" "+m(v.value),1)],2)):x("",!0),o("div",xL,[n(fe,{disabled:e.busy,onClick:ne},{default:d(()=>[R(m(N.$t("Cancel")),1)]),_:1},8,["disabled"]),n(fe,{type:"primary",disabled:e.busy||Q.value,onClick:Z},{default:d(()=>[R(m(N.$t("Save")),1)]),_:1},8,["disabled"])])])])]),_:3},8,["modelValue","title","close-on-press-escape"])):x("",!0)],64)}}},SL={},FL={class:"fct-shared-variant-item-box"},$L={key:0,class:"fct-shared-variant-item-box__header"},EL={class:"fct-shared-variant-item-box__label"},UL={class:"fct-shared-variant-item-box__action"},IL={class:"fct-shared-variant-item-box__body"};function QL(e,t){return r(),h("div",FL,[e.$slots.label||e.$slots.action?(r(),h("div",$L,[o("div",EL,[ga(e.$slots,"label")]),o("div",UL,[ga(e.$slots,"action")])])):x("",!0),o("div",IL,[ga(e.$slots,"default")])])}const zn=nt(SL,[["render",QL]]),DL={class:"fct-product-media-row"},VL={key:0,class:"fct-variant-title-readonly"},TL={key:0,class:"fct-variant-title-group text-system-dark dark:text-white"},ML={class:"fct-variant-title-detail text-system-mid dark:text-gray-200"},LL={class:"fct-admin-input-wrapper"},RL={__name:"VariantTitleMedia",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,titleInfo:Object},setup(e){const t=e,a=K(()=>{var s;return["simple_variations","advanced_variations"].includes((s=t.product.detail)==null?void 0:s.variation_type)}),l=K(()=>{var s;return((s=t.product.detail)==null?void 0:s.variation_type)==="advanced_variations"});return(s,i)=>{const c=C("el-input"),p=C("el-form-item");return a.value?(r(),E(zn,{key:0,class:"fct-product-media-and-title"},{default:d(()=>[o("div",DL,[n(yl,{modelValue:e.variant.media,"onUpdate:modelValue":i[0]||(i[0]=f=>e.variant.media=f),featured:!0,compact:!1,onChange:i[1]||(i[1]=f=>e.productEditModel.updatePricingOtherValue("media",f,e.fieldKey,e.variant,e.modeType))},null,8,["modelValue"]),l.value?(r(),h("div",VL,[e.titleInfo&&e.titleInfo.group?(r(),h("div",TL,m(e.titleInfo.group),1)):x("",!0),o("div",ML,m(e.titleInfo&&e.titleInfo.detail||e.variant.variation_title),1)])):(r(),E(p,{key:1,label:A(u)("Variation Title")},{default:d(()=>[o("div",LL,[n(c,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.variation_title`)?"is-error":""),id:`${e.fieldKey}.variation_title`,placeholder:A(u)("e.g. Small, Medium, Large"),type:"text",modelValue:e.variant.variation_title,"onUpdate:modelValue":i[2]||(i[2]=f=>e.variant.variation_title=f),onInput:i[3]||(i[3]=f=>{e.productEditModel.updatePricingValue("variation_title",f,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.variation_title`},null,8,["validation-errors","field-key"])])]),_:1},8,["label"]))])]),_:1})):x("",!0)}}},OL=nt(RL,[["__scopeId","data-v-81001ec3"]]),PL={class:"fct-variant-item-collapse"},HL={class:"fct-variant-item-collapse-header"},NL={class:"fct-variant-item-collapse-body"},lf={__name:"VariantItemCollapse",props:{modelValue:{type:Array,default:()=>[""]}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=K(()=>s.value.includes("1"));return(c,p)=>{const f=C("el-collapse-item"),_=C("el-collapse");return r(),h("div",PL,[n(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),accordion:""},{default:d(()=>[n(f,{name:"1",icon:A(om)},{title:d(()=>[o("div",HL,[ga(c.$slots,"header",{isOpen:i.value})])]),default:d(()=>[o("div",NL,[ga(c.$slots,"default")])]),_:3},8,["icon"])]),_:3},8,["modelValue"])])}}},sf=(e="",t="")=>{let a;return e==="comma"?a=",":e==="dot"?a=".":a=t==="dot_comma"?",":".",{decimal:a,thousand:a===","?".":",",locale:a===","?"de-DE":"en-US"}},lr=e=>String(e||"").replace(/^0+(?=\d)/,""),KL=e=>String(e??"").replace(/[^\d.,]/g,""),nf=(e,t=",")=>{const a=KL(e);if(!a)return"";const l=a.lastIndexOf("."),s=a.lastIndexOf(","),i=Math.max(l,s);if(i===-1)return lr(a.replace(/[.,]/g,""));const c=lr(a.slice(0,i).replace(/[^\d]/g,"")),p=a.slice(i+1).replace(/[^\d]/g,""),f=a.charAt(i),_=(a.match(new RegExp(`\\${f}`,"g"))||[]).length,g=i===a.length-1,y=a.includes(".")&&a.includes(",");if(!g&&!y&&f===t&&(_>1||p.length>2))return lr(a.replace(/[^\d]/g,""));const w=c||"0";return g?`${w}.`:`${w}.${p.slice(0,2)}`},of=(e,t=",")=>{if(e==null||e==="")return NaN;const a=typeof e=="number"?String(e):nf(e,t);return a?parseFloat(a.replace(/\.$/,"")):NaN},rf=(e,t=",")=>{if(e==null||e==="")return"";const a=of(e,t);return isNaN(a)?"":Math.round(a*100)},GL=/^-?[\d.,]*\d[\d.,]*$/,zL=(e,t=",")=>{if(e==null)return"";const a=String(e).trim();if(a==="")return"";if(!GL.test(a))return a;const l=rf(a,t);return l===""?a:a.charAt(0)==="-"?-l:l},yo=e=>{if(e==null||e==="")return"";const t=typeof e=="number"?e:parseFloat(String(e));return isNaN(t)?"":(t/100).toFixed(2)},jL=["innerHTML"],Za={__name:"PriceInput",props:{modelValue:{type:[Number,String],default:""},numberFormat:{type:String,default:"comma_dot",validator:e=>["comma_dot","dot_comma"].includes(e)},id:{type:String,default:""},placeholder:{type:String,default:""},min:{type:Number,default:0},errorClass:{type:String,default:""},size:{type:String,default:""},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>ze.get("shop.currency_sign","$")),i=K(()=>sf(ze.get("shop.decimal_separator",""),a.numberFormat)),c=K(()=>i.value.decimal),p=K(()=>i.value.thousand),f=K(()=>i.value.locale),_=/[\d.,]/,g=O=>{["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Enter","Home","End"].includes(O.key)||O.ctrlKey||O.metaKey||_.test(O.key)||O.preventDefault()},y=O=>nf(O,p.value),v=O=>of(O,p.value),w=O=>{const L=v(O);return isNaN(L)?"":L.toLocaleString(f.value,{minimumFractionDigits:0,maximumFractionDigits:2})},k=O=>{if(!O)return"";const L=O.endsWith("."),[H="",j=""]=O.split("."),W=(H||"0").replace(/\B(?=(\d{3})+(?!\d))/g,p.value);return L?`${W}${c.value}`:j?`${W}${c.value}${j}`:W},b=(O,L=!1)=>{const H=v(O);return isNaN(H)?"":(L?S(H):H).toFixed(2)},S=O=>a.min===null||a.min===void 0||isNaN(O)?O:O<a.min?a.min:O,$=O=>rf(O,p.value),D=T(""),F=T(""),B=T(!1),U=O=>{const L=b(yo(O));if(!L){D.value="",F.value="";return}D.value=w(L),F.value=L},Q=O=>{const L=y(O);if(F.value=L,D.value=k(L),B.value=!0,L===""){l("update:modelValue","");return}const H=b(L);H!==""&&H!==yo(a.modelValue)&&l("update:modelValue",$(H))},V=T(""),I=()=>{V.value=b(yo(a.modelValue)),l("focus")},M=()=>{const O=B.value?F.value:yo(a.modelValue);let L=a.modelValue;if(O==="")L="",l("update:modelValue",""),V.value!==""&&l("change",""),D.value="",F.value="";else{const H=b(O,!0);if(H==="")U(a.modelValue);else{const j=$(H);L=j,l("update:modelValue",j),H!==V.value&&l("change",j),D.value=w(H),F.value=H}}B.value=!1,V.value="",l("blur",L)};return be([()=>a.modelValue,()=>a.numberFormat],([O])=>{B.value||U(O)}),U(a.modelValue),(O,L)=>{const H=C("el-input");return r(),E(H,{class:de(e.errorClass),id:e.id,size:e.size,placeholder:e.placeholder,"model-value":D.value,disabled:e.disabled,onFocus:I,onBlur:M,onInput:Q,onKeydown:g},oa({prefix:d(()=>[o("span",{innerHTML:s.value},null,8,jL)]),_:2},[O.$slots.suffix?{name:"suffix",fn:d(()=>[ga(O.$slots,"suffix")]),key:"0"}:void 0,O.$slots.append?{name:"append",fn:d(()=>[ga(O.$slots,"append")]),key:"1"}:void 0]),1032,["class","id","size","placeholder","model-value","disabled"])}}},qL={key:0,class:"fct-shared-variant-item-box__switch"},YL={class:"fct-shared-variant-item-box__hint"},WL={key:1,class:"fct-inline-select-wrap"},JL={class:"fct-price-with-inclusion"},XL={key:0,class:"fct-required"},ZL={class:"fct-admin-input-wrapper"},eR={key:0},tR={key:0,class:"fct-collapse-heading"},aR={key:1,class:"fct-tag-group"},lR={class:"fct-tag-item"},sR={class:"fct-tags-internal"},nR={key:0,class:"fct-tag-item"},oR={class:"fct-tags-internal"},iR={key:1,class:"fct-tag-item"},rR={class:"fct-tags-internal"},dR={key:2,class:"fct-tag-item"},uR={class:"fct-tags-internal"},cR={class:"fct-tag-item"},AR={class:"fct-tags-internal"},pR={class:"fct-shared-variant-pricing-additional"},fR={class:"fct-admin-input-wrapper"},mR={class:"fct-admin-input-wrapper"},hR={class:"fct-admin-input-wrapper"},_R={key:0},vR={class:"fct-admin-input-wrapper"},gR={class:"fct-admin-input-wrapper"},yR={class:"fct-admin-input-wrapper"},bR={class:"fct-admin-input-wrapper"},wR={class:"fct-admin-input-wrapper"},CR={class:"fct-admin-input-wrapper"},kR={class:"fct-admin-input-wrapper"},sr=2,df={__name:"VariantPrice",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=ze.get("app_config.isProActive"),l=T(),s=T([""]),i=T(0),c=new Set(["compare_price","repeat_interval","trial_days","times","signup_fee_name","signup_fee","item_cost","manage_cost"]);be(()=>{var b;return(b=t.variant)==null?void 0:b.id},()=>{var b,S;i.value=Number((S=(b=t.variant)==null?void 0:b.other_info)==null?void 0:S.signup_fee)||0}),be(()=>{var b,S;return(S=(b=t.variant)==null?void 0:b.other_info)==null?void 0:S.payment_type},b=>{b==="subscription"&&(s.value="1")}),be(()=>{var b;return(b=t.productEditModel)==null?void 0:b.validationErrors},b=>{if(!b||Object.keys(b).length===0)return;Object.keys(b).some($=>{for(const D of c)if($.includes(D))return!0;return!1})&&(s.value="1")},{deep:!0});let p=t.product.variants.length>0;const f=K(()=>{var b;return((b=window.fluentCartAdminApp)==null?void 0:b.subscription_intervals)??[]}),_=()=>{var b,S,$;return((b=t.variant)==null?void 0:b.other_info)&&["subscription"].includes(($=(S=t.variant)==null?void 0:S.other_info)==null?void 0:$.payment_type)},g=(b,S,$,D)=>{t.productEditModel.updatePricingOtherValue(b,S,$,D,t.modeType)},y=(b,S,$)=>{const D=Number(b);(!Number.isFinite(D)||D<sr)&&g("times",sr,S,$)},v=b=>{t.productEditModel.updatePricingOtherValue("manage_setup_fee",b,t.fieldKey,t.variant,t.modeType),b==="no"?(i.value=Number(t.variant.other_info.signup_fee),t.productEditModel.updatePricingOtherValue("signup_fee","0",t.fieldKey,t.variant,t.modeType)):t.productEditModel.updatePricingOtherValue("signup_fee",i.value,t.fieldKey,t.variant,t.modeType)},w=K(()=>{var $,D;const b=Number(t.variant.item_price)||0,S=Number((D=($=t.variant)==null?void 0:$.other_info)==null?void 0:D.times)||1;return b*S}),k=b=>{const S=f.value.find(D=>D.value===b);return!(S!=null&&S.label)&&!b?"":((S==null?void 0:S.label)||b).split(" ").map(D=>D.charAt(0).toUpperCase()).join("")};return(b,S)=>{const $=C("el-switch"),D=C("el-option"),F=C("el-select"),B=C("el-form-item"),U=C("el-col"),Q=C("el-input"),V=C("el-row"),I=C("el-checkbox"),M=C("el-tooltip");return r(),E(zn,null,{label:d(()=>[R(m(A(u)("Pricing")),1)]),action:d(()=>{var O;return[(O=e.variant)!=null&&O.other_info?(r(),h("div",qL,[e.isGroupMode?(r(),h("div",WL,[o("label",null,m(A(u)("Payment Type"))+":",1),n(F,{size:"small",modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":S[1]||(S[1]=L=>e.variant.other_info.payment_type=L),"popper-class":"fct-group-select-popper",onChange:S[2]||(S[2]=L=>{L==="subscription"&&!e.variant.other_info.repeat_interval&&xe(()=>{e.variant.other_info.repeat_interval="yearly"})}),class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(D,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(D,{value:"subscription",label:A(u)("Subscription")},null,8,["label"]),n(D,{value:"onetime",label:A(u)("One-time")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(P,{key:0},[o("span",YL,m(A(u)("Subscription")),1),n($,{size:"small","model-value":e.variant.other_info.payment_type==="subscription",onChange:S[0]||(S[0]=L=>{const H=L?"subscription":"onetime";e.productEditModel.updatePricingOtherValue("payment_type",H,null,e.variant,e.modeType),e.variant.other_info.repeat_interval="",L&&xe(()=>{var j;e.variant.other_info.repeat_interval="yearly",e.variant.other_info.times==""&&((j=l.value.value)==null||j.focus())})})},null,8,["model-value"])],64))])):x("",!0)]}),default:d(()=>[o("div",JL,[n(B,{class:"fct-price-with-inclusion__price"},{label:d(()=>{var O,L;return[R(m(((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"))+" ",1),e.isGroupMode?x("",!0):(r(),h("span",XL,"*"))]}),default:d(()=>{var O,L;return[o("div",ZL,[n(Za,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_price`)?"is-error":"",id:`${e.fieldKey}.item_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.installment)==="yes"?A(u)("Installment Price"):A(u)("Price"),"model-value":e.variant.item_price,"onUpdate:modelValue":S[3]||(S[3]=H=>{e.variant.item_price=H,e.productEditModel.updatePricingValue("item_price",H,e.fieldKey,e.variant,e.modeType)})},{suffix:d(()=>{var H,j,W,G;return[((j=(H=e.variant)==null?void 0:H.other_info)==null?void 0:j.installment)==="yes"?(r(),h("span",eR," x "+m((G=(W=e.variant)==null?void 0:W.other_info)==null?void 0:G.times),1)):x("",!0)]}),_:1},8,["error-class","id","placeholder","model-value"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_price`},null,8,["validation-errors","field-key"])])]}),_:1}),e.productEditModel.isTaxEnabled()?(r(),E(B,{key:0,class:"fct-price-with-inclusion__tax"},{label:d(()=>[R(m(A(u)("Tax")),1)]),default:d(()=>{var O,L;return[e.isGroupMode?(r(),E(F,{key:0,modelValue:e.variant.other_info.tax_inclusion,"onUpdate:modelValue":S[4]||(S[4]=H=>e.variant.other_info.tax_inclusion=H),"popper-class":"fct-group-select-popper"},{default:d(()=>[n(D,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(D,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(D,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E(F,{key:1,"model-value":((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.tax_inclusion)||"_default_",onChange:S[5]||(S[5]=H=>{const j=H==="_default_"?"":H;e.variant.other_info&&(e.variant.other_info.tax_inclusion=j),e.productEditModel.updatePricingOtherValue("tax_inclusion",j,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[n(D,{value:"_default_",label:A(u)("Store default")},null,8,["label"]),n(D,{value:"included",label:A(u)("Tax included")},null,8,["label"]),n(D,{value:"excluded",label:A(u)("Tax excluded")},null,8,["label"])]),_:1},8,["model-value"]))]}),_:1})):x("",!0)]),n(lf,{modelValue:s.value,"onUpdate:modelValue":S[27]||(S[27]=O=>s.value=O)},{header:d(({isOpen:O})=>{var L,H,j,W,G,Z;return[O?(r(),h("div",tR,m(A(u)("Additional display prices")),1)):(r(),h("div",aR,[o("div",lR,[R(m(A(u)("Compare-at"))+" ",1),o("span",sR,m((L=e.variant)!=null&&L.compare_price?A(Kt)(e.variant.compare_price,!0):0),1)]),e.variant.other_info.payment_type==="subscription"?(r(),h("div",nR,[R(m(A(u)("Installment"))+" ",1),o("span",oR,m(((j=(H=e.variant)==null?void 0:H.other_info)==null?void 0:j.installment)==="yes"?A(u)("Yes"):A(u)("No")),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",iR,[R(m(A(u)("Interval"))+" ",1),o("span",rR,m(k(e.variant.other_info.repeat_interval)),1)])):x("",!0),e.variant.other_info.payment_type==="subscription"?(r(),h("div",dR,[R(m(A(u)("Trial Days"))+" ",1),o("span",uR,m(((G=(W=e.variant)==null?void 0:W.other_info)==null?void 0:G.trial_days)??0),1)])):x("",!0),o("div",cR,[R(m(A(u)("Cost Per Item"))+" ",1),o("span",AR,m((Z=e.variant)!=null&&Z.item_cost?A(Kt)(e.variant.item_cost,!0):A(u)("N/A")),1)])]))]}),default:d(()=>[o("div",pR,[n(V,{gutter:15},{default:d(()=>[n(U,{lg:12},{default:d(()=>[o("div",fR,[n(B,null,{label:d(()=>[n(pa,{title:A(u)("Compare at price"),content:A(u)("Set a higher price to show with a strike-through, highlighting a discount for sales")},null,8,["title","content"])]),default:d(()=>[n(Za,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.compare_price`)?"is-error":"",id:`${e.fieldKey}.compare_price`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Compare at price"),"model-value":e.variant.compare_price,"onUpdate:modelValue":S[6]||(S[6]=O=>{e.variant.compare_price=O,e.productEditModel.updatePricingValue("compare_price",O,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.compare_price`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),_()?(r(),h(P,{key:0},[n(U,{lg:12},{default:d(()=>[o("div",mR,[n(B,{label:A(u)("Interval"),required:""},{default:d(()=>[n(F,{class:de(["fct-repeat-payment-every-select",e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.repeat_interval`)?"is-error":""]),id:`${e.fieldKey}.other_info.repeat_interval`,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":S[7]||(S[7]=O=>e.variant.other_info.repeat_interval=O),placeholder:A(u)("Interval"),onChange:S[8]||(S[8]=O=>{e.productEditModel.updatePricingOtherValue("repeat_interval",O,e.fieldKey,e.variant,e.modeType)})},{default:d(()=>[(r(!0),h(P,null,te(f.value,O=>(r(),E(D,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["class","id","modelValue","placeholder"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.repeat_interval`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])])]),_:1}),n(U,{lg:12},{default:d(()=>[n(B,{class:"has-tooltip"},{label:d(()=>[n(pa,{title:A(u)("Trial Days"),content:A(u)("Enter the number of days the free trial will last. The trial period cannot exceed 365 days.")},null,8,["title","content"])]),default:d(()=>[n(Q,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.trial_days`)?"is-error":""),id:`${e.fieldKey}.other_info.trial_days`,placeholder:A(u)("Trial Days"),type:"number",min:1,max:365,modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":S[9]||(S[9]=O=>e.variant.other_info.trial_days=O),modelModifiers:{number:!0},autofocus:"",onInput:S[10]||(S[10]=O=>{e.productEditModel.updatePricingOtherValue("trial_days",O,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.trial_days`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})],64)):x("",!0)]),_:1}),_()?(r(),E(V,{key:0},{default:d(()=>{var O;return[n(U,{lg:24},{default:d(()=>[n(B,null,{default:d(()=>[n(I,{"true-value":"yes","false-value":"no",label:A(u)("Enable installment payment"),class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.installment`)?"is-error":""),id:`${e.fieldKey}.other_info.installment`,placeholder:A(u)("Occurrence"),type:"number",modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[11]||(S[11]=L=>e.variant.other_info.installment=L),modelModifiers:{number:!0},disabled:!A(a),onChange:S[12]||(S[12]=L=>{if(g("installment",L,e.fieldKey,e.variant),L==="no"){g("times",0,e.fieldKey,e.variant);return}(!e.variant.other_info.times||e.variant.other_info.times<2)&&g("times",2,e.fieldKey,e.variant)}),autofocus:""},null,8,["label","class","id","placeholder","modelValue","disabled"]),A(a)?x("",!0):(r(),E(M,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(Y,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),n(ya,{visible:((O=e.variant.other_info)==null?void 0:O.installment)==="yes",accordion:""},{default:d(()=>[n(V,{gutter:15},{default:d(()=>{var L;return[n(U,{lg:12},{default:d(()=>[n(B,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{title:A(u)("Installment Count"),content:A(u)("Number of payments to split the price over the installment period.")},null,8,["title","content"])]),default:d(()=>[n(Q,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.times`)?"is-error":""),id:`${e.fieldKey}.other_info.times`,placeholder:A(u)("Installment Count"),type:"number",min:sr,modelValue:e.variant.other_info.times,"onUpdate:modelValue":S[13]||(S[13]=H=>e.variant.other_info.times=H),modelModifiers:{number:!0},onInput:S[14]||(S[14]=H=>{g("times",H,e.fieldKey,e.variant)}),onChange:S[15]||(S[15]=H=>{y(H,e.fieldKey,e.variant)}),autofocus:"",ref_key:"inputSubscriptionTimesRef",ref:l},null,8,["class","id","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1}),((L=e.variant.other_info)==null?void 0:L.installment)==="yes"?(r(),E(U,{key:0,lg:12},{default:d(()=>[n(B,null,{label:d(()=>[n(pa,{title:A(u)("Total Price"),content:A(u)("Final price after all installments, excluding any fees.")},null,8,["title","content"])]),default:d(()=>[n(Za,{id:`${e.fieldKey}.total_price`,disabled:"","model-value":w.value},null,8,["id","model-value"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.times`},null,8,["validation-errors","field-key"])]),_:1})]),_:1})):x("",!0)]}),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),_()?(r(),E(V,{key:1,gutter:15},{default:d(()=>{var O,L;return[n(U,{lg:24},{default:d(()=>[o("div",hR,[n(B,{label:e.isGroupMode?A(u)("Setup fee"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[16]||(S[16]=H=>e.variant.other_info.manage_setup_fee=H),style:{width:"160px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(D,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(D,{value:"yes",label:A(u)("Setup fee: Yes")},null,8,["label"]),n(D,{value:"no",label:A(u)("Setup fee: No")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),h(P,{key:1},[n($,{size:"small",disabled:!A(a),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[17]||(S[17]=H=>e.variant.other_info.manage_setup_fee=H),"active-value":"yes","inactive-value":"no",onChange:v,"active-text":A(u)("Setup fee")},null,8,["disabled","modelValue","active-text"]),A(a)?x("",!0):(r(),h("span",_R,[n(M,{"popper-class":"fct-tooltip"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(Y,{name:"Crown",class:"fct-pro-icon",style:{"margin-left":"5px"}})]),_:1})]))],64))]),_:1},8,["label","class"])])]),_:1}),n(ya,{visible:((L=(O=e.variant)==null?void 0:O.other_info)==null?void 0:L.manage_setup_fee)=="yes",accordion:""},{default:d(()=>[n(V,{gutter:15,class:"fct-setup-fee-wrap px-[7.5px]"},{default:d(()=>[n(U,{lg:12},{default:d(()=>[o("div",vR,[n(B,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{title:A(u)("Setup fee label"),content:A(u)("Name the one-time setup fee (e.g., Initial Setup)")},null,8,["title","content"])]),default:d(()=>[n(Q,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee_name`)?"is-error":""),id:`${e.fieldKey}.other_info.signup_fee_name`,placeholder:A(u)("Setup fee name"),type:"text",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":S[18]||(S[18]=H=>e.variant.other_info.signup_fee_name=H),onInput:S[19]||(S[19]=H=>{e.productEditModel.updatePricingOtherValue("signup_fee_name",H,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee_name`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}),n(U,{lg:12},{default:d(()=>[o("div",gR,[n(B,{required:"",class:"has-tooltip-and-required"},{label:d(()=>[n(pa,{title:A(u)("Setup fee amount"),content:A(u)("Set the one-time setup fee amount (e.g., $50) per order. This fee does not apply to quantity.")},null,8,["title","content"])]),default:d(()=>[n(Za,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.other_info.signup_fee`)?"is-error":"",id:`${e.fieldKey}.other_info.signup_fee`,placeholder:A(u)("Setup fee amount"),"model-value":e.variant.other_info.signup_fee,"onUpdate:modelValue":S[20]||(S[20]=H=>{e.variant.other_info.signup_fee=H,e.productEditModel.updatePricingOtherValue("signup_fee",H,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.other_info.signup_fee`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["visible"])]}),_:1})):x("",!0),n(V,{gutter:15},{default:d(()=>[e.variant.manage_cost||e.isGroupMode?(r(),E(U,{key:0,lg:24,class:"fct-manage-cost-col"},{default:d(()=>[o("div",yR,[n(B,{label:e.isGroupMode?A(u)("Calculate profit/cost"):void 0,class:de(e.isGroupMode?"fct-group-select-label":"")},{default:d(()=>[e.isGroupMode?(r(),E(F,{key:0,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":S[21]||(S[21]=O=>e.variant.manage_cost=O),style:{width:"200px"},"popper-class":"fct-group-select-popper"},{default:d(()=>[n(D,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(D,{value:"true",label:A(u)("Enable")},null,8,["label"]),n(D,{value:"false",label:A(u)("Disable")},null,8,["label"])]),_:1},8,["modelValue"])):(r(),E($,{key:1,size:"small",modelValue:e.variant.manage_cost,"onUpdate:modelValue":S[22]||(S[22]=O=>e.variant.manage_cost=O),"active-value":"true","inactive-value":"false",onChange:S[23]||(S[23]=O=>{A(p)&&e.productEditModel.updatePricingValue("manage_cost",O,e.fieldKey,e.variant,e.modeType),Wf(p)?p.value=!0:p=!0}),"active-text":A(u)("Calculate profit/cost")},null,8,["modelValue","active-text"]))]),_:1},8,["label","class"])])]),_:1})):x("",!0),n(ya,{visible:e.variant.manage_cost==="true",accordion:""},{default:d(()=>[n(V,{gutter:15,class:"fct-cost-profit-wrap"},{default:d(()=>{var O,L,H;return[n(U,{lg:e.isGroupMode?24:((O=e.product.detail)==null?void 0:O.variation_type)==="simple_variations"?12:8},{default:d(()=>[o("div",bR,[n(B,null,{label:d(()=>[n(pa,{title:A(u)("Cost per item"),content:A(u)("Customers won't see this")},null,8,["title","content"])]),default:d(()=>[n(Za,{"error-class":e.productEditModel.hasValidationError(`${e.fieldKey}.item_cost`)?"is-error":"",id:`${e.fieldKey}.item_cost`,placeholder:e.isGroupMode?A(u)("Unchanged"):A(u)("Cost per item"),"model-value":e.variant.item_cost,"onUpdate:modelValue":S[24]||(S[24]=j=>{e.variant.item_cost=j,e.productEditModel.updatePricingValue("item_cost",j,e.fieldKey,e.variant,e.modeType)})},null,8,["error-class","id","placeholder","model-value"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.item_cost`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1},8,["lg"]),e.isGroupMode?x("",!0):(r(),E(U,{key:0,lg:((L=e.product.detail)==null?void 0:L.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",wR,[n(B,{label:A(u)("Profit")},{default:d(()=>[n(Q,{disabled:"",class:"fct-profit-display",value:A(Mm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"])),e.isGroupMode?x("",!0):(r(),E(U,{key:1,lg:((H=e.product.detail)==null?void 0:H.variation_type)==="simple_variations"?6:8},{default:d(()=>[o("div",CR,[n(B,{label:A(u)("Margin")},{default:d(()=>[n(Q,{disabled:"",class:"fct-margin-display",value:A(Lm)(e.variant)},null,8,["value"])]),_:1},8,["label"])])]),_:1},8,["lg"]))]}),_:1})]),_:1},8,["visible"]),n(U,{lg:24},{default:d(()=>[o("div",kR,[(e.variant.other_info,x("",!0))])]),_:1})]),_:1})])]),_:1},8,["modelValue"])]),_:1})}}},BR={class:"fct-adjust-by-wrap"},xR={class:"fct-adjust-by-row"},SR={class:"fct-adjust-by-col"},FR={class:"title"},$R={class:"fct-adjust-by-col"},ER={class:"title"},UR={class:"fct-adjust-by-action"},Gr={__name:"StockAdjuster",props:{variant:Object,fieldKey:String,productEditModel:Object},emits:["save"],setup(e,{expose:t,emit:a}){const l=a,s=T(!1);return t({toggle:()=>s.value=!s.value}),(i,c)=>{const p=C("el-input"),f=C("el-button"),_=C("el-popover");return r(),E(_,{visible:s.value,"popper-class":"fct-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{onClick:c[7]||(c[7]=g=>s.value=!s.value),class:"fct-stock-adjuster-trigger"},[n(Y,{name:"Configuration"})])]),default:d(()=>[o("div",BR,[o("div",xR,[o("div",SR,[o("span",FR,m(A(u)("Adjust by")),1),n(p,{size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:e.variant.adjusted_quantity,"onUpdate:modelValue":c[0]||(c[0]=g=>e.variant.adjusted_quantity=g),modelModifiers:{number:!0},onKeyup:c[1]||(c[1]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g.target.value,e.fieldKey,e.variant)}),onChange:c[2]||(c[2]=g=>{e.productEditModel.onChangeAdjustedQuantity("adjusted_quantity",g,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])]),o("div",$R,[o("span",ER,m(A(u)("New Stock")),1),n(p,{size:"small",placeholder:A(u)("New Stock"),type:"number",min:1,modelValue:e.variant.new_stock,"onUpdate:modelValue":c[3]||(c[3]=g=>e.variant.new_stock=g),modelModifiers:{number:!0},onKeyup:c[4]||(c[4]=g=>{e.productEditModel.onChangeNewStock("new_stock",g.target.value,e.fieldKey,e.variant)})},null,8,["placeholder","modelValue"])])]),o("div",UR,[n(f,{size:"small",type:"info",soft:"",onClick:c[5]||(c[5]=g=>s.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(f,{size:"small",type:"primary",onClick:c[6]||(c[6]=g=>{s.value=!1,l("save")}),disabled:e.variant.new_stock===""},{default:d(()=>[R(m(A(u)("Apply")),1)]),_:1},8,["disabled"])])])]),_:1},8,["visible"])}}},IR={class:"fct-shared-variant-item-box__switch"},QR={key:1,class:"fct-inline-select-wrap"},DR={key:0,class:"fct-variant-inventory-global-off",role:"alert"},VR={class:"fct-variant-inventory-global-off__text"},TR={class:"fct-variant-inventory-global-off__action"},MR={key:1,class:"fct-variant-stock-grid"},LR={class:"fct-variant-stock-box"},RR={class:"fct-stock-box-label"},OR={class:"fct-stock-box-content fct-stock-box-total-content"},PR={class:"fct-stock-number"},HR={class:"fct-variant-stock-box"},NR={class:"fct-stock-box-label"},KR={class:"fct-stock-box-content"},GR={class:"fct-stock-number"},zR={class:"fct-variant-stock-box"},jR={class:"fct-stock-box-label"},qR={class:"fct-stock-box-content"},YR={class:"fct-stock-number"},WR={class:"fct-variant-stock-box"},JR={class:"fct-stock-box-label"},XR={class:"fct-stock-box-content"},ZR={class:"fct-stock-number"},eO={key:2,class:"fct-admin-input-wrapper"},tO={key:0,class:"fct-collapse-heading"},aO={key:1,class:"fct-tag-group"},lO={class:"fct-tag-item"},sO={class:"fct-admin-input-wrapper"},nO={style:{display:"flex","justify-content":"space-between","align-items":"center",width:"100%"}},oO=["disabled"],uf={__name:"VariantInventory",props:{variant:Object,fieldKey:String,modeType:String,product:Object,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=T(!1),l=K(()=>t.variant.manage_stock=="1"||t.variant.manage_stock==1),s=K(()=>{var k,b,S,$;return((b=(k=t.product)==null?void 0:k.detail)==null?void 0:b.manage_stock)=="1"||(($=(S=t.product)==null?void 0:S.detail)==null?void 0:$.manage_stock)==1}),i=T(!1),c=T(!1),p=k=>{k&&f()},f=()=>{i.value||(i.value=!0,Ae.put(`products/${t.product.ID}/update-manage-stock`,{manage_stock:"1"}).then(k=>{t.product.detail.manage_stock="1",(t.product.variants||[]).forEach(b=>{b.manage_stock="1"}),t.variant.manage_stock="1",t.productEditModel.updatePricingValue("manage_stock","1",t.fieldKey,t.variant,t.modeType),q.success((k==null?void 0:k.message)||u("Inventory Management enabled"))}).catch(k=>{var b;c.value=!1,(k==null?void 0:k.status_code)=="422"?q.validationErrors(k):q.error(((b=k==null?void 0:k.data)==null?void 0:b.message)||u("Failed to update inventory"))}).finally(()=>{i.value=!1}))},_=K(()=>ze.get("modules_settings.stock_management.active")==="yes"),g=K(()=>{var k;return _.value?["simple_variations","advanced_variations"].includes((k=t.product.detail)==null?void 0:k.variation_type):!1}),y=k=>{t.productEditModel.updatePricingValue("manage_stock",k,t.fieldKey,t.variant,t.modeType)};Ie(()=>{t.variant.new_stock===void 0&&(t.variant.new_stock=t.variant.total_stock),t.variant.adjusted_quantity===void 0&&(t.variant.adjusted_quantity=0)});const v=()=>{let k=parseInt(t.variant.new_stock)||0;const b=t.variant.total_stock,S=t.variant.available;t.variant.total_stock=k<0?0:k;let $=(parseInt(t.variant.total_stock)||0)-(parseInt(t.variant.committed)||0)-(parseInt(t.variant.on_hold)||0);if(t.variant.available=$<0?0:$,t.variant.adjusted_quantity=0,t.variant.new_stock=t.variant.total_stock,!t.variant.id){t.productEditModel.updatePricingValue("total_stock",t.variant.total_stock,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingValue("available",t.variant.available,t.fieldKey,t.variant,t.modeType);return}Ae.put(`products/${t.product.ID}/update-inventory/${t.variant.id}`,{total_stock:t.variant.total_stock,available:t.variant.available}).then(D=>{q.success(D.message)}).catch(D=>{var F;t.variant.total_stock=b,t.variant.available=S,t.variant.new_stock=b,q.error(((F=D==null?void 0:D.data)==null?void 0:F.message)||u("Failed to update inventory"))})},w=()=>{var D;if(a.value)return;const k=t.product.post_title||"";if(!k)return;const S=["simple_variations","advanced_variations"].includes((D=t.product.detail)==null?void 0:D.variation_type)&&t.variant.variation_title||"",$=t.variant.id||0;a.value=!0,Ae.get("products/suggest-sku",{title:k,variant_title:S,exclude_id:$}).then(F=>{F!=null&&F.sku&&(t.variant.sku=F.sku,t.productEditModel.updatePricingValue("sku",F.sku,t.fieldKey,t.variant,t.modeType))}).catch(F=>{var U;const B=((U=F==null?void 0:F.data)==null?void 0:U.message)||u("Failed to generate SKU.");q.error(B)}).finally(()=>{a.value=!1})};return(k,b)=>{var U;const S=C("el-switch"),$=C("el-option"),D=C("el-select"),F=C("el-input"),B=C("el-form-item");return r(),E(zn,{class:de(["fct-variant-inventory",((U=e.product.detail)==null?void 0:U.variation_type)==="simple"?"fct-variant-inventory--simple":""])},oa({default:d(()=>[g.value&&!s.value?(r(),h("div",DR,[o("span",VR,[n(Y,{name:"Warning"}),R(" "+m(A(u)("Enable inventory to track stock and manage availability for this product and its variations.")),1)]),o("span",TR,[n(S,{size:"small",modelValue:c.value,"onUpdate:modelValue":b[2]||(b[2]=Q=>c.value=Q),loading:i.value,disabled:i.value,onChange:p},null,8,["modelValue","loading","disabled"])])])):x("",!0),l.value&&g.value&&!e.isGroupMode?(r(),h("div",MR,[o("div",LR,[o("div",RR,m(A(u)("Total Stock")),1),o("div",OR,[o("div",PR,m(e.variant.total_stock),1),n(Gr,{variant:e.variant,"field-key":e.fieldKey,"product-edit-model":e.productEditModel,onSave:v},null,8,["variant","field-key","product-edit-model"])])]),o("div",HR,[o("div",NR,m(A(u)("Available")),1),o("div",KR,[o("div",GR,m(e.variant.available),1)])]),o("div",zR,[o("div",jR,m(A(u)("On Hold")),1),o("div",qR,[o("div",YR,m(e.variant.on_hold),1)])]),o("div",WR,[o("div",JR,m(A(u)("Delivered")),1),o("div",XR,[o("div",ZR,m(e.variant.committed),1)])])])):x("",!0),l.value&&g.value&&e.isGroupMode?(r(),h("div",eO,[n(B,{label:A(u)("Total Stock")},{default:d(()=>[n(F,{type:"number",min:0,placeholder:A(u)("Unchanged"),modelValue:e.variant.total_stock,"onUpdate:modelValue":b[3]||(b[3]=Q=>e.variant.total_stock=Q)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])])):x("",!0),e.isGroupMode?x("",!0):(r(),E(lf,{key:3},{header:d(({isOpen:Q})=>[Q?(r(),h("div",tO,m(A(u)("More details")),1)):x("",!0),Q?x("",!0):(r(),h("div",aO,[o("div",lO,m(A(u)("SKU")),1)]))]),default:d(()=>[o("div",sO,[n(B,null,{label:d(()=>[o("div",nO,[n(pa,{title:A(u)("SKU (Stock Keeping Unit)"),placement:"bottom"},null,8,["title"]),o("button",{type:"button",onClick:w,disabled:!e.product.post_title||a.value,class:"underline-link-button fct-generate-sku-btn"},m(a.value?A(u)("Generating..."):A(u)("Generate SKU")),9,oO)])]),default:d(()=>[n(F,{class:de(e.productEditModel.hasValidationError(`${e.fieldKey}.sku`)?"is-error":""),id:`${e.fieldKey}.sku`,placeholder:A(u)("SKU"),type:"text",modelValue:e.variant.sku,"onUpdate:modelValue":b[4]||(b[4]=Q=>e.variant.sku=Q),maxlength:"30","show-word-limit":"",onInput:b[5]||(b[5]=Q=>{e.productEditModel.updatePricingValue("sku",Q,e.fieldKey,e.variant,e.modeType)})},null,8,["class","id","placeholder","modelValue"]),n(Aa,{"validation-errors":e.productEditModel.validationErrors,"field-key":`${e.fieldKey}.sku`},null,8,["validation-errors","field-key"])]),_:1})])]),_:1}))]),_:2},[g.value?{name:"label",fn:d(()=>[R(m(A(u)("Inventory")),1)]),key:"0"}:void 0,g.value&&s.value?{name:"action",fn:d(()=>[o("div",IR,[e.isGroupMode?(r(),h("div",QR,[o("label",null,m(A(u)("Manage Stock"))+":",1),n(D,{size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":b[1]||(b[1]=Q=>e.variant.manage_stock=Q),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n($,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n($,{value:"1",label:A(u)("Manage stock")},null,8,["label"]),n($,{value:"0",label:A(u)("Don't manage")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),E(S,{key:0,size:"small",modelValue:e.variant.manage_stock,"onUpdate:modelValue":b[0]||(b[0]=Q=>e.variant.manage_stock=Q),onChange:y,"active-value":"1","inactive-value":"0"},null,8,["modelValue"]))])]),key:"1"}:void 0]),1032,["class"])}}},iO={class:"fct-shared-variant-item-box__switch"},rO={class:"fct-shared-variant-item-box__hint"},dO={key:1,class:"fct-inline-select-wrap"},uO={key:0,class:"fct-package-select-icon"},cO={class:"fct-add-new-package-option"},AO={class:"fct-package-options"},pO={class:"fct-package-options-info"},fO={class:"fct-package-options-name"},mO={class:"fct-package-options-dimensions"},hO={class:"fct-product-weight-input"},cf={__name:"ProductShipping",props:{variant:Object,fieldKey:String,modeType:String,productEditModel:Object,isGroupMode:{type:Boolean,default:!1}},setup(e){var k,b;const t=e,a=T(!1),l=T(!1),s=T(ze.get("shop.shipping_packages")||[]),i=[{label:"kg",value:"kg"},{label:"g",value:"g"},{label:"lbs",value:"lbs"},{label:"oz",value:"oz"}],c={box:"Box",envelope:"Envelope",soft_package:"SoftPackage"},p=K(()=>{var $,D;const S=(D=($=t.variant)==null?void 0:$.other_info)==null?void 0:D.package_slug;return S?s.value.find(F=>F.slug===S)||null:s.value.find(F=>F.is_default)||null}),f=S=>{if(!S)return u("Select a package");const $=S.type==="envelope"?S.length+" × "+S.width+" "+S.dimension_unit:S.length+" × "+S.width+" × "+S.height+" "+S.dimension_unit;return(S.is_default?u("Store default")+" · ":"")+S.name+" - "+$+", "+S.weight+" "+S.weight_unit},_=()=>Ae.get("shipping/packages").then(S=>{s.value=S.packages||s.value}).catch(()=>{Gd({message:u("Failed to load packages."),type:"error"})}),g=T(((b=(k=t.variant)==null?void 0:k.other_info)==null?void 0:b.package_slug)||""),y=async S=>{if(S==="__add_new__"){t.variant.other_info.package_slug=g.value,await _(),a.value=!0;return}g.value=S||"",t.productEditModel.updatePricingOtherValue("package_slug",S,t.fieldKey,t.variant,t.modeType)},v=S=>{t.productEditModel.updatePricingOtherValue("weight_unit",S,t.fieldKey,t.variant,t.modeType)},w=S=>{const $=JSON.parse(JSON.stringify(s.value));S.is_default&&s.value.forEach(B=>{B.is_default=!1});let D=S.slug,F=1;for(;s.value.some(B=>B.slug===D);)D=S.slug+"-"+F,F++;S.slug=D,s.value.push(S),l.value=!0,Ae.post("shipping/packages",{packages:s.value}).then(B=>{s.value=B.packages||s.value,a.value=!1,y(S.slug)}).catch(()=>{s.value=$,Gd({message:u("Failed to save package."),type:"error"})}).finally(()=>{l.value=!1})};return(S,$)=>{const D=C("el-switch"),F=C("el-option"),B=C("el-select"),U=C("el-form-item"),Q=C("el-col"),V=C("el-input"),I=C("el-row");return r(),h(P,null,[e.variant.other_info?(r(),E(zn,{key:0},{label:d(()=>[R(m(A(u)("Shipping")),1)]),action:d(()=>[o("div",iO,[e.isGroupMode?(r(),h("div",dO,[o("label",null,m(A(u)("Fulfillment Type"))+":",1),n(B,{size:"small",modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[2]||($[2]=M=>e.variant.fulfillment_type=M),"popper-class":"fct-group-select-popper",class:"fct-inline-select",placement:"bottom"},{default:d(()=>[n(F,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(F,{value:"physical",label:A(u)("Physical")},null,8,["label"]),n(F,{value:"digital",label:A(u)("Digital")},null,8,["label"])]),_:1},8,["modelValue"])])):(r(),h(P,{key:0},[o("span",rO,m(A(u)("Physical Product")),1),n(D,{modelValue:e.variant.fulfillment_type,"onUpdate:modelValue":$[0]||($[0]=M=>e.variant.fulfillment_type=M),"active-value":"physical","inactive-value":"digital",onChange:$[1]||($[1]=M=>{e.productEditModel.updatePricingValue("fulfillment_type",M,e.fieldKey,e.variant,e.modeType)}),size:"small"},null,8,["modelValue"])],64))])]),default:d(()=>[n(ya,{visible:e.variant.fulfillment_type==="physical",accordion:""},{default:d(()=>[n(I,{gutter:10,class:"fct-physical-product-meta-row"},{default:d(()=>[n(Q,{xs:24,sm:14,lg:14},{default:d(()=>[n(U,null,{label:d(()=>[R(m(A(u)("Package")),1)]),default:d(()=>[n(B,{modelValue:e.variant.other_info.package_slug,"onUpdate:modelValue":$[3]||($[3]=M=>e.variant.other_info.package_slug=M),placeholder:A(u)("Select a package"),onChange:y,class:"fct-package-options-select",clearable:""},{prefix:d(()=>[p.value?(r(),h("span",uO,[n(Y,{name:c[p.value.type]||"Box"},null,8,["name"])])):x("",!0)]),default:d(()=>[n(F,{value:"__add_new__",label:A(u)("Add new package")},{default:d(()=>[o("div",cO," + "+m(A(u)("Add new package")),1)]),_:1},8,["label"]),(r(!0),h(P,null,te(s.value,M=>(r(),E(F,{key:M.slug,label:f(M),value:M.slug},{default:d(()=>[o("div",AO,[n(Y,{name:c[M.type]||"Box"},null,8,["name"]),o("div",pO,[o("span",fO,m(M.is_default?A(u)("Store default")+" · ":"")+m(M.name),1),o("span",mO,m(M.type==="envelope"?M.length+" × "+M.width:M.length+" × "+M.width+" × "+M.height)+" "+m(M.dimension_unit)+", "+m(M.weight)+" "+m(M.weight_unit),1)])])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1})]),_:1}),n(Q,{xs:24,sm:10,lg:10},{default:d(()=>[n(U,null,{label:d(()=>[R(m(A(u)("Product weight")),1)]),default:d(()=>[o("div",hO,[n(V,{modelValue:e.variant.other_info.weight,"onUpdate:modelValue":$[5]||($[5]=M=>e.variant.other_info.weight=M),type:"number",min:0,step:"0.0001",placeholder:"0.0",inputmode:"decimal",onInput:$[6]||($[6]=M=>{e.productEditModel.updatePricingOtherValue("weight",M,e.fieldKey,e.variant,e.modeType)}),class:"fct-product-weight-number"},{append:d(()=>[n(B,{modelValue:e.variant.other_info.weight_unit,"onUpdate:modelValue":$[4]||($[4]=M=>e.variant.other_info.weight_unit=M),onChange:v,class:"fct-product-weight-unit"},{default:d(()=>[(r(),h(P,null,te(i,M=>n(F,{key:M.value,label:M.label,value:M.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1},8,["visible"])]),_:1})):x("",!0),n(Cm,{modelValue:a.value,"onUpdate:modelValue":$[7]||($[7]=M=>a.value=M),saving:l.value,onSave:w},null,8,["modelValue","saving"])],64)}}},_O={key:0,class:"fct-tax-class-control"},vO={class:"fct-inline-select-wrap"},gO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},yO=["title"],bO={key:1,class:"fct-tax-class-control"},wO={key:0,class:"fct-tax-class-control__class-row text-sm text-system-mid dark:text-gray-300"},CO=["title"],Af={__name:"VariationTaxClass",props:{variant:Object,productEditModel:Object,fieldKey:String,modeType:String,isGroupMode:{type:Boolean,default:!1}},setup(e){const t=e,a=T([]),l=S=>{if(!S)return"standard";const $=a.value.find(F=>String(F.slug)===String(S));if($)return $.slug;const D=a.value.find(F=>String(F.id)===String(S));return D?D.slug:S},s=K(()=>dt.get(t.variant,"other_info.tax_exempt","no")),i=K(()=>{const S=dt.get(t.variant,"other_info.tax_class","standard");return l(S)||"standard"}),c=T(s.value!=="yes"),p=T(i.value||"standard");be([s,i,a],([S,$])=>{c.value=S!=="yes",p.value=$||"standard"});const f=()=>{t.variant.other_info||(t.variant.other_info={})},_=(S,$)=>{f(),t.variant.other_info.tax_exempt=S,t.variant.other_info.tax_class=$||"standard",t.productEditModel&&t.fieldKey&&(t.productEditModel.updatePricingOtherValue("tax_exempt",t.variant.other_info.tax_exempt,t.fieldKey,t.variant,t.modeType),t.productEditModel.updatePricingOtherValue("tax_class",t.variant.other_info.tax_class,t.fieldKey,t.variant,t.modeType))},g=()=>{Ae.get("tax/classes").then(S=>{a.value=S.classes||[]}).catch(()=>{q.error(u("Failed to load tax classes"))})},y=S=>{const $=p.value||i.value||"standard";c.value=S,p.value=$,_(S?"no":"yes",$)},v=S=>{p.value=S,c.value=!0,_("no",S)},w=()=>{const S=a.value.find($=>$.slug===p.value);return S?S.title:"Standard"},k=()=>{var D,F;const S=(F=(D=t.variant)==null?void 0:D.other_info)==null?void 0:F.tax_class;if(!S)return u("Unchanged");const $=a.value.find(B=>B.slug===S);return $?$.title:S},b=S=>{t.variant.other_info&&(t.variant.other_info.tax_class=S)};return Ie(()=>{g()}),(S,$)=>{const D=C("el-option"),F=C("el-select"),B=C("el-dropdown-item"),U=C("el-dropdown-menu"),Q=C("el-dropdown"),V=C("el-checkbox");return r(),E(zn,null,{label:d(()=>[R(m(A(u)("Tax")),1)]),default:d(()=>[e.isGroupMode?(r(),h("div",_O,[o("div",vO,[o("label",null,m(A(u)("Tax Exemption"))+":",1),n(F,{modelValue:e.variant.other_info.tax_exempt,"onUpdate:modelValue":$[0]||($[0]=I=>e.variant.other_info.tax_exempt=I),size:"small",class:"fct-inline-select",placement:"bottom","popper-class":"fct-group-select-popper"},{default:d(()=>[n(D,{value:"__unchanged__",label:A(u)("Unchanged")},null,8,["label"]),n(D,{value:"no",label:A(u)("Charge tax")},null,8,["label"]),n(D,{value:"yes",label:A(u)("Tax exempt")},null,8,["label"])]),_:1},8,["modelValue"])]),e.variant.other_info.tax_exempt==="no"&&a.value.length>=1?(r(),h("div",gO,[o("span",null,[R(m(A(u)("Class:"))+" ",1),o("strong",{class:de(e.variant.other_info.tax_class&&e.variant.other_info.tax_class!=="standard"?"text-red-500 dark:text-red-400":"")},m(k()),3)]),a.value.length>1?(r(),E(Q,{key:0,trigger:"click",onCommand:b},{dropdown:d(()=>[n(U,null,{default:d(()=>[n(B,{command:null,class:de({"is-active":!e.variant.other_info.tax_class})},{default:d(()=>[R(m(A(u)("Unchanged")),1)]),_:1},8,["class"]),(r(!0),h(P,null,te(a.value,I=>(r(),E(B,{key:I.slug,command:I.slug,class:de({"is-active":e.variant.other_info.tax_class===I.slug})},{default:d(()=>[R(m(I.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:A(u)("Change tax class")},$[2]||($[2]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,yO)]),_:1})):x("",!0)])):x("",!0)])):(r(),h("div",bO,[n(V,{class:"fct-tax-class-control__checkbox",modelValue:c.value,"onUpdate:modelValue":$[1]||($[1]=I=>c.value=I),onChange:y},{default:d(()=>[R(m(A(u)("Charge tax on this variation")),1)]),_:1},8,["modelValue"]),c.value&&a.value.length>=1?(r(),h("div",wO,[o("span",null,[R(m(A(u)("Class:"))+" ",1),o("strong",{class:de(p.value!=="standard"?"text-red-500 dark:text-red-400":"")},m(w()),3)]),a.value.length>1?(r(),E(Q,{key:0,trigger:"click",onCommand:v},{dropdown:d(()=>[n(U,null,{default:d(()=>[(r(!0),h(P,null,te(a.value,I=>(r(),E(B,{key:I.slug,command:I.slug,class:de({"is-active":p.value===I.slug})},{default:d(()=>[R(m(I.title),1)]),_:2},1032,["command","class"]))),128))]),_:1})]),default:d(()=>[o("span",{class:"fct-tax-class-control__edit text-system-light hover:text-system-dark dark:text-gray-400 dark:hover:text-gray-50",title:A(u)("Change tax class")},$[3]||($[3]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",width:"14",height:"14"},[o("path",{d:"M13.488 2.513a1.75 1.75 0 0 0-2.475 0L3.22 10.303a.75.75 0 0 0-.178.31l-.893 3.125a.75.75 0 0 0 .926.926l3.125-.893a.75.75 0 0 0 .31-.178l7.79-7.79a1.75 1.75 0 0 0 0-2.475l-.812-.815ZM12.074 3.574a.25.25 0 0 1 .354 0l.812.812a.25.25 0 0 1 0 .354L5.45 12.529l-1.838.526.525-1.838 7.937-7.643Z"})],-1)]),8,CO)]),_:1})):x("",!0)])):x("",!0)]))]),_:1})}}},kO={class:"fct-product-pricing-form-wrap"},BO={class:"fct-product-pricing-form-inner"},xO={key:0,class:"dialog-footer"},SO={class:"fct-btn-group sm"},Vd={__name:"ProductPricingForm",props:{modeType:String,index:Number,fieldKey:String,product:Object,productEditModel:Object,variantTitleInfo:Object},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,s=T({}),i=a,c=bs(),p=T(0),f=T(!1),_=T({}),g=T(null),y=T(!1),v=L=>L?JSON.parse(JSON.stringify(L)):{},w=(L=l.modeType,H=l.index)=>{var W,G,Z;if(L==="create")return"create";if(L==="duplicate"){const ne=(W=l.product.variants)==null?void 0:W[H];return`duplicate-${(ne==null?void 0:ne.id)??H??"draft"}`}if(((G=l.product.detail)==null?void 0:G.variation_type)==="simple")return"simple-0";const j=(Z=l.product.variants)==null?void 0:Z[H];return`update-${(j==null?void 0:j.id)??H??"draft"}`},k=(L=l.modeType,H=l.index,j=s.value)=>({modeType:L,index:H,variant:v(j)}),b=()=>{if(y.value){y.value=!1;return}!g.value||f.value||!p.value||(_.value[g.value]=k())},S=()=>{var L;(L=s.value)!=null&&L.other_info&&(s.value.other_info.payment_type||(s.value.other_info.payment_type="onetime"),s.value.other_info.weight_unit||(s.value.other_info.weight_unit=B.value),s.value.other_info.package_slug===void 0&&(s.value.other_info.package_slug=""))},$=async()=>{var H,j,W,G;b(),f.value=!0,p.value=0,g.value=w();const L=(H=_.value[g.value])==null?void 0:H.variant;if(L){s.value=v(L),S(),await xe(),p.value=1,f.value=!1;return}((j=l.product.detail)==null?void 0:j.variation_type)==="simple"?Array.isArray(l.product.variants)&&l.product.variants.length===0?(s.value=l.productEditModel.addDummyVariant(),s.value.variation_title=l.product.post_title):s.value=l.product.variants[0]:l.modeType==="create"?s.value=l.productEditModel.addDummyVariant():l.modeType==="update"?s.value=v((W=l.product.variants)==null?void 0:W[l.index]):l.modeType==="duplicate"?(s.value=v((G=l.product.variants)==null?void 0:G[l.index]),s.value.serial_index=l.productEditModel.variantsLength()+1,s.value.variation_title=`${u("Copy of")} ${s.value.variation_title||""}`.trim(),s.value.sku="",s.value.on_hold=0,s.value.committed=0,s.value.available=s.value.total_stock??0,delete s.value.id):s.value={},S(),await xe(),p.value=0,f.value=!1},D=async()=>{var L;try{let H=l.index;const j=v(s.value);l.modeType==="duplicate"&&(H=l.productEditModel.variantsLength(),j.rowId=(j.rowId??0)+1);let W=await l.productEditModel.createOrUpdatePricing(j);return(L=W==null?void 0:W.data)!=null&&L.id?(j.id=W.data.id,l.productEditModel.afterCreatingOrUpdatingPricing(H,j),H==null&&(H=l.product.variants.findIndex(G=>(G==null?void 0:G.id)===j.id),H===-1&&(H=l.product.variants.length-1)),g.value&&delete _.value[g.value],p.value=0,i("createOrUpdateVariant",{index:H,modeType:l.modeType,variant:v(j)}),{index:H,modeType:l.modeType,variant:v(j)}):null}catch{return null}},F=async()=>D(),B=K(()=>ze.get("shop.weight_unit")||"kg"),U=()=>{const L={..._.value};return g.value&&p.value&&(L[g.value]=k()),Object.entries(L)},Q=()=>U().length>0,V=()=>U().length,I=K(()=>U().length),M=async()=>{y.value=!0,_.value={},p.value=0,l.productEditModel.setValidationErrors({}),await $()};return be(s,()=>{f.value||p.value++},{deep:!0}),be(()=>[l.modeType,l.index],()=>{$()},{immediate:!0}),be(I,L=>{i("dirtyStateChange",!!L)},{immediate:!0}),c.bind(["mod+s"],L=>{var H,j;((j=(H=l.product)==null?void 0:H.detail)==null?void 0:j.variation_type)!=="simple"&&(L.preventDefault(),p.value&&F())}),Bt(()=>{c.unbind("mod+s")}),t({hasDirtyDrafts:Q,getDirtyDraftCount:V,discardDrafts:M,saveCurrentDraft:D,loadVariantFromProps:$,getVariantData:()=>v(s.value)}),(L,H)=>{const j=C("el-form"),W=C("el-button");return r(),h("div",kO,[o("div",BO,[n(j,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(OL,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel,"title-info":e.variantTitleInfo},null,8,["variant","field-key","mode-type","product","product-edit-model","title-info"]),n(df,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),n(uf,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,product:e.product,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product","product-edit-model"]),n(cf,{variant:s.value,"field-key":l.fieldKey,"mode-type":e.modeType,"product-edit-model":e.productEditModel},null,8,["variant","field-key","mode-type","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(Af,{key:0,variant:s.value,"product-edit-model":e.productEditModel,"field-key":l.fieldKey,"mode-type":e.modeType},null,8,["variant","product-edit-model","field-key","mode-type"])):x("",!0)]),_:1})]),e.modeType!=="add"?(r(),h("div",xO,[o("div",SO,[I.value?(r(),E(W,{key:0,onClick:M},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1})):x("",!0),n(W,{onClick:H[0]||(H[0]=()=>{i("closeModal")})},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(W,{disabled:e.productEditModel.saving||e.modeType==="update"&&!I.value,onClick:F,type:"primary",loading:e.productEditModel.saving},{default:d(()=>[R(m(typeof s.value.id>"u"?A(u)("Save"):A(u)("Update")),1)]),_:1},8,["disabled","loading"])])])):x("",!0)])}}},FO={class:"fct-product-button-and-drawer-wrap"},$O={key:0,class:"fct-product-add-more-price-wrap text-right pr-6"},EO={key:1,class:"fct-btn-group sm"},UO={class:"more-btn"},nr={__name:"ProductPricingActions",props:{modeType:String,index:Number,variant:{type:Object,default:{}},product:Object,productEditModel:Object},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t;let s=T(null);const i=T(1),c=(v="update")=>{l("open-editor",{modeType:v,index:a.index??null})},p=K(()=>{var v;return{product:a.product,variant:a.variant,index:a.index,productEditModel:a.productEditModel,openPricingModal:w=>{c(w)},vueContext:(v=Jt())==null?void 0:v.ctx}}),f=T([]),_=()=>{var b,S;const v=((b=window==null?void 0:window.fluent_cart_admin)==null?void 0:b.hooks)||(window==null?void 0:window.fluentCartAdminHooks),w=[],k=(S=v==null?void 0:v.applyFilters)==null?void 0:S.call(v,"fluent_cart_product_pricing_actions_dropdown_items",w,p.value);f.value=Array.isArray(k)?k:w},g=v=>v?typeof v.disabled=="function"?!!v.disabled(p.value):!!v.disabled:!1;Ie(()=>{s.value=a.index,_(),setTimeout(_,0)});const y=v=>{var w,k;if(v&&typeof v=="object"){if(typeof v.onClick=="function")return v.onClick(p.value);if(v.command){const b=((w=window==null?void 0:window.fluent_cart_admin)==null?void 0:w.hooks)||(window==null?void 0:window.fluentCartAdminHooks);return(k=b==null?void 0:b.doAction)==null?void 0:k.call(b,"fluent_cart_product_pricing_actions_dropdown_command",v.command,p.value,v)}}v==="duplicate_pricing"?c("duplicate"):v==="delete_variant"&&a.productEditModel.deletePricing(a.variant.id,a.index)};return(v,w)=>{const k=C("el-button"),b=C("el-checkbox"),S=C("el-dropdown-item"),$=C("el-dropdown-menu"),D=C("el-dropdown");return r(),h("div",FO,[a.modeType=="add"?(r(),h("div",$O,[e.product.detail.variation_type!=="simple"?(r(),E(k,{key:0,text:"",type:"primary",onClick:w[0]||(w[0]=F=>c("create"))},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(e.product.variants.length>0?v.$t("Add more"):v.$t("Add Pricing")),1)]),_:1})):x("",!0)])):x("",!0),a.modeType=="action"?(r(),h("div",EO,[n(at,{class:"hide-on-mobile",size:"small",tag:"button",onClick:w[1]||(w[1]=F=>c("update"))},{default:d(()=>[n(Y,{name:"Edit"})]),_:1}),n(D,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y,trigger:"click",onVisibleChange:w[5]||(w[5]=F=>{F&&_()})},{dropdown:d(()=>[n($,null,{default:d(()=>[e.product.detail&&e.product.detail.manage_stock=="1"?(r(),E(S,{key:0,class:"item-checkbox"},{default:d(()=>[n(b,{modelValue:e.variant.manage_stock,"onUpdate:modelValue":w[2]||(w[2]=F=>e.variant.manage_stock=F),onChange:w[3]||(w[3]=F=>{e.productEditModel.onChangePricing("manage_stock",A(s),F)}),"true-value":"0","false-value":"1"},{default:d(()=>[R(m(v.$t("Skip inventory")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0),n(S,{class:"show-on-mobile",onClick:w[4]||(w[4]=F=>c("update"))},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(v.$t("Edit")),1)]),_:1}),e.product.detail&&e.product.detail.variation_type!=="simple"?(r(),E(S,{key:1,command:"duplicate_pricing"},{default:d(()=>[n(Y,{name:"Duplicate"}),R(" "+m(v.$t("Duplicate")),1)]),_:1})):x("",!0),n(S,null,{default:d(()=>[e.variant.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:String(e.variant.id),showMode:"icon_with_text",buttonText:v.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:1}),n(S,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"&&e.variant.id!=""},{default:d(()=>{var F;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&e.variant.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:((F=v.appVars)==null?void 0:F.frontend_url)+"=instant_checkout&item_id="+e.variant.id+"&quantity=1",showMode:"icon_with_text",buttonText:v.$t("Direct Checkout"),tooltipContent:v.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[n(Y,{name:"Copy"}),R(" "+m(v.$t("Direct Checkout"))+" ",1),n(pa,{content:v.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:1},8,["disabled"]),(r(!0),h(P,null,te(f.value,(F,B)=>(r(),E(S,{key:"js_item_"+B,command:F,class:de(F==null?void 0:F.class),divided:!!(F!=null&&F.divided),disabled:g(F)},{default:d(()=>[F!=null&&F.icon?(r(),E(Y,{key:0,name:F.icon},null,8,["name"])):x("",!0),R(" "+m(F==null?void 0:F.label),1)]),_:2},1032,["command","class","divided","disabled"]))),128)),e.productEditModel.variantsLength()>i.value?(r(),E(S,{key:2,command:"delete_variant",class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(v.$t("Delete")),1)]),_:1})):x("",!0)]),_:1})]),default:d(()=>[o("span",UO,[n(Y,{name:"More"})])]),_:1})])):x("",!0)])}}},IO={class:"fct-variant-pricing-add-button-wrap"},QO={__name:"VariantPricingAddButton",props:{product:Object,drawerMode:String,isVariationDirty:Boolean},emits:["open-editor"],setup(e,{emit:t}){const a=e,l=t,s=()=>{l("open-editor",{modeType:"create"})},i=()=>a.drawerMode==="create"||a.isVariationDirty;return(c,p)=>{var _;const f=C("el-button");return r(),h("div",IO,[((_=e.product.detail)==null?void 0:_.variation_type)!=="simple"?(r(),E(f,{key:0,text:"",type:"primary",disabled:i(),onClick:s,size:"small"},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(e.product.variants.length>0?c.$t("Add more"):c.$t("Add Pricing")),1)]),_:1},8,["disabled"])):x("",!0)])}}},DO={class:"fct-shared-variant-nav__summary"},VO={class:"fct-shared-variant-nav__summary-product"},TO={class:"fct-shared-variant-nav__summary-product-name"},MO={class:"fct-shared-variant-nav__summary-meta"},LO={class:"fct-shared-variant-nav__status"},RO={class:"fct-shared-variant-nav__variant-count"},zr={__name:"VariantNavSummary",props:{product:Object},setup(e){return(t,a)=>(r(),h("div",DO,[o("div",VO,[o("h3",TO,m(e.product.post_title||A(u)("Untitled product")),1)]),o("div",MO,[o("span",LO,[n(fa,{status:e.product.post_status||"draft"},null,8,["status"])]),o("span",RO,m(e.product.variants.length)+" "+m(A(u)("variants")),1)])]))}},OO={class:"fct-shared-variant-nav__group-header"},PO=["aria-expanded","onClick"],HO={class:"fct-shared-variant-nav__group-caret"},NO={class:"fct-shared-variant-nav__group-title"},KO={class:"fct-shared-variant-nav__group-count"},GO=["aria-label","onClick"],zO={class:"fct-shared-variant-nav__group-body"},jO=["disabled","aria-current","onClick"],qO={class:"fct-shared-variant-nav__item-image-wrapper"},YO={class:"fct-shared-variant-nav__item-image"},WO=["src","alt"],JO=["src","alt"],XO={key:0,class:"fct-shared-variant-nav__item-dot"},ZO={class:"fct-shared-variant-nav__item-content"},eP={class:"fct-shared-variant-nav__item-title"},tP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},aP={class:"fct-shared-variant-nav__item-meta"},lP=["disabled","aria-label"],sP=["disabled","aria-label"],nP={class:"more-btn"},oP=["disabled","aria-current","onClick"],iP={class:"fct-shared-variant-nav__item-image-wrapper"},rP={class:"fct-shared-variant-nav__item-image"},dP=["src","alt"],uP=["src","alt"],cP={key:0,class:"fct-shared-variant-nav__item-dot"},AP={class:"fct-shared-variant-nav__item-content"},pP={class:"fct-shared-variant-nav__item-title"},fP={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},mP={class:"fct-shared-variant-nav__item-meta"},hP=["disabled","aria-label"],_P=["disabled","aria-label"],vP={class:"more-btn"},pf={__name:"VariantNavList",props:{items:Array,groupedItems:{type:Array,default:null},activeKey:[String,Number],isDirty:Boolean,isSaving:Boolean,drawerMode:String,product:Object,productEditModel:Object,canCopyDirectCheckout:Function},emits:["select","command","save","edit-group"],setup(e,{emit:t}){const a=()=>gs.getUrl("images/placeholder.svg"),l=e,s=k=>{const b=l.isDirty&&l.activeKey!==k.key,S=l.drawerMode==="create"&&k.key!=="draft-variation";return b||S},i=t,c=K(()=>Array.isArray(l.groupedItems)&&l.groupedItems.length>0),p=T(null),f=(k,b)=>{for(const S of k||[])if((S.items||[]).some($=>$.key===b))return String(S.termId);return null};be(()=>l.groupedItems,k=>{if(!Array.isArray(k)||!k.length){p.value=null;return}p.value=f(k,l.activeKey)||String(k[0].termId)},{immediate:!0}),be(()=>l.activeKey,k=>{if(!c.value||k==null)return;const b=f(l.groupedItems,k);b&&(p.value=b)});const _=k=>String(k.termId)===p.value,g=k=>{const b=String(k.termId);p.value=p.value===b?null:b},y=T(null);let v=null;const w=()=>{v&&clearTimeout(v),xe(()=>{v=setTimeout(()=>{var b;v=null;const k=(b=y.value)==null?void 0:b.querySelector(".fct-shared-variant-nav__item-shell.is-active");k&&k.scrollIntoView({block:"center"})},240)})};return Ie(w),be(()=>l.activeKey,()=>w()),cl(()=>{v&&clearTimeout(v)}),(k,b)=>{const S=C("el-dropdown-item"),$=C("el-dropdown-menu"),D=C("el-dropdown");return r(),h("div",{ref_key:"listRef",ref:y,class:"fct-shared-variant-nav__list"},[c.value?(r(!0),h(P,{key:0},te(e.groupedItems,F=>(r(),h("div",{key:"g-"+F.termId,class:de(["fct-shared-variant-nav__group",{"is-collapsed":!_(F)}])},[o("div",OO,[o("button",{type:"button",class:"fct-shared-variant-nav__group-toggle","aria-expanded":_(F)?"true":"false",onClick:B=>g(F)},[o("span",HO,[n(Y,{name:_(F)?"CaretDown":"CaretRight"},null,8,["name"])]),o("span",NO,m(F.title),1),o("span",KO,m(A(u)("%1$s variants",F.count)),1)],8,PO),o("button",{type:"button",class:"fct-shared-variant-nav__group-edit","aria-label":A(u)("Edit group"),onClick:Ge(B=>i("edit-group",F),["stop"])},[n(Y,{name:"Edit"})],8,GO)]),n(ya,{visible:_(F),accordion:"",duration:220},{default:d(()=>[o("div",zO,[(r(!0),h(P,null,te(F.items,B=>{var U,Q,V,I,M,O,L,H;return r(),h("div",{key:B.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===B.key,"is-draft":B.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(B)}]),disabled:s(B),"aria-current":e.activeKey===B.key?"true":void 0,onClick:j=>!s(B)&&i("select",B)},[o("div",qO,[o("div",YO,[(V=(Q=(U=B.variant)==null?void 0:U.media)==null?void 0:Q[0])!=null&&V.url?(r(),h("img",{key:0,src:(O=(M=(I=B.variant)==null?void 0:I.media)==null?void 0:M[0])==null?void 0:O.url,alt:B.label},null,8,WO)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:B.label},null,8,JO))]),e.activeKey===B.key?(r(),h("span",XO)):x("",!0)]),o("div",ZO,[o("span",eP,[R(m(B.label)+" ",1),((L=B.variant)==null?void 0:L.item_status)==="inactive"&&((H=e.product.detail)==null?void 0:H.variation_type)==="advanced_variations"?(r(),h("span",tP,m(A(u)("Inactive")),1)):x("",!0)]),o("span",aP,m(B.meta),1)])],10,jO),e.isDirty&&e.activeKey===B.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[0]||(b[0]=j=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),E(Y,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(Y,{key:0,name:"Save"}))],10,lP)):x("",!0),B.isDraft?x("",!0):(r(),E(D,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(B),onCommand:j=>!s(B)&&i("command",j,B)},{dropdown:d(()=>[n($,null,{default:d(()=>{var j,W,G,Z,ne;return[["simple","advanced_variations"].includes((j=e.product.detail)==null?void 0:j.variation_type)?x("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:d(()=>[n(Y,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:d(()=>[n(Y,{name:"Copy"}),R(" "+m(A(u)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(B)},{default:d(()=>[n(Y,{name:"Copy"}),R(" "+m(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(W=B.variant)!=null&&W.id&&((G=e.product.detail)==null?void 0:G.variation_type)==="advanced_variations"?(r(),E(S,{key:1,command:"toggle_status",class:de({"item-destructive":((Z=B.variant)==null?void 0:Z.item_status)!=="inactive"})},{default:d(()=>{var ce,z;return[n(Y,{name:((ce=B.variant)==null?void 0:ce.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(((z=B.variant)==null?void 0:z.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):x("",!0),((ne=e.product.detail)==null?void 0:ne.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(B)}]),disabled:s(B),onClick:b[1]||(b[1]=Ge(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",nP,[n(Y,{name:"More"})])],10,sP)]),_:2},1032,["disabled","onCommand"]))],2)}),128))])]),_:2},1032,["visible"])],2))),128)):(r(!0),h(P,{key:1},te(e.items,F=>{var B,U,Q,V,I,M,O,L;return r(),h("div",{key:F.key,class:de(["fct-shared-variant-nav__item-shell",{"is-active":e.activeKey===F.key,"is-draft":F.isDraft}])},[o("button",{type:"button",class:de(["fct-shared-variant-nav__item",{"is-disabled":s(F)}]),disabled:s(F),"aria-current":e.activeKey===F.key?"true":void 0,onClick:H=>!s(F)&&i("select",F)},[o("div",iP,[o("div",rP,[(Q=(U=(B=F.variant)==null?void 0:B.media)==null?void 0:U[0])!=null&&Q.url?(r(),h("img",{key:0,src:(M=(I=(V=F.variant)==null?void 0:V.media)==null?void 0:I[0])==null?void 0:M.url,alt:F.label},null,8,dP)):(r(),h("img",{key:1,class:"fct-shared-variant-placeholder",src:a(),alt:F.label},null,8,uP))]),e.activeKey===F.key?(r(),h("span",cP)):x("",!0)]),o("div",AP,[o("span",pP,[R(m(F.label)+" ",1),((O=F.variant)==null?void 0:O.item_status)==="inactive"&&((L=e.product.detail)==null?void 0:L.variation_type)==="advanced_variations"?(r(),h("span",fP,m(A(u)("Inactive")),1)):x("",!0)]),o("span",mP,m(F.meta),1)])],10,oP),e.isDirty&&e.activeKey===F.key?(r(),h("button",{key:0,type:"button",class:de(["fct-shared-variant-check-icon",{"is-saving":e.isSaving}]),disabled:e.isSaving,onClick:b[2]||(b[2]=H=>i("save")),"aria-label":A(u)("Save variant")},[e.isSaving?(r(),E(Y,{key:1,name:"Loading",class:"fct-rotation-icon"})):(r(),E(Y,{key:0,name:"Save"}))],10,hP)):x("",!0),F.isDraft?x("",!0):(r(),E(D,{key:1,trigger:"click",placement:"bottom-end","popper-class":"fct-dropdown",class:"fct-shared-variant-nav__menu fct-more-option-wrap",disabled:s(F),onCommand:H=>!s(F)&&i("command",H,F)},{dropdown:d(()=>[n($,null,{default:d(()=>{var H,j,W,G,Z;return[["simple","advanced_variations"].includes((H=e.product.detail)==null?void 0:H.variation_type)?x("",!0):(r(),E(S,{key:0,command:"duplicate"},{default:d(()=>[n(Y,{name:"Duplicate"}),R(" "+m(A(u)("Duplicate")),1)]),_:1})),n(S,{command:"copy_variation_id"},{default:d(()=>[n(Y,{name:"Copy"}),R(" "+m(A(u)("Copy Variation ID")),1)]),_:1}),n(S,{command:"copy_direct_checkout",disabled:!e.canCopyDirectCheckout(F)},{default:d(()=>[n(Y,{name:"Copy"}),R(" "+m(A(u)("Direct Checkout")),1)]),_:2},1032,["disabled"]),(j=F.variant)!=null&&j.id&&((W=e.product.detail)==null?void 0:W.variation_type)==="advanced_variations"?(r(),E(S,{key:1,command:"toggle_status",class:de({"item-destructive":((G=F.variant)==null?void 0:G.item_status)!=="inactive"})},{default:d(()=>{var ne,ce;return[n(Y,{name:((ne=F.variant)==null?void 0:ne.item_status)==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(((ce=F.variant)==null?void 0:ce.item_status)==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]}),_:2},1032,["class"])):x("",!0),((Z=e.product.detail)==null?void 0:Z.variation_type)!=="advanced_variations"&&e.productEditModel.variantsLength()>1?(r(),E(S,{key:2,command:"delete",class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})):x("",!0)]}),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:de(["fct-shared-variant-nav__menu-trigger",{"is-disabled":s(F)}]),disabled:s(F),onClick:b[3]||(b[3]=Ge(()=>{},["stop"])),"aria-label":A(u)("Variation actions")},[o("span",vP,[n(Y,{name:"More"})])],10,_P)]),_:2},1032,["disabled","onCommand"]))],2)}),128))],512)}}},gP={class:"fct-shared-variant-nav-mobile"},yP=["disabled","onClick"],ff={__name:"VariantNavMobile",props:{items:Array,activeKey:[String,Number],isDirty:Boolean},emits:["select"],setup(e,{emit:t}){const a=t;return(l,s)=>(r(),h("div",gP,[(r(!0),h(P,null,te(e.items,i=>(r(),h("button",{key:`mobile-${i.key}`,type:"button",class:de(["fct-shared-variant-nav-mobile__item",{"is-active":e.activeKey===i.key,"is-draft":i.isDraft}]),disabled:e.isDirty&&e.activeKey!==i.key,onClick:c=>a("select",i)},m(i.label),11,yP))),128))]))}},bP={class:"fct-product-pricing-table-wrap"},wP={class:"fct-table-draggable hide-on-mobile"},CP={class:"is-right"},kP={key:0,class:"fct-drag-handle drag-icon"},BP=["src","alt"],xP=["src"],SP={class:"fct-product-pricing-table-item"},FP={key:0,class:"fct-variant-badge"},$P={class:"fct-product-pricing-table-item"},EP={key:0,class:"fct-variant-badge fct-variant-badge--light"},UP={class:"fct-product-pricing-table-item"},IP={class:"is-right"},QP={class:"fct-product-pricing-table-item"},DP={class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},VP={key:0,class:"fct-drag-handle drag-icon"},TP={class:"fct-product-pricing-table-mobile-item-inner"},MP={class:"fct-product-pricing-table-item"},LP={class:"media"},RP=["src","alt"],OP=["src"],PP={class:"fct-product-pricing-table-item-content"},HP={class:"title"},NP={key:0,class:"fct-variant-badge"},KP={key:0,class:"compare-price"},GP={class:"price"},zP={key:0,class:"capitalize"},jP={key:0,class:"fct-product-pricing-table-item-action"},qP={class:"fct-shared-variant-drawer__layout"},YP={key:0,class:"fct-shared-variant-nav"},WP={class:"fct-shared-variant-drawer__content"},JP={class:"fct-shared-variant-drawer__form"},XP={class:"fct-variant-dirty-dialog__header"},ZP={class:"dialog-footer"},eH={class:"fct-btn-group sm"},rc=1040,tH=1060,aH={__name:"ProductPricingTable",props:{product:Object,productEditModel:Object,readonly:{type:Boolean,default:!1}},setup(e){const t=e,a=T(typeof window<"u"?window.innerWidth:rc),l=T(0),s=()=>{if(typeof window>"u")return 0;const oe=document.querySelector("#adminmenuwrap");if(!oe)return 0;const fe=window.getComputedStyle(oe);return fe.display==="none"||fe.visibility==="hidden"?0:Math.round(oe.getBoundingClientRect().width)},i=()=>{typeof window>"u"||(a.value=window.innerWidth,l.value=s())};Ie(()=>{i(),window.addEventListener("resize",i),setTimeout(()=>{document.querySelectorAll(".el-input__wrapper input[type='number']").forEach(fe=>{fe.addEventListener("wheel",re=>{document.activeElement===fe&&re.preventDefault()})}),t.product.variants.filter(fe=>{const re=fe.media?fe.media.meta_value||[]:[];return fe.media=re})},50)}),Bt(()=>{typeof window>"u"||window.removeEventListener("resize",i)});const c=K(()=>({animation:600,ghostClass:"ghost"})),p=T(!1),f=T("update"),_=T(null),g=T(null),y=T(!1),v=T(!1),w=T(null),k=T(!1),b=K(()=>Math.max(a.value-l.value,360)),S=K(()=>b.value<=tH),$=K(()=>{let oe=24;a.value<=640?oe=12:a.value<=900&&(oe=16);const fe=Math.max(b.value-oe,320);return`${Math.min(rc,fe)}px`}),D=(oe,fe)=>(oe==null?void 0:oe.variation_title)||`${u("Variation")} ${fe+1}`,F=oe=>{const fe=(oe==null?void 0:oe.item_price)??"";return fe===""||fe===null||fe===void 0?u("No price set"):Kt(fe,!0)},B=oe=>typeof oe=="number"&&oe>=0&&oe<t.product.variants.length?oe:t.product.variants.length?0:null,U=({modeType:oe="update",index:fe=null}={})=>{f.value=oe,_.value=oe==="create"?null:B(fe),k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!0},Q=()=>{k.value=!1,t.productEditModel.setValidationErrors({}),p.value=!1},V=()=>{y.value=!1,v.value=!1,w.value=null},I=()=>{var oe,fe;return((fe=(oe=g.value)==null?void 0:oe.hasDirtyDrafts)==null?void 0:fe.call(oe))??!1},M=oe=>{oe&&(f.value=oe.modeType,_.value=oe.index,t.productEditModel.setValidationErrors({}))},O=async(oe,fe)=>{var re,Ee;if(!(!fe||!oe)){if(oe==="duplicate"){U({modeType:"duplicate",index:fe.index});return}if(oe==="delete"&&((re=fe.variant)!=null&&re.id)){t.productEditModel.deletePricing(fe.variant.id,fe.index).then(async()=>{var ye,Ce;await xe(),t.product.variants.length>0?(f.value="update",_.value=Math.min(fe.index,t.product.variants.length-1),k.value=!1,(Ce=(ye=g.value)==null?void 0:ye.loadVariantFromProps)==null||Ce.call(ye)):Q()}).catch(()=>{});return}if(oe==="copy_variation_id"&&((Ee=fe.variant)!=null&&Ee.id)){as.copy(String(fe.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}oe==="copy_direct_checkout"&&L(fe)&&as.copy(H(fe),{successMessage:u("Direct checkout link copied to clipboard")})}},L=oe=>{var fe,re;return!!((fe=oe==null?void 0:oe.variant)!=null&&fe.id)&&["publish","private"].includes((re=t.product)==null?void 0:re.post_status)},H=oe=>`${ze.get("frontend_url")}=instant_checkout&item_id=${oe.variant.id}&quantity=1`,j=()=>{const oe=w.value;if(V(),!!oe&&oe.type==="close"){if(typeof oe.done=="function"){oe.done();return}Q()}},W=()=>{V()},G=async()=>{var oe,fe;await((fe=(oe=g.value)==null?void 0:oe.discardDrafts)==null?void 0:fe.call(oe)),j()},Z=async()=>{var fe;if(!((fe=g.value)!=null&&fe.saveCurrentDraft)||v.value)return;if(v.value=!0,await g.value.saveCurrentDraft()){j();return}v.value=!1,W()},ne=oe=>{if(!I()){oe();return}w.value={type:"close",done:oe},y.value=!0},ce=()=>{ne(()=>{Q()})},z=oe=>{k.value=oe},ue=oe=>{oe&&(f.value="update",typeof oe.index=="number"&&oe.index>=0?_.value=oe.index:_.value=B(_.value),k.value=!1,t.productEditModel.setValidationErrors({}))},ie=(oe,fe)=>{const re=D(oe,fe);return`${u("Copy of")} ${re}`},J=K(()=>{var fe;const oe=(t.product.variants||[]).map((re,Ee)=>({key:(re==null?void 0:re.id)??`variant-${Ee}`,index:Ee,variant:re,label:D(re,Ee),meta:F(re),modeType:"update",isDraft:!1}));if(p.value&&f.value==="create"&&oe.push({key:"draft-variation",index:null,label:u("New variation"),meta:u("Unsaved draft"),modeType:"create",isDraft:!0}),p.value&&f.value==="duplicate"){const re=(fe=t.product.variants)==null?void 0:fe[_.value];oe.push({key:"duplicate-variation",index:_.value,variant:re,label:ie(re,_.value??0),meta:u("Unsaved copy"),modeType:"duplicate",isDraft:!0})}return oe}),N=K(()=>{var fe;if(f.value==="create"&&_.value===null)return"draft-variation";if(f.value==="duplicate")return"duplicate-variation";const oe=(fe=t.product.variants)==null?void 0:fe[_.value];return(oe==null?void 0:oe.id)??`variant-${_.value??0}`}),ae=oe=>{oe&&(k.value&&N.value!==oe.key||M(oe))};return(oe,fe)=>{const re=C("el-input"),Ee=C("el-drawer"),ye=C("el-button"),Ce=C("el-dialog");return r(),h("div",bP,[o("div",wP,[o("table",null,[fe[5]||(fe[5]=o("colgroup",null,[o("col"),o("col",{width:"50"}),o("col",{width:"300"}),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[fe[4]||(fe[4]=o("th",null,null,-1)),o("th",null,m(oe.$t("Image")),1),o("th",null,m(oe.$t("Title")),1),o("th",null,m(oe.$t("Price")),1),o("th",null,m(oe.$t("Compare at price")),1),o("th",CP,m(oe.$t("Action")),1)])]),n(A(sn),va(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:fe[0]||(fe[0]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),tag:"tbody",handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(P,null,te(e.product.variants,(ve,Ue)=>{var Ke,We,Be,$e;return r(),h("tr",{key:ve.id},[o("td",null,[e.product.variants.length>1&&!e.readonly?(r(),h("span",kP,[n(Y,{name:"ReorderDotsVertical"})])):x("",!0)]),o("td",null,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,BP)):(r(),h("img",{key:2,src:oe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,xP)):(r(),E(yl,{key:0,modelValue:ve.media,"onUpdate:modelValue":He=>ve.media=He,compact:!0,"max-thumbs":1,onChange:He=>e.productEditModel.onUploadPricingMedia("media",Ue,He)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("td",null,[o("div",SP,[n(re,{class:de(e.productEditModel.hasValidationError(`variants.${Ue}.variation_title`)?"is-error":""),id:`variants.${Ue}.variation_title`,placeholder:oe.$t("e.g. Small, Medium, Large"),type:"text",modelValue:ve.variation_title,"onUpdate:modelValue":He=>ve.variation_title=He,onInput:He=>{e.productEditModel.onChangePricing("variation_title",Ue,He)},disabled:((We=(Ke=e.product)==null?void 0:Ke.detail)==null?void 0:We.variation_type)==="simple"||e.readonly,onFocus:He=>e.productEditModel.clearValidationError(`variants.${Ue}.variation_title`)},null,8,["class","id","placeholder","modelValue","onUpdate:modelValue","onInput","disabled","onFocus"]),((Be=ve.other_info)==null?void 0:Be.installment)==="yes"?(r(),h("span",FP,m(ve.other_info.times)+" "+m(A(u)("Installment")),1)):x("",!0)])]),o("td",null,[o("div",$P,[n(Za,{placeholder:oe.$t("Price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ue}.item_price`)?"is-error":"",id:`variants.${Ue}.item_price`,"model-value":ve.item_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":He=>{e.readonly||(ve.item_price=He,e.productEditModel.onChangePricing("item_price",Ue,He),e.productEditModel.clearValidationError(`variants.${Ue}.item_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"]),(($e=ve.other_info)==null?void 0:$e.payment_type)==="subscription"?(r(),h("span",EP,m(ve.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",UP,[n(Za,{placeholder:oe.$t("Compare price"),"error-class":e.productEditModel.hasValidationError(`variants.${Ue}.compare_price`)?"is-error":"",id:`variants.${Ue}.compare_price`,"model-value":ve.compare_price,disabled:ve.expanded||e.readonly,"onUpdate:modelValue":He=>{e.readonly||(ve.compare_price=He,e.productEditModel.onChangePricing("compare_price",Ue,He),e.productEditModel.clearValidationError(`variants.${Ue}.compare_price`))}},null,8,["placeholder","error-class","id","model-value","disabled","onUpdate:modelValue"])])]),o("td",IP,[o("div",QP,[e.readonly?x("",!0):(r(),E(nr,{key:0,modeType:"action",index:Ue,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"]))])])])}),128))]),_:1},16,["list","disabled"])])]),o("div",DP,[n(A(sn),va(c.value,{list:e.product.variants,"item-key":"id",disabled:e.readonly,onEnd:fe[1]||(fe[1]=ve=>{e.readonly||e.productEditModel.updateVariantSerialIndexes(e.product.variants)}),handle:".fct-drag-handle"}),{default:d(()=>[(r(!0),h(P,null,te(e.product.variants,(ve,Ue)=>{var Ke,We;return r(),h("div",{key:ve.id,class:"fct-product-pricing-table-mobile-row"},[e.product.variants.length>1&&!e.readonly?(r(),h("span",VP,[n(Y,{name:"ReorderDotsVertical"})])):x("",!0),o("div",TP,[o("div",MP,[o("div",LP,[e.readonly?ve.media&&ve.media[0]?(r(),h("img",{key:1,src:ve.media[0].url,alt:ve.variation_title,class:"fct-variant-thumb-readonly"},null,8,RP)):(r(),h("img",{key:2,src:oe.appVars.asset_url+"images/empty-image.svg",alt:"",class:"fct-variant-thumb-readonly"},null,8,OP)):(r(),E(yl,{key:0,modelValue:ve.media,"onUpdate:modelValue":Be=>ve.media=Be,compact:!0,"max-thumbs":1,onChange:Be=>e.productEditModel.onUploadPricingMedia("media",Ue,Be)},null,8,["modelValue","onUpdate:modelValue","onChange"]))]),o("div",PP,[o("div",HP,[R(m(ve.variation_title)+" ",1),((Ke=ve.other_info)==null?void 0:Ke.installment)==="yes"?(r(),h("span",NP,m(ve.other_info.times)+" "+m(A(u)("Installment")),1)):x("",!0)]),o("ul",null,[o("li",null,[ve.compare_price?(r(),h("div",KP,[o("span",null,m(oe.appVars.shop.currency_sign),1),R(" "+m(A(Kt)(ve.compare_price,!1)),1)])):x("",!0),o("div",GP,[o("span",null,m(oe.appVars.shop.currency_sign),1),R(" "+m(A(Kt)(ve.item_price,!1)),1)])]),((We=ve.other_info)==null?void 0:We.payment_type)==="subscription"?(r(),h("li",zP,m(ve.other_info.repeat_interval),1)):x("",!0)])])]),e.readonly?x("",!0):(r(),h("div",jP,[n(nr,{modeType:"action",index:Ue,variant:ve,product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["index","variant","product","productEditModel"])]))])])}),128))]),_:1},16,["list","disabled"])]),e.readonly?x("",!0):(r(),E(nr,{key:0,modeType:"add",product:e.product,productEditModel:e.productEditModel,onOpenEditor:U},null,8,["product","productEditModel"])),n(Ee,{modelValue:p.value,"onUpdate:modelValue":fe[2]||(fe[2]=ve=>p.value=ve),title:oe.$t("Pricing"),size:$.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":ne,class:"fct-shared-variant-drawer",onClose:Q},{default:d(()=>[o("div",qP,[S.value?x("",!0):(r(),h("aside",YP,[n(zr,{product:e.product},null,8,["product"]),n(pf,{items:J.value,"active-key":N.value,"is-dirty":k.value,"drawer-mode":f.value,product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":L,"is-saving":v.value,onSelect:ae,onCommand:O,onSave:Z},null,8,["items","active-key","is-dirty","drawer-mode","product","product-edit-model","is-saving"]),n(QO,{product:e.product,"drawer-mode":f.value,"is-variation-dirty":k.value,onOpenEditor:U},null,8,["product","drawer-mode","is-variation-dirty"])])),o("div",WP,[S.value?(r(),E(ff,{key:0,items:J.value,"active-key":N.value,"is-dirty":k.value,onSelect:ae},null,8,["items","active-key","is-dirty"])):x("",!0),o("div",JP,[n(Vd,{ref_key:"pricingFormRef",ref:g,index:_.value,modeType:f.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:ue,onCloseModal:ce,onDirtyStateChange:z},null,8,["index","modeType","product","productEditModel"])])])])]),_:1},8,["modelValue","title","size"]),n(Ce,{modelValue:y.value,"onUpdate:modelValue":fe[3]||(fe[3]=ve=>y.value=ve),"close-on-click-modal":!1,"close-on-press-escape":!v.value,"show-close":!v.value,class:"fct-variant-dirty-dialog",onClose:W},{header:d(()=>[o("div",XP,[o("h3",null,m(A(u)("Unsaved changes")),1)])]),default:d(()=>[o("p",null,m(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",ZP,[o("div",eH,[n(ye,{disabled:v.value,onClick:W,size:"small"},{default:d(()=>[R(m(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(ye,{disabled:v.value,onClick:G,size:"small"},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(ye,{type:"primary",loading:v.value,onClick:Z,size:"small"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},lH={key:0,class:"fct-adv-groupby-bar"},sH={class:"fct-adv-groupby-label"},nH={__name:"AdvancedVariationGroupBar",props:{product:Object,attributeGroups:{type:Array,default:()=>[]},modelValue:{type:[Number,null],default:null}},emits:["update:modelValue"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=K({get(){return l.modelValue},set(p){s("update:modelValue",p)}}),c=K(()=>{var f,_,g;const p=(g=(_=(f=l.product)==null?void 0:f.detail)==null?void 0:_.other_info)==null?void 0:g.attribute_config;return!p||!Array.isArray(p)?[]:p.map(y=>{const v=l.attributeGroups.find(w=>String(w.id)===String(y.group_id));return v?{id:v.id,title:v.title}:null}).filter(Boolean)});return t({configuredGroups:c}),(p,f)=>{const _=C("el-option"),g=C("el-select");return c.value.length>=2?(r(),h("div",lH,[o("span",sH,m(p.$t("Group by")),1),n(g,{modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=y=>i.value=y),placeholder:p.$t("Select")},{default:d(()=>[(r(!0),h(P,null,te(c.value,y=>(r(),E(_,{key:y.id,label:y.title,value:y.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):x("",!0)}}},oH={key:0,class:"fct-adv-bulk-bar"},iH={class:"fct-adv-bulk-count"},rH={__name:"AdvancedVariationBulkBar",props:{selectedCount:{type:Number,default:0},bulkAction:{type:String,default:""},bulkValue:{type:[String,Number],default:""},saving:{type:Boolean,default:!1}},emits:["update:bulkAction","update:bulkValue","apply","clear"],setup(e,{emit:t}){const a=e,l=t,s=K({get(){return a.bulkAction},set(p){l("update:bulkAction",p)}}),i=K({get(){return a.bulkValue},set(p){l("update:bulkValue",p)}}),c=K(()=>a.bulkAction==="set_price");return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-button");return e.selectedCount>0?(r(),h("div",oH,[o("span",iH,m(p.$t("%1$s selected",e.selectedCount)),1),o("button",{type:"button",class:"fct-adv-bulk-clear",onClick:f[0]||(f[0]=v=>p.$emit("clear"))},m(p.$t("Clear")),1),n(g,{modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=v=>s.value=v),placeholder:p.$t("Bulk Actions"),size:"small"},{default:d(()=>[n(_,{label:p.$t("Set Price"),value:"set_price"},null,8,["label"]),n(_,{label:p.$t("Set Active"),value:"set_status_active"},null,8,["label"]),n(_,{label:p.$t("Set Inactive"),value:"set_status_inactive"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),c.value?(r(),E(Za,{key:0,modelValue:i.value,"onUpdate:modelValue":f[2]||(f[2]=v=>i.value=v),placeholder:p.$t("Value"),size:"small"},null,8,["modelValue","placeholder"])):x("",!0),n(y,{type:"primary",size:"small",loading:e.saving,disabled:!e.bulkAction||e.selectedCount===0,onClick:f[3]||(f[3]=v=>p.$emit("apply"))},{default:d(()=>[R(m(p.$t("Apply")),1)]),_:1},8,["loading","disabled"])])):x("",!0)}}};function dc(e){if(e===""||e===null||e===void 0)return null;const t=Number(e);return Number.isFinite(t)?t:null}function dH(e,t){return e===null||t!==void 0&&t===e?null:e}function uH(){let e={};return{onEnter(t,a){const l=dc(a);return l===null?null:(e={...e,[t]:l},l)},onBlur(t,a){const l=dc(a),s=e[t];if(s!==void 0){const i={...e};delete i[t],e=i}return dH(l,s)},reset(t){if(t===void 0){e={};return}const a={...e};delete a[t],e=a},hasPending(t){return e[t]!==void 0}}}const cH={class:"fct-grouped-variant-table fct-adv-table-desktop"},AH={class:"is-right"},pH=["aria-expanded","aria-label"],fH=["onClick"],mH={class:"fct-adv-group-header"},hH={class:"fct-adv-group-count"},_H={class:"fct-product-pricing-table-item"},vH={class:"is-right"},gH={class:"fct-adv-group-actions"},yH=["aria-expanded","aria-label","onClick"],bH={class:"fct-adv-slot-row"},wH={colspan:"6"},CH={class:"fct-product-pricing-table-item"},kH={class:"fct-product-pricing-table-item fct-adv-child-title"},BH={class:"fct-adv-title-cell"},xH={class:"fct-adv-title-main"},SH={class:"fct-adv-variant-title"},FH={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},$H={class:"fct-product-pricing-table-item"},EH={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},UH={class:"fct-product-pricing-table-item"},IH={class:"is-right"},QH={class:"fct-product-pricing-table-item"},DH={class:"fct-btn-group sm justify-end"},VH=["aria-label"],TH={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},MH={colspan:"6"},LH={class:"fct-grouped-variant-table fct-adv-table-mobile"},RH={class:"is-right"},OH=["aria-expanded","aria-label"],PH=["onClick"],HH={class:"fct-adv-group-header"},NH={class:"fct-adv-group-count"},KH={class:"is-right"},GH={class:"fct-adv-group-actions"},zH=["aria-expanded","aria-label","onClick"],jH={class:"fct-adv-slot-row"},qH={colspan:"4"},YH={class:"fct-product-pricing-table-item"},WH={class:"fct-product-pricing-table-item fct-adv-child-title"},JH={class:"fct-adv-title-cell"},XH={class:"fct-adv-title-main"},ZH={class:"fct-adv-variant-title"},eN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},tN={class:"fct-adv-variant-price"},aN={key:0,class:"fct-adv-variant-compare"},lN={class:"is-right"},sN={class:"fct-product-pricing-table-item"},nN={class:"fct-btn-group sm justify-end"},oN=["aria-label"],iN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},rN={colspan:"6"},uc=30,dN=30,uN={__name:"AdvancedVariationGroupedTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},groupedVariants:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},groupById:{type:Number,default:null},expandedGroups:{type:Set,default:()=>new Set}},emits:["update:selectedVariants","update:isAllSelected","update:expandedGroups","editVariant","editGroup","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded","groupPriceApply","groupMediaUploaded"],setup(e,{emit:t}){const a=e,l=K(()=>{var Ee,ye,Ce;const N=a.groupById?parseInt(a.groupById):null,ae=(((Ce=(ye=(Ee=a.product)==null?void 0:Ee.detail)==null?void 0:ye.other_info)==null?void 0:Ce.attribute_config)||[]).map(ve=>parseInt(ve.group_id)).filter(Boolean),oe=ve=>{const Ue=ae.indexOf(ve);return Ue===-1?Number.MAX_SAFE_INTEGER:Ue},fe={};(a.attributeGroups||[]).forEach(ve=>{const Ue={};(ve.terms||[]).forEach(Ke=>{Ue[parseInt(Ke.id)]=Ke.title}),fe[parseInt(ve.id)]=Ue});const re={};return(a.groupedVariants||[]).forEach(ve=>{(ve.variants||[]).forEach(Ue=>{const Ke=Ue.attr_map||[];if(!Ke.length){re[Ue.id]="";return}const We=[...Ke].sort((Be,$e)=>oe(parseInt(Be.group_id))-oe(parseInt($e.group_id))).map(Be=>{const $e=parseInt(Be.group_id);if(N&&$e===N)return null;const He=fe[$e];return He&&He[parseInt(Be.term_id)]||null}).filter(Boolean);re[Ue.id]=We.join(" / ")})}),re}),s=T(new Set),i=N=>{s.value.has(N)||(s.value=new Set(s.value).add(N))},c=T({}),p=N=>c.value[N]||uc,f=N=>{const ae=N.variants||[],oe=p(N.termId);return oe>=ae.length?ae:ae.slice(0,oe)},_=N=>(N.variants||[]).length>p(N.termId),g=(N,ae)=>{const oe=c.value[N]||uc;oe>=ae||(c.value={...c.value,[N]:Math.min(oe+dN,ae)})};be(()=>a.expandedGroups,N=>{const ae=Object.keys(c.value);if(!ae.length)return;const oe={};ae.forEach(fe=>{N&&(N.has(fe)||N.has(Number(fe)))&&(oe[fe]=c.value[fe])}),Object.keys(oe).length!==ae.length&&(c.value=oe)});let y=null;const v={},w=N=>{let ae=N&&N.parentElement;for(;ae;){const oe=getComputedStyle(ae).overflowY;if(oe==="auto"||oe==="scroll"||oe==="overlay")return ae;ae=ae.parentElement}return null},k=N=>{y||(y=new IntersectionObserver(ae=>{ae.forEach(oe=>{oe.isIntersecting&&g(oe.target.dataset.termId,parseInt(oe.target.dataset.total,10)||0)})},{root:w(N),rootMargin:"300px 0px"}))},b=(N,ae)=>oe=>{oe?(oe.dataset.termId=N,oe.dataset.total=ae,k(oe),v[N]=oe,y.observe(oe)):v[N]&&(y&&y.unobserve(v[N]),delete v[N])};Bt(()=>{y&&(y.disconnect(),y=null)});const S=N=>{if(!a.productEditModel)return!1;const ae=a.product.variants.findIndex(oe=>oe.id===N.id);return ae===-1?!1:a.productEditModel.hasValidationError(`variants.${ae}.compare_price`)},$=t,D=T({}),F=uH();be(()=>{var N,ae;return(ae=(N=a.productEditModel)==null?void 0:N.data)==null?void 0:ae.discardKey},()=>{D.value={},F.reset()});const B=K(()=>a.groupedVariants.every(N=>a.expandedGroups.has(N.termId))),U=()=>{const N=B.value?new Set:new Set(a.groupedVariants.map(ae=>ae.termId));$("update:expandedGroups",N)},Q=N=>{const ae=new Set(a.expandedGroups);ae.has(N)?ae.delete(N):ae.add(N),$("update:expandedGroups",ae)},V=N=>a.expandedGroups.has(N),I=N=>N.variants.length>0&&N.variants.every(ae=>a.selectedVariants.includes(ae.id)),M=N=>{if(N.variants.length===0)return!1;const ae=N.variants.filter(oe=>a.selectedVariants.includes(oe.id)).length;return ae>0&&ae<N.variants.length},O=(N,ae)=>{let oe;if(ae){const fe=new Set(a.selectedVariants);N.variants.forEach(re=>fe.add(re.id)),oe=Array.from(fe)}else{const fe=new Set(N.variants.map(re=>re.id));oe=a.selectedVariants.filter(re=>!fe.has(re))}$("update:selectedVariants",oe)},L=(N,ae)=>{let oe;ae?oe=[...a.selectedVariants,N]:oe=a.selectedVariants.filter(fe=>fe!==N),$("update:selectedVariants",oe)},H=(N,ae)=>{$("groupPriceApply",N,ae)},j=N=>{const ae=F.onEnter(N.termId,D.value[N.termId]);ae!==null&&H(N.termId,ae)},W=N=>{const ae=F.onBlur(N.termId,D.value[N.termId]);ae!==null&&H(N.termId,ae)},G=N=>{const ae=N.variants.map(re=>parseFloat(re.item_price)).filter(re=>!isNaN(re));if(!ae.length)return"";const oe=Math.min(...ae),fe=Math.max(...ae);return oe===fe?Kt(oe,!1):`${Kt(oe,!1)} – ${Kt(fe,!1)}`},Z=T(null),ne=N=>Z.value===N.termId?"":G(N)||"",ce=N=>{Z.value=N.termId},z=N=>{Z.value=null,W(N)},ue=N=>{const ae=new Set,oe=[];return(N.variants||[]).forEach(fe=>{Array.isArray(fe==null?void 0:fe.media)&&fe.media.forEach(re=>{const Ee=(re==null?void 0:re.id)||(re==null?void 0:re.url);Ee&&!ae.has(Ee)&&(ae.add(Ee),oe.push(re))})}),oe},ie=(N,ae,oe)=>{!oe||!oe.applyToAll||$("groupMediaUploaded",N,ae)},J=(N,ae,oe,fe)=>{fe&&fe.applyToAll?$("groupMediaUploaded",N,oe):$("mediaUploaded",ae,oe)};return(N,ae)=>{const oe=C("el-checkbox"),fe=C("el-dropdown-item"),re=C("el-dropdown-menu"),Ee=C("el-dropdown");return r(),h(P,null,[o("div",cH,[o("table",null,[ae[11]||(ae[11]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(oe,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":ae[0]||(ae[0]=ye=>N.$emit("update:isAllSelected",ye))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(N.$t("Image")),1),o("th",null,m(N.$t("Variant")),1),o("th",null,m(N.$t("Price")),1),o("th",null,m(N.$t("Compare at price")),1),o("th",AH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":B.value,"aria-label":B.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":B.value}])},[n(Y,{name:"ChevronDown"})],2)],8,pH)])])]),o("tbody",null,[(r(!0),h(P,null,te(e.groupedVariants,ye=>(r(),h(P,{key:ye.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":V(ye.termId)}]),onClick:Ce=>Q(ye.termId)},[o("td",null,[n(oe,{onClick:ae[1]||(ae[1]=Ge(()=>{},["stop"])),"model-value":I(ye),indeterminate:M(ye),"aria-label":A(u)("Select all variants in %1$s",ye.title),onChange:Ce=>O(ye,Ce)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:ae[2]||(ae[2]=Ge(()=>{},["stop"]))},[n(yl,{"model-value":ue(ye),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Ce,ve)=>ie(ye,Ce,ve)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",mH,[o("strong",null,m(ye.title),1),o("span",hH,m(ye.variants.length)+" "+m(ye.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",null,[o("div",_H,[n(Za,{onClick:ae[3]||(ae[3]=Ge(()=>{},["stop"])),class:"fct-adv-group-price-input",placeholder:ne(ye),size:"small",modelValue:D.value[ye.termId],"onUpdate:modelValue":Ce=>D.value[ye.termId]=Ce,onFocus:Ce=>ce(ye),onBlur:Ce=>z(ye),onKeyup:xa(Ce=>j(ye),["enter"])},null,8,["placeholder","modelValue","onUpdate:modelValue","onFocus","onBlur","onKeyup"])])]),ae[9]||(ae[9]=o("td",null,null,-1)),o("td",vH,[o("div",gH,[V(ye.termId)?(r(),E(at,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",ye.title),onClick:Ge(Ce=>N.$emit("editGroup",ye),["stop"])},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):x("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":V(ye.termId),"aria-label":N.$t("Toggle %1$s variants",ye.title),onClick:Ge(Ce=>Q(ye.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":V(ye.termId)}])},[n(Y,{name:"ChevronDown"})],2)],8,yH)])])],10,fH),o("tr",bH,[o("td",wH,[n(zd,{visible:V(ye.termId),duration:220},{default:d(()=>[o("table",null,[ae[10]||(ae[10]=o("colgroup",null,[o("col",{width:"80"}),o("col",{width:"130"}),o("col",{width:"250"}),o("col",{width:"150"}),o("col",{width:"180"}),o("col",{width:"100"})],-1)),o("tbody",null,[(r(!0),h(P,null,te(f(ye),Ce=>{var ve,Ue;return r(),h("tr",{key:Ce.id,class:"fct-adv-group-child-row"},[o("td",{onClick:ae[4]||(ae[4]=Ge(()=>{},["stop"]))},[n(oe,{"model-value":e.selectedVariants.includes(Ce.id),"aria-label":A(u)("Select variant %1$s",Ce.variation_title),onChange:Ke=>L(Ce.id,Ke)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",CH,[n(yl,{modelValue:Ce.media,"onUpdate:modelValue":Ke=>Ce.media=Ke,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Ke,We)=>J(ye,Ce,Ke,We)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",kH,[o("div",BH,[o("div",xH,[o("span",SH,m(l.value[Ce.id]||Ce.variation_title),1),Ce.item_status==="inactive"?(r(),h("span",FH,m(A(u)("Inactive")),1)):x("",!0)])])])]),o("td",null,[o("div",$H,[n(Za,{placeholder:N.$t("Price"),"model-value":Ce.item_price,"onUpdate:modelValue":Ke=>N.$emit("inlinePriceChange",Ce,"item_price",Ke),onChange:Ke=>N.$emit("inlinePriceCommit",Ce)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((ve=Ce.other_info)==null?void 0:ve.payment_type)==="subscription"&&((Ue=Ce.other_info)!=null&&Ue.repeat_interval)?(r(),h("span",EH,m(Ce.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",UH,[n(Za,{placeholder:N.$t("Compare price"),"error-class":S(Ce)?"is-error":"",title:S(Ce)?N.$t("Compare price must be greater than or equal to item price."):null,"model-value":Ce.compare_price,"onUpdate:modelValue":Ke=>N.$emit("inlinePriceChange",Ce,"compare_price",Ke),onChange:Ke=>N.$emit("inlinePriceCommit",Ce)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",IH,[o("div",QH,[o("div",DH,[n(at,{class:"hide-on-mobile",size:"small",tag:"button",onClick:Ke=>N.$emit("editVariant",Ce)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(Ee,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:Ke=>Ke&&i(Ce.id),onCommand:Ke=>{Ke==="toggle_status"&&N.$emit("toggleStatus",Ce)}},{dropdown:d(()=>[n(re,null,{default:d(()=>[s.value.has(Ce.id)?(r(),h(P,{key:0},[n(fe,{class:"show-on-mobile",onClick:Ke=>N.$emit("editVariant",Ce)},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(fe,null,{default:d(()=>[Ce.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:String(Ce.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),n(fe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Ce.id},{default:d(()=>{var Ke;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Ce.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:((Ke=N.appVars)==null?void 0:Ke.frontend_url)+"=instant_checkout&item_id="+Ce.id+"&quantity=1",showMode:"icon_with_text",buttonText:N.$t("Direct Checkout"),tooltipContent:N.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[n(Y,{name:"Copy"}),R(" "+m(N.$t("Direct Checkout"))+" ",1),n(pa,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Ce.id?(r(),E(fe,{key:0,command:"toggle_status",class:de({"item-destructive":Ce.item_status!=="inactive"})},{default:d(()=>[n(Y,{name:Ce.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(Ce.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)],64)):x("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(Y,{name:"More"})],8,VH)]),_:2},1032,["onVisibleChange","onCommand"])])])])])}),128)),_(ye)?(r(),h("tr",TH,[o("td",MH,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(ye.termId,ye.variants.length)},null,512)])])):x("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])]),o("div",LH,[o("table",null,[ae[13]||(ae[13]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("thead",null,[o("tr",null,[o("th",null,[n(oe,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":N.$t("Select all variants"),"onUpdate:modelValue":ae[5]||(ae[5]=ye=>N.$emit("update:isAllSelected",ye))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(N.$t("Image")),1),o("th",null,m(N.$t("Variant")),1),o("th",RH,[o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":B.value,"aria-label":B.value?N.$t("Collapse all groups"):N.$t("Expand all groups"),onClick:U},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":B.value}])},[n(Y,{name:"ChevronDown"})],2)],8,OH)])])]),o("tbody",null,[(r(!0),h(P,null,te(e.groupedVariants,ye=>(r(),h(P,{key:ye.termId},[o("tr",{class:de(["fct-adv-group-row",{"is-expanded":V(ye.termId)}]),onClick:Ce=>Q(ye.termId)},[o("td",null,[n(oe,{onClick:ae[6]||(ae[6]=Ge(()=>{},["stop"])),"model-value":I(ye),indeterminate:M(ye),"aria-label":A(u)("Select all variants in %1$s",ye.title),onChange:Ce=>O(ye,Ce)},null,8,["model-value","indeterminate","aria-label","onChange"])]),o("td",null,[o("div",{class:"fct-product-pricing-table-item",onClick:ae[7]||(ae[7]=Ge(()=>{},["stop"]))},[n(yl,{"model-value":ue(ye),compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"default-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(Ce,ve)=>ie(ye,Ce,ve)},null,8,["model-value","selected-count","onChange"])])]),o("td",null,[o("div",HH,[o("strong",null,m(ye.title),1),o("span",NH,m(ye.variants.length)+" "+m(ye.variants.length===1?N.$t("variant"):N.$t("variants")),1)])]),o("td",KH,[o("div",GH,[V(ye.termId)?(r(),E(at,{key:0,class:"fct-adv-group-edit-btn",size:"small",tag:"button","aria-label":N.$t("Edit group %1$s",ye.title),onClick:Ge(Ce=>N.$emit("editGroup",ye),["stop"])},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["aria-label","onClick"])):x("",!0),o("button",{type:"button",class:"fct-adv-group-chevron-btn","aria-expanded":V(ye.termId),"aria-label":N.$t("Toggle %1$s variants",ye.title),onClick:Ge(Ce=>Q(ye.termId),["stop"])},[o("span",{class:de(["fct-adv-group-chevron",{"is-expanded":V(ye.termId)}])},[n(Y,{name:"ChevronDown"})],2)],8,zH)])])],10,PH),o("tr",jH,[o("td",qH,[n(zd,{visible:V(ye.termId),duration:220},{default:d(()=>[o("table",null,[ae[12]||(ae[12]=o("colgroup",null,[o("col",{width:"56"}),o("col",{width:"68"}),o("col",{width:"auto"}),o("col",{width:"56"})],-1)),o("tbody",null,[(r(!0),h(P,null,te(f(ye),Ce=>(r(),h("tr",{key:Ce.id,class:"fct-adv-group-child-row"},[o("td",{onClick:ae[8]||(ae[8]=Ge(()=>{},["stop"]))},[n(oe,{"model-value":e.selectedVariants.includes(Ce.id),"aria-label":A(u)("Select variant %1$s",Ce.variation_title),onChange:ve=>L(Ce.id,ve)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",YH,[n(yl,{modelValue:Ce.media,"onUpdate:modelValue":ve=>Ce.media=ve,compact:!0,"max-thumbs":1,square:!0,"show-apply-to-all":!0,"selected-count":e.selectedVariants.length,onChange:(ve,Ue)=>J(ye,Ce,ve,Ue)},null,8,["modelValue","onUpdate:modelValue","selected-count","onChange"])])]),o("td",null,[o("div",WH,[o("div",JH,[o("div",XH,[o("span",ZH,m(l.value[Ce.id]||Ce.variation_title),1),Ce.item_status==="inactive"?(r(),h("span",eN,m(A(u)("Inactive")),1)):x("",!0)]),o("span",tN,[Ce.compare_price?(r(),h("span",aN,m(A(Kt)(Ce.compare_price,!0)),1)):x("",!0),o("span",null,m(A(Kt)(Ce.item_price||0,!0)),1)])])])]),o("td",lN,[o("div",sN,[o("div",nN,[n(Ee,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onVisibleChange:ve=>ve&&i(Ce.id),onCommand:ve=>{ve==="toggle_status"&&N.$emit("toggleStatus",Ce)}},{dropdown:d(()=>[n(re,null,{default:d(()=>[s.value.has(Ce.id)?(r(),h(P,{key:0},[n(fe,{onClick:ve=>N.$emit("editVariant",Ce)},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(N.$t("Edit")),1)]),_:2},1032,["onClick"]),n(fe,null,{default:d(()=>[Ce.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:String(Ce.id),showMode:"icon_with_text",buttonText:N.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),n(fe,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!Ce.id},{default:d(()=>{var ve;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&Ce.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:((ve=N.appVars)==null?void 0:ve.frontend_url)+"=instant_checkout&item_id="+Ce.id+"&quantity=1",showMode:"icon_with_text",buttonText:N.$t("Direct Checkout"),tooltipContent:N.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[n(Y,{name:"Copy"}),R(" "+m(N.$t("Direct Checkout"))+" ",1),n(pa,{content:N.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),Ce.id?(r(),E(fe,{key:0,command:"toggle_status",class:de({"item-destructive":Ce.item_status!=="inactive"})},{default:d(()=>[n(Y,{name:Ce.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(Ce.item_status==="inactive"?N.$t("Set Active"):N.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)],64)):x("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(Y,{name:"More"})],8,oN)]),_:2},1032,["onVisibleChange","onCommand"])])])])]))),128)),_(ye)?(r(),h("tr",iN,[o("td",rN,[o("div",{class:"fct-adv-row-sentinel",ref_for:!0,ref:b(ye.termId,ye.variants.length)},null,512)])])):x("",!0)])])]),_:2},1032,["visible"])])])],64))),128))])])])],64)}}},cN={class:"fct-flat-variant-table fct-table-draggable hide-on-mobile"},AN={class:"is-right"},pN={class:"fct-product-pricing-table-item"},fN={class:"fct-product-pricing-table-item"},mN={class:"fct-adv-title-cell"},hN={class:"fct-adv-title-main"},_N={class:"fct-adv-variant-title"},vN={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},gN={key:0,class:"fct-adv-attr-breadcrumb"},yN={class:"fct-product-pricing-table-item"},bN={key:0,class:"fct-variant-badge fct-repeat-interval-badge"},wN={class:"fct-product-pricing-table-item"},CN={class:"is-right"},kN={class:"fct-product-pricing-table-item"},BN={class:"fct-btn-group sm"},xN=["aria-label"],SN={key:0,class:"fct-adv-row-sentinel-row","aria-hidden":"true"},cc=30,FN=30,$N={__name:"AdvancedVariationFlatTable",props:{product:Object,productEditModel:{type:Object,default:null},attributeGroups:{type:Array,default:()=>[]},selectedVariants:{type:Array,default:()=>[]},isAllSelected:{type:Boolean,default:!1},isSelectionIndeterminate:{type:Boolean,default:!1},variants:{type:Array,default:null}},emits:["update:selectedVariants","update:isAllSelected","editVariant","toggleStatus","inlinePriceChange","inlinePriceCommit","mediaUploaded"],setup(e,{emit:t}){const a=e,l=K(()=>a.variants??a.product.variants),s=T(cc),i=K(()=>{const b=l.value;return b.length<=s.value?b:b.slice(0,s.value)}),c=K(()=>l.value.length>s.value);be(l,()=>{s.value=cc});let p=null,f=null;const _=b=>{let S=b&&b.parentElement;for(;S;){const $=getComputedStyle(S).overflowY;if($==="auto"||$==="scroll"||$==="overlay")return S;S=S.parentElement}return null},g=b=>{b?(p||(p=new IntersectionObserver(S=>{S.some($=>$.isIntersecting)&&(s.value=Math.min(s.value+FN,l.value.length))},{root:_(b),rootMargin:"300px 0px"})),f=b,p.observe(b)):f&&(p&&p.unobserve(f),f=null)};Bt(()=>{p&&(p.disconnect(),p=null)});const y=b=>{if(!a.productEditModel)return!1;const S=a.product.variants.findIndex($=>$.id===b.id);return S===-1?!1:a.productEditModel.hasValidationError(`variants.${S}.compare_price`)},v=b=>{var B,U,Q;const S=b.attr_map||[];if(!S.length)return"";const $=(((Q=(U=(B=a.product)==null?void 0:B.detail)==null?void 0:U.other_info)==null?void 0:Q.attribute_config)||[]).map(V=>parseInt(V.group_id)).filter(Boolean),D=V=>{const I=$.indexOf(V);return I===-1?Number.MAX_SAFE_INTEGER:I};return[...S].sort((V,I)=>D(parseInt(V.group_id))-D(parseInt(I.group_id))).map(V=>{const I=a.attributeGroups.find(O=>O.id===parseInt(V.group_id));if(!I)return null;const M=(I.terms||[]).find(O=>O.id===parseInt(V.term_id));return M?M.title:null}).filter(Boolean).join(" / ")},w=t,k=(b,S)=>{let $;S?$=[...a.selectedVariants,b]:$=a.selectedVariants.filter(D=>D!==b),w("update:selectedVariants",$)};return(b,S)=>{const $=C("el-checkbox"),D=C("el-dropdown-item"),F=C("el-dropdown-menu"),B=C("el-dropdown");return r(),h("div",cN,[o("table",null,[S[1]||(S[1]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col"),o("col"),o("col")],-1)),o("thead",null,[o("tr",null,[o("th",null,[n($,{"model-value":e.isAllSelected,indeterminate:e.isSelectionIndeterminate,"aria-label":b.$t("Select all variants"),"onUpdate:modelValue":S[0]||(S[0]=U=>b.$emit("update:isAllSelected",U))},null,8,["model-value","indeterminate","aria-label"])]),o("th",null,m(b.$t("Image")),1),o("th",null,m(b.$t("Title")),1),o("th",null,m(b.$t("Price")),1),o("th",null,m(b.$t("Compare at price")),1),o("th",AN,m(b.$t("Action")),1)])]),o("tbody",null,[(r(!0),h(P,null,te(i.value,U=>{var Q,V;return r(),h("tr",{key:U.id},[o("td",null,[n($,{"model-value":e.selectedVariants.includes(U.id),"aria-label":A(u)("Select variant %1$s",U.variation_title),onChange:I=>k(U.id,I)},null,8,["model-value","aria-label","onChange"])]),o("td",null,[o("div",pN,[n(yl,{modelValue:U.media,"onUpdate:modelValue":I=>U.media=I,compact:!0,"max-thumbs":1,square:!0,onChange:I=>b.$emit("mediaUploaded",U,I)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),o("td",null,[o("div",fN,[o("div",mN,[o("div",hN,[o("span",_N,m(U.variation_title),1),U.item_status==="inactive"?(r(),h("span",vN,m(A(u)("Inactive")),1)):x("",!0)]),v(U)&&v(U)!==U.variation_title?(r(),h("span",gN,m(v(U)),1)):x("",!0)])])]),o("td",null,[o("div",yN,[n(Za,{placeholder:b.$t("Price"),"model-value":U.item_price,"onUpdate:modelValue":I=>b.$emit("inlinePriceChange",U,"item_price",I),onChange:I=>b.$emit("inlinePriceCommit",U)},null,8,["placeholder","model-value","onUpdate:modelValue","onChange"]),((Q=U.other_info)==null?void 0:Q.payment_type)==="subscription"&&((V=U.other_info)!=null&&V.repeat_interval)?(r(),h("span",bN,m(U.other_info.repeat_interval),1)):x("",!0)])]),o("td",null,[o("div",wN,[n(Za,{placeholder:b.$t("Compare price"),"error-class":y(U)?"is-error":"",title:y(U)?b.$t("Compare price must be greater than or equal to item price."):null,"model-value":U.compare_price,"onUpdate:modelValue":I=>b.$emit("inlinePriceChange",U,"compare_price",I),onChange:I=>b.$emit("inlinePriceCommit",U)},null,8,["placeholder","error-class","title","model-value","onUpdate:modelValue","onChange"])])]),o("td",CN,[o("div",kN,[o("div",BN,[n(at,{class:"hide-on-mobile",size:"small",tag:"button",onClick:I=>b.$emit("editVariant",U)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(B,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:I=>{I==="toggle_status"&&b.$emit("toggleStatus",U)}},{dropdown:d(()=>[n(F,null,{default:d(()=>[n(D,{class:"show-on-mobile",onClick:I=>b.$emit("editVariant",U)},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(b.$t("Edit")),1)]),_:2},1032,["onClick"]),n(D,null,{default:d(()=>[U.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:String(U.id),showMode:"icon_with_text",buttonText:b.$t("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),n(D,{disabled:e.product.post_status!=="publish"&&e.product.post_status!=="private"||!U.id},{default:d(()=>{var I;return[(e.product.post_status==="publish"||e.product.post_status==="private")&&U.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:((I=b.appVars)==null?void 0:I.frontend_url)+"=instant_checkout&item_id="+U.id+"&quantity=1",showMode:"icon_with_text",buttonText:b.$t("Direct Checkout"),tooltipContent:b.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):(r(),h(P,{key:1},[n(Y,{name:"Copy"}),R(" "+m(b.$t("Direct Checkout"))+" ",1),n(pa,{content:b.$t("This product is currently in draft. You can't share direct checkout link")},null,8,["content"])],64))]}),_:2},1032,["disabled"]),U.id?(r(),E(D,{key:0,command:"toggle_status",class:de({"item-destructive":U.item_status!=="inactive"})},{default:d(()=>[n(Y,{name:U.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(U.item_status==="inactive"?b.$t("Set Active"):b.$t("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(Y,{name:"More"})],8,xN)]),_:2},1032,["onCommand"])])])])])}),128)),c.value?(r(),h("tr",SN,[o("td",{colspan:"6"},[o("div",{class:"fct-adv-row-sentinel",ref:g})])])):x("",!0)])])])}}},EN={class:"fct-product-pricing-form-wrap"},UN={class:"fct-product-pricing-form-inner"},IN={class:"dialog-footer"},QN={class:"fct-btn-group sm"},DN={__name:"GroupBulkEditForm",props:{groupVariantIds:{type:Array,required:!0},product:Object,productEditModel:Object,fieldKey:String},emits:["createOrUpdateVariant","closeModal","dirtyStateChange"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=()=>({item_price:null,compare_price:null,item_cost:null,manage_cost:"__unchanged__",sku:null,manage_stock:"__unchanged__",total_stock:null,fulfillment_type:"__unchanged__",available:null,on_hold:null,committed:null,other_info:{payment_type:"__unchanged__",description:null,tax_class:null,tax_exempt:"__unchanged__",tax_inclusion:"__unchanged__",package_slug:null,weight:null,weight_unit:null,length:null,width:null,height:null,interval:null,interval_count:null,billing_summary:null,manage_setup_fee:"__unchanged__",signup_fee:null,signup_fee_name:null,times:null,trial_days:null}}),c=T(i()),p=T(0),f=T(!1),_=T(!1);Ie(async()=>{await xe(),_.value=!0});const g=()=>{const v=c.value||{},w={};["item_price","compare_price","item_cost","manage_cost","sku","manage_stock","total_stock","fulfillment_type"].forEach(D=>{const F=v[D];F!=null&&F!==""&&F!=="__unchanged__"&&(w[D]=F)});const b=v.other_info||{},S={};Object.keys(b).forEach(D=>{if(D==="billing_summary")return;const F=b[D];F!=null&&F!==""&&F!=="__unchanged__"&&(S[D]=F)});const $={...w};return Object.keys(S).length>0&&($.other_info=S),$},y=async()=>{if(!l.groupVariantIds.length)return q.error(u("Please select at least one variant to update.")),null;const v=g();if(!Object.keys(v).length)return q.error(u("Please fill in at least one field to update.")),null;l.productEditModel.setSaving(!0);try{const w=await Ae.post("products/variants/group-bulk-update",{variant_ids:l.groupVariantIds,...v});return q.success(w.message||u("Variants updated successfully")),p.value=0,s("createOrUpdateVariant",{group:!0,count:l.groupVariantIds.length}),w}catch(w){return w&&(w.status_code===422||w.status===422)?q.validationErrors(w):q.error(w&&w.data&&w.data.message||u("Failed to update variants")),null}finally{l.productEditModel.setSaving(!1)}};return be(c,()=>{f.value||!_.value||p.value++},{deep:!0}),be(()=>p.value,v=>{s("dirtyStateChange",v>0)},{immediate:!0}),t({hasDirtyDrafts:()=>p.value>0,getDirtyDraftCount:()=>p.value>0?1:0,discardDrafts:async()=>{f.value=!0,c.value=i(),await xe(),p.value=0,f.value=!1},saveCurrentDraft:y}),(v,w)=>{const k=C("el-form"),b=C("el-button");return r(),h("div",EN,[o("div",UN,[n(k,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(df,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),n(uf,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update",product:e.product,"product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product","product-edit-model"]),n(cf,{variant:c.value,"field-key":e.fieldKey,"mode-type":"update","product-edit-model":e.productEditModel,"is-group-mode":!0},null,8,["variant","field-key","product-edit-model"]),e.productEditModel.isTaxEnabled()?(r(),E(Af,{key:0,variant:c.value,"product-edit-model":e.productEditModel,"field-key":e.fieldKey,"mode-type":"update","is-group-mode":!0},null,8,["variant","product-edit-model","field-key"])):x("",!0)]),_:1})]),o("div",IN,[o("div",QN,[n(b,{onClick:w[0]||(w[0]=S=>s("closeModal"))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(b,{type:"primary",loading:e.productEditModel.saving,disabled:e.productEditModel.saving,onClick:y},{default:d(()=>[R(m(A(u)("Update %1$s variants",e.groupVariantIds.length)),1)]),_:1},8,["loading","disabled"])])])])}}},VN={class:"fct-adv-variant-table-wrap"},TN={class:"flex items-center flex-wrap justify-between gap-2 mb-3"},MN={class:"flex items-center flex-wrap gap-2 ml-auto"},LN=["aria-label"],RN={key:0,class:"fct-adv-filters-panel-wrap"},ON={class:"fct-adv-variant-search-row"},PN={key:0,class:"fct-adv-variant-filters"},HN=["aria-pressed"],NN={key:0,class:"fct-adv-filter-chip__count"},KN={class:"fct-adv-filter-options"},GN={class:"fct-adv-filter-options__header"},zN=["onClick"],jN={class:"fct-adv-filter-options__list"},qN={key:0,class:"fct-adv-filter-count"},YN={key:0,class:"fct-adv-variant-empty"},WN={class:"fct-adv-variant-empty__title"},JN={class:"fct-adv-variant-empty__hint"},XN=["aria-label"],ZN={class:"fct-grouped-variant-skeleton"},eK={key:4,class:"fct-table-draggable fct-product-pricing-table-mobile-wrap"},tK={class:"fct-product-pricing-table-mobile-item-inner"},aK={class:"fct-product-pricing-table-item"},lK={class:"media relative"},sK={class:"absolute top-0 left-0 w-full h-full z-10 rounded opacity-0"},nK={key:0,class:"absolute top-0 left-0 w-full h-full z-0 rounded"},oK=["src","alt"],iK=["src","alt"],rK={class:"fct-product-pricing-table-item-content"},dK={class:"title"},uK={key:0,class:"fct-variant-badge fct-variant-badge-inactive"},cK={class:"fct-adv-attr-breadcrumb"},AK={key:0,class:"compare-price"},pK={class:"price"},fK={class:"fct-product-pricing-table-item-action"},mK={class:"fct-btn-group sm"},hK=["aria-label"],_K={class:"fct-shared-variant-drawer__layout"},vK={key:0,class:"fct-shared-variant-nav"},gK={class:"fct-group-edit-aside"},yK={class:"fct-group-edit-aside__label flex items-center gap-2"},bK={class:"fct-group-edit-aside__title"},wK={class:"fct-group-edit-aside__hint"},CK={class:"fct-group-edit-aside__list"},kK={key:1,class:"fct-shared-variant-nav"},BK={class:"fct-shared-variant-nav__filters"},xK={key:0,class:"fct-shared-variant-nav__chips"},SK=["aria-pressed"],FK={key:0,class:"fct-adv-filter-chip__count"},$K={class:"fct-adv-filter-options"},EK={class:"fct-adv-filter-options__header"},UK=["onClick"],IK={class:"fct-adv-filter-options__list"},QK={class:"fct-shared-variant-drawer__content"},DK={key:0,class:"fct-compact-group-edit-summary"},VK={class:"fct-compact-group-edit-summary__title"},TK={class:"fct-compact-group-edit-summary__count"},MK={class:"fct-compact-group-edit-summary__list"},LK={key:0,class:"fct-compact-group-edit-bar"},RK=["disabled","aria-label","onClick"],OK={class:"fct-shared-variant-drawer__form"},PK={class:"fct-variant-dirty-dialog__header"},HK=["id"],NK={class:"dialog-footer"},KK={class:"fct-btn-group sm"},Ac=200,GK={__name:"AdvancedVariationTable",props:{product:Object,productEditModel:Object,attributeGroups:{type:Array,default:()=>[]},externalBusy:{type:Boolean,default:!1}},setup(e){var st,je,Xe,mt,et,It;const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),c=T(!1),p=T(new Set),f=T(new Set),_=T(0),g=()=>{_.value++},y=()=>{_.value=Math.max(0,_.value-1)},v=K(()=>_.value>0||l.value||t.externalBusy),w=T(((It=(et=(mt=(Xe=(je=(st=t.product)==null?void 0:st.detail)==null?void 0:je.other_info)==null?void 0:Xe.attribute_config)==null?void 0:mt[0])==null?void 0:et.variants)==null?void 0:It.length)||6),k=T(!1),b=T(null),S=T(null),$=T(!1),D=T(!1),F=T(!1),B=T(null),U=T(""),Q=T(""),V=T(null),I=T(""),M=T(!1),O=T({}),L=()=>{M.value=!M.value},H=()=>{O.value={},I.value="",M.value=!1},j=pe=>{pe.style.opacity="0",pe.style.overflow="hidden"},W=pe=>{const _e=pe.scrollHeight+"px";pe.style.height="0",pe.offsetHeight,pe.style.transition="height 0.25s ease, opacity 0.2s ease",pe.style.height=_e,pe.style.opacity="1"},G=pe=>{pe.style.height="",pe.style.overflow="",pe.style.transition="",pe.style.opacity=""},Z=pe=>{pe.style.height=pe.scrollHeight+"px",pe.style.overflow="hidden",pe.offsetHeight,pe.style.transition="height 0.25s ease, opacity 0.2s ease",pe.style.height="0",pe.style.opacity="0"},ne=pe=>{pe.style.height="",pe.style.overflow="",pe.style.transition="",pe.style.opacity=""},ce=K(()=>{var _e,Oe,Me;const pe=(Me=(Oe=(_e=t.product)==null?void 0:_e.detail)==null?void 0:Oe.other_info)==null?void 0:Me.attribute_config;return!pe||!Array.isArray(pe)?[]:pe.map(ct=>{const ee=parseInt(ct.group_id,10),Ne=t.attributeGroups.find(pt=>parseInt(pt.id,10)===ee);return Ne?{id:parseInt(Ne.id,10),title:Ne.title}:null}).filter(Boolean)}),z=K(()=>ce.value.map(pe=>{const _e=t.attributeGroups.find(Oe=>Oe.id===pe.id);return _e?{id:_e.id,title:_e.title,terms:_e.terms||[]}:null}).filter(Boolean)),ue=(pe,_e)=>{const Oe=O.value[pe];return Oe?Oe.has(_e):!1},ie=(pe,_e)=>{const Oe={...O.value},Me=Oe[pe]?new Set(Oe[pe]):new Set;Me.has(_e)?Me.delete(_e):Me.add(_e),Me.size===0?delete Oe[pe]:Oe[pe]=Me,O.value=Oe},J=pe=>{var _e;return((_e=O.value[pe])==null?void 0:_e.size)||0},N=pe=>{if(!O.value[pe])return;const _e={...O.value};delete _e[pe],O.value=_e},ae=()=>{O.value={},I.value=""},oe=K(()=>Object.keys(O.value).length>0||I.value.trim()!==""),fe=K(()=>oe.value&&t.product.variants.length>0&&re.value.length===0),re=K(()=>{let pe=t.product.variants;const _e=Object.keys(O.value);_e.length>0&&(pe=pe.filter(Me=>_e.every(ct=>{const ee=O.value[ct];if(!ee||ee.size===0)return!0;const Ne=(Me.attr_map||[]).find(pt=>parseInt(pt.group_id)===parseInt(ct));return Ne&&ee.has(parseInt(Ne.term_id))})));const Oe=I.value.trim().toLowerCase();return Oe&&(pe=pe.filter(Me=>(Me.variation_title||"").toLowerCase().includes(Oe)?!0:(Me.attr_map||[]).map(Ne=>{const pt=t.attributeGroups.find(xt=>xt.id===parseInt(Ne.group_id));if(!pt)return"";const De=(pt.terms||[]).find(xt=>xt.id===parseInt(Ne.term_id));return De?De.title.toLowerCase():""}).join(" ").includes(Oe))),pe}),Ee=K(()=>{if(!V.value)return null;const pe=parseInt(V.value,10),_e=t.attributeGroups.find(ct=>parseInt(ct.id,10)===pe);if(!_e)return null;const Oe=[],Me={};for(const ct of re.value){const ee=(ct.attr_map||[]).find(pt=>parseInt(pt.group_id,10)===pe);if(!ee)continue;const Ne=parseInt(ee.term_id,10);if(!Me[Ne]){const pt=(_e.terms||[]).find(De=>parseInt(De.id,10)===Ne);Me[Ne]={termId:Ne,title:pt?pt.title:"Unknown",variants:[]},Oe.push(Me[Ne])}Me[Ne].variants.push(ct)}return Oe}),ye=K(()=>!!V.value&&Ee.value&&Ee.value.length>0);be(Ee,pe=>{Array.isArray(pe)&&pe.length>0&&(w.value=pe.length)},{immediate:!0});const Ce=pe=>t.productEditModel.validateComparePrice(pe),ve=(pe,_e)=>{const Oe=Ee.value?Ee.value.find(Ne=>Ne.termId===pe):null;if(!Oe||_e===""||_e===null||_e===void 0)return;const Me=parseFloat(_e);if(isNaN(Me)||Me<0){q.error(u("Please enter a valid price."));return}const ct=Oe.variants.filter(Ne=>a.value.includes(Ne.id));(ct.length?ct:Oe.variants).forEach(Ne=>{const pt=t.product.variants.findIndex(De=>De.id===Ne.id);pt!==-1&&(t.productEditModel.onChangePricing("item_price",pt,Me),Ce(pt))})},Ue=pe=>{const _e=t.product.variants.findIndex(Me=>Me.id===pe.id);if(_e===-1)return;Ce(_e)||q.error(u("Compare price must be greater than or equal to item price."))};be(()=>t.product.variants,pe=>{Array.isArray(pe)&&(pe.forEach(_e=>{const Oe=_e.media?_e.media.meta_value||_e.media:[];_e.media=Array.isArray(Oe)?Oe:[]}),c.value&&(c.value=!1,Gt()))},{immediate:!0,deep:!1}),be(()=>{var pe;return(pe=ce.value[0])==null?void 0:pe.id},pe=>{if(ce.value.length<2||!pe){V.value=null;return}V.value=parseInt(pe,10)},{immediate:!0}),be(()=>ce.value.length,pe=>{pe<2&&(V.value=null)}),be([V,ce],([pe,_e])=>{var ct;if(!Array.isArray(_e)||_e.length<2)return;const Oe=(ct=_e[0])==null?void 0:ct.id;if(!Oe)return;const Me=_e.map(ee=>parseInt(ee.id,10));(pe==null||!Me.includes(parseInt(pe,10)))&&(V.value=parseInt(Oe,10))},{deep:!0});const Ke=(pe,_e,Oe)=>{const Me=parseFloat(Oe)||0,ct=t.product.variants.findIndex(ee=>ee.id===pe.id);ct!==-1&&t.productEditModel.onChangePricing(_e,ct,Me)},We=(pe,_e)=>{const Oe=pe.media;pe.media=_e,g(),Ae.post(`products/variants/${pe.id}/setMedia`,{media:_e}).then(Me=>{q.success(Me.message||u("Thumbnail set successfully"))}).catch(Me=>{var ct;pe.media=Oe,q.error(((ct=Me==null?void 0:Me.data)==null?void 0:ct.message)||(Me==null?void 0:Me.message)||u("Failed to save thumbnail"))}).finally(y)},Be=async(pe,_e)=>{const Oe=pe.variants.filter(pt=>a.value.includes(pt.id)),Me=Oe.length?Oe:pe.variants;Me.forEach(pt=>{pt.media=_e});const ct=Me.map(pt=>pt.id),ee=5;let Ne=0;g();try{for(let pt=0;pt<ct.length;pt+=ee){const De=await Promise.allSettled(ct.slice(pt,pt+ee).map(xt=>Ae.post(`products/variants/${xt}/setMedia`,{media:_e})));Ne+=De.filter(xt=>xt.status==="rejected").length}}finally{y()}Ne===0?q.success(u("Thumbnail applied to %1$s variants",Me.length)):q.error(u("Failed to apply thumbnail to %1$s variants",Ne))},$e=K({get(){const pe=re.value.map(_e=>_e.id);return pe.length===0?!1:pe.every(_e=>a.value.includes(_e))},set(pe){const _e=re.value.map(Oe=>Oe.id);if(pe){const Oe=new Set([...a.value,..._e]);a.value=Array.from(Oe)}else{const Oe=new Set(_e);a.value=a.value.filter(Me=>!Oe.has(Me))}}}),He=K(()=>{const pe=re.value.map(Oe=>Oe.id);if(pe.length===0)return!1;const _e=pe.filter(Oe=>a.value.includes(Oe)).length;return _e>0&&_e<pe.length}),Re=()=>{if(l.value||!U.value||a.value.length===0)return;if(U.value==="delete"){Mn.confirmDeleteWithInput("delete",u("Are you sure you want to delete %1$s variants?",a.value.length)).then(()=>{yt()}).catch(()=>{});return}const pe=U.value==="set_price";let _e=null;if(pe&&(_e=parseFloat(Q.value),Q.value===""||isNaN(_e)||_e<0)){q.error(u("Please enter a valid price."));return}if(pe&&a.value.slice(0,Ac).map(ct=>t.product.variants.find(ee=>ee.id===ct)).filter(ct=>{if(!ct)return!1;const ee=parseFloat(ct.compare_price);return!isNaN(ee)&&ee>0&&ee<_e}).length){q.error(u("Compare price must be greater than or equal to item price."));return}const Oe=a.value.slice(0,Ac).map(Me=>{const ct={id:Me};return U.value==="set_price"?ct.item_price=_e:U.value==="set_status_active"?ct.item_status="active":U.value==="set_status_inactive"&&(ct.item_status="inactive"),ct});l.value=!0,t.productEditModel.bulkUpdateVariants(Oe).then(Me=>{q.success((Me==null?void 0:Me.message)||u("Variants updated successfully")),t.productEditModel.data.reloader(),a.value=[],U.value="",Q.value=""}).catch(Me=>{var ct;q.error(((ct=Me==null?void 0:Me.data)==null?void 0:ct.message)||u("Bulk action failed"))}).finally(()=>{l.value=!1})},yt=async()=>{const pe=[...a.value],_e=5;g();try{for(let Oe=0;Oe<pe.length;Oe+=_e)await Promise.all(pe.slice(Oe,Oe+_e).map(Me=>Ae.delete(`products/variants/${Me}`)));q.success(u("Variants deleted successfully")),t.productEditModel.data.reloader(),a.value=[]}catch{q.error(u("Failed to delete some variants"))}finally{y()}},gt=pe=>{if(!pe||!pe.id)return;const _e=pe.item_status==="inactive"?"active":"inactive";g(),t.productEditModel.bulkUpdateVariants([{id:pe.id,item_status:_e}]).then(Oe=>{pe.item_status=_e,q.success((Oe==null?void 0:Oe.message)||u("Variant updated successfully")),t.productEditModel.data.reloader()}).catch(Oe=>{var Me;q.error(((Me=Oe==null?void 0:Oe.data)==null?void 0:Me.message)||u("Failed to update variant"))}).finally(y)},Rt=pe=>{const _e=pe.attr_map||[];return _e.length?_e.map(Me=>{const ct=t.attributeGroups.find(Ne=>Ne.id===parseInt(Me.group_id));if(!ct)return null;const ee=(ct.terms||[]).find(Ne=>Ne.id===parseInt(Me.term_id));return ee?ee.title:null}).filter(Boolean).join(" / "):""},Tt=(pe,_e)=>{const Oe=pe.attr_map||[];if(!Oe.length)return"";const Me=parseInt(_e);return Oe.filter(ee=>parseInt(ee.group_id)!==Me).map(ee=>{const Ne=t.attributeGroups.find(De=>De.id===parseInt(ee.group_id));if(!Ne)return null;const pt=(Ne.terms||[]).find(De=>De.id===parseInt(ee.term_id));return pt?pt.title:null}).filter(Boolean).join(" / ")},Dt=pe=>{const _e=t.product.variants.findIndex(Oe=>Oe.id===pe.id);_e!==-1&&(t.productEditModel.setValidationErrors({}),b.value=_e,k.value=!0)},_t=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,k.value=!1,b.value=null,s.value=!1,i.value=null,c.value=!1},Gt=()=>{t.productEditModel.setValidationErrors({}),F.value=!1,s.value=!1,i.value=null,p.value=new Set},bt=K(()=>!i.value||!i.value.items?[]:i.value.items.filter(pe=>p.value.has(pe.key)).map(pe=>pe.variant&&pe.variant.id?pe.variant.id:null).filter(Boolean)),St=pe=>{const _e=new Set(p.value);_e.has(pe)?_e.delete(pe):_e.add(pe),p.value=_e},Pt=()=>{$.value=!1,D.value=!1,B.value=null},Ht=()=>{var pe,_e;return((_e=(pe=S.value)==null?void 0:pe.hasDirtyDrafts)==null?void 0:_e.call(pe))??!1},Qt=pe=>{F.value=pe},ht=()=>{const pe=B.value;if(Pt(),!!pe&&pe.type==="close"){if(typeof pe.done=="function"){pe.done();return}_t()}},qt=()=>{Pt()},ge=async()=>{var pe,_e;await((_e=(pe=S.value)==null?void 0:pe.discardDrafts)==null?void 0:_e.call(pe)),F.value=!1,ht()},Fe=async()=>{var _e;if(!((_e=S.value)!=null&&_e.saveCurrentDraft)||D.value)return;if(D.value=!0,await S.value.saveCurrentDraft()){F.value=!1,ht();return}D.value=!1,qt()},ot=pe=>{if(!Ht()){pe();return}B.value={type:"close",done:pe},$.value=!0},wt=()=>{if(s.value){ot(Gt);return}ot(_t)},kt=pe=>{if(F.value=!1,t.productEditModel.setValidationErrors({}),s.value){c.value=!0,t.productEditModel.data.reloader();return}pe&&typeof pe.index=="number"&&pe.index>=0&&(b.value=pe.index)},Xt=pe=>{const _e=il.value?il.value.find(Oe=>Oe.termId===pe.termId):null;_e&&vt(_e)},vt=pe=>{if(!pe||!pe.items||!pe.items.length||F.value)return;i.value=pe,p.value=new Set(pe.items.map(Oe=>Oe.key)),s.value=!0;const _e=pe.items[0];t.productEditModel.setValidationErrors({}),b.value=typeof _e.index=="number"?_e.index:null,k.value=!0},ea=T(typeof window<"u"?window.innerWidth:1280);let ta=null;Ie(()=>{typeof window>"u"||(ta=()=>{ea.value=window.innerWidth},window.addEventListener("resize",ta))}),Bt(()=>{ta&&(window.removeEventListener("resize",ta),ta=null)});const zt=K(()=>ea.value<=900),wa=K(()=>ea.value<=640?"100%":ea.value<=900?"95%":"920px"),qa=K(()=>{const pe=new Map;return(t.product.variants||[]).forEach((_e,Oe)=>{_e&&_e.id!=null&&pe.set(_e.id,Oe)}),(re.value||[]).map(_e=>{const Oe=pe.get(_e==null?void 0:_e.id);return{key:(_e==null?void 0:_e.id)??`variant-${Oe}`,index:Oe,variant:_e,label:Rt(_e)||(_e==null?void 0:_e.variation_title)||`${u("Variant")} ${Oe+1}`,meta:(_e==null?void 0:_e.item_price)!==void 0&&(_e==null?void 0:_e.item_price)!==null&&(_e==null?void 0:_e.item_price)!==""?Kt(_e.item_price,!0):u("No price set"),modeType:"update",isDraft:!1}})}),il=K(()=>{if(!Ee.value||Ee.value.length===0)return null;const pe=new Map;(t.product.variants||[]).forEach((Me,ct)=>{Me&&Me.id!=null&&pe.set(Me.id,ct)});const _e=V.value,Oe=Me=>{const ct=pe.get(Me==null?void 0:Me.id),ee=_e?Tt(Me,_e):Rt(Me);return{key:(Me==null?void 0:Me.id)??`variant-${ct}`,index:ct,variant:Me,label:ee||(Me==null?void 0:Me.variation_title)||`${u("Variant")} ${ct+1}`,meta:(Me==null?void 0:Me.item_price)!==void 0&&(Me==null?void 0:Me.item_price)!==null&&(Me==null?void 0:Me.item_price)!==""?Kt(Me.item_price,!0):u("No price set"),modeType:"update",isDraft:!1}};return Ee.value.map(Me=>({termId:Me.termId,title:Me.title,count:Me.variants.length,items:Me.variants.map(Oe)}))}),Ya=K(()=>{var _e;const pe=(_e=t.product.variants)==null?void 0:_e[b.value];return(pe==null?void 0:pe.id)??`variant-${b.value??0}`}),ma=(pe,_e)=>{const Oe=parseInt(_e,10),Me=(pe.attr_map||[]).find(pt=>parseInt(pt.group_id,10)===Oe);if(!Me)return"";const ct=t.attributeGroups.find(pt=>parseInt(pt.id,10)===Oe);if(!ct)return"";const ee=parseInt(Me.term_id,10),Ne=(ct.terms||[]).find(pt=>parseInt(pt.id,10)===ee);return Ne?Ne.title:""},X=K(()=>{var _e;if(b.value===null)return{group:"",detail:""};const pe=(_e=t.product.variants)==null?void 0:_e[b.value];return pe?V.value?{group:ma(pe,V.value),detail:Tt(pe,V.value)}:{group:"",detail:Rt(pe)}:{group:"",detail:""}}),we=pe=>{pe&&(F.value&&Ya.value!==pe.key||typeof pe.index=="number"&&(t.productEditModel.setValidationErrors({}),b.value=pe.index))},le=pe=>{var _e,Oe;return!!((_e=pe==null?void 0:pe.variant)!=null&&_e.id)&&["publish","private"].includes((Oe=t.product)==null?void 0:Oe.post_status)},he=pe=>`${ze.get("frontend_url")}=instant_checkout&item_id=${pe.variant.id}&quantity=1`,Ye=(pe,_e)=>{var Oe,Me;if(!(!_e||!pe)){if(pe==="copy_variation_id"&&((Oe=_e.variant)!=null&&Oe.id)){as.copy(String(_e.variant.id),{successMessage:u("Variation ID copied to clipboard")});return}if(pe==="copy_direct_checkout"&&le(_e)){as.copy(he(_e),{successMessage:u("Direct checkout link copied to clipboard")});return}pe==="toggle_status"&&((Me=_e.variant)!=null&&Me.id)&>(_e.variant)}};return(pe,_e)=>{const Oe=C("el-button"),Me=C("el-input"),ct=C("el-checkbox"),ee=C("el-popover"),Ne=C("el-dropdown-item"),pt=C("el-dropdown-menu"),De=C("el-dropdown"),xt=C("el-drawer"),Wa=C("el-dialog");return r(),h("div",VN,[o("div",TN,[n(nH,{product:e.product,"attribute-groups":e.attributeGroups,modelValue:V.value,"onUpdate:modelValue":_e[0]||(_e[0]=se=>V.value=se)},null,8,["product","attribute-groups","modelValue"]),o("div",MN,[M.value?(r(),E(Oe,{key:1,onClick:H},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})):(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-panel-toggle","aria-label":A(u)("Search and filter variants"),onClick:L},[n(Y,{name:"Search"}),n(Y,{name:"Filter"})],8,LN))])]),n(Xl,{onBeforeEnter:j,onEnter:W,onAfterEnter:G,onLeave:Z,onAfterLeave:ne},{default:d(()=>[M.value?(r(),h("div",RN,[o("div",ON,[n(Me,{modelValue:I.value,"onUpdate:modelValue":_e[1]||(_e[1]=se=>I.value=se),placeholder:A(u)("Search variants"),size:"small",clearable:""},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),z.value.length>0?(r(),h("div",PN,[(r(!0),h(P,null,te(z.value,se=>(r(),E(ee,{key:se.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":J(se.id)>0}]),"aria-pressed":J(se.id)>0,type:"button"},[o("span",null,m(se.title),1),J(se.id)>0?(r(),h("span",NN,m(J(se.id)),1)):x("",!0),n(Y,{name:"ChevronDown"})],10,HN)]),default:d(()=>[o("div",KN,[o("div",GN,[o("span",null,m(A(u)("Filter by %1$s",se.title)),1),J(se.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:me=>N(se.id)},m(A(u)("Clear")),9,zN)):x("",!0)]),o("ul",jN,[(r(!0),h(P,null,te(se.terms,me=>(r(),h("li",{key:me.id},[n(ct,{"model-value":ue(se.id,me.id),onChange:Qe=>ie(se.id,me.id)},{default:d(()=>[R(m(me.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128)),oe.value&&!fe.value?(r(),h("span",qN,m(A(u)("Showing %1$s of %2$s variants",re.value.length,e.product.variants.length)),1)):x("",!0),oe.value?(r(),h("button",{key:1,type:"button",class:"fct-adv-filter-clear-all",onClick:ae},m(A(u)("Clear filters")),1)):x("",!0)])):x("",!0)])):x("",!0)]),_:1}),n(rH,{"selected-count":a.value.length,"bulk-action":U.value,"onUpdate:bulkAction":_e[2]||(_e[2]=se=>U.value=se),"bulk-value":Q.value,"onUpdate:bulkValue":_e[3]||(_e[3]=se=>Q.value=se),saving:l.value,onApply:Re,onClear:_e[4]||(_e[4]=se=>a.value=[])},null,8,["selected-count","bulk-action","bulk-value","saving"]),fe.value?(r(),h("div",YN,[n(Y,{name:"Search"}),o("p",WN,m(A(u)("No variants match your filters")),1),o("p",JN,m(A(u)("Try a different search term or clear some filters.")),1),n(Oe,{size:"small",onClick:ae},{default:d(()=>[R(m(A(u)("Clear filters")),1)]),_:1})])):x("",!0),v.value&&!fe.value?(r(),h("div",{key:1,class:"fct-grouped-variant-table hide-on-mobile",role:"status","aria-live":"polite","aria-label":pe.$t("Updating variants")},[o("table",null,[_e[16]||(_e[16]=o("colgroup",null,[o("col",{width:"40"}),o("col",{width:"50"}),o("col"),o("col",{width:"160"}),o("col",{width:"160"}),o("col",{width:"100"})],-1)),o("thead",null,[o("tr",null,[_e[13]||(_e[13]=o("th",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1)),o("th",null,m(pe.$t("Image")),1),o("th",null,m(pe.$t("Variant")),1),o("th",null,m(pe.$t("Price")),1),o("th",null,m(pe.$t("Compare at price")),1),_e[14]||(_e[14]=o("th",null,null,-1))])]),o("tbody",ZN,[(r(!0),h(P,null,te(Math.min(w.value,8),se=>(r(),h("tr",{key:"wrap-skel-"+se},_e[15]||(_e[15]=[o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-check"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-img"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-title"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-price"})],-1),o("td",null,[o("span",{class:"fct-skel-block fct-skel-row-action"})],-1)])))),128))])])],8,XN)):ye.value&&!fe.value?(r(),E(uN,{key:2,product:e.product,"product-edit-model":e.productEditModel,"attribute-groups":e.attributeGroups,"grouped-variants":Ee.value,"selected-variants":a.value,"is-all-selected":$e.value,"is-selection-indeterminate":He.value,"group-by-id":V.value,"expanded-groups":f.value,"onUpdate:selectedVariants":_e[5]||(_e[5]=se=>a.value=se),"onUpdate:isAllSelected":_e[6]||(_e[6]=se=>$e.value=se),"onUpdate:expandedGroups":_e[7]||(_e[7]=se=>f.value=se),onEditVariant:Dt,onEditGroup:Xt,onToggleStatus:gt,onInlinePriceChange:Ke,onInlinePriceCommit:Ue,onMediaUploaded:We,onGroupPriceApply:ve,onGroupMediaUploaded:Be},null,8,["product","product-edit-model","attribute-groups","grouped-variants","selected-variants","is-all-selected","is-selection-indeterminate","group-by-id","expanded-groups"])):!ye.value&&!fe.value?(r(),E($N,{key:3,product:e.product,"product-edit-model":e.productEditModel,variants:re.value,"attribute-groups":e.attributeGroups,"selected-variants":a.value,"is-all-selected":$e.value,"is-selection-indeterminate":He.value,"onUpdate:selectedVariants":_e[8]||(_e[8]=se=>a.value=se),"onUpdate:isAllSelected":_e[9]||(_e[9]=se=>$e.value=se),onEditVariant:Dt,onToggleStatus:gt,onInlinePriceChange:Ke,onInlinePriceCommit:Ue,onMediaUploaded:We},null,8,["product","product-edit-model","variants","attribute-groups","selected-variants","is-all-selected","is-selection-indeterminate"])):x("",!0),ye.value?x("",!0):(r(),h("div",eK,[(r(!0),h(P,null,te(re.value,se=>{var me,Qe;return r(),h("div",{key:se.id,class:"fct-product-pricing-table-mobile-row"},[o("div",tK,[o("div",aK,[o("div",lK,[o("div",sK,[n(Rp,{previewImage:!1,showList:!1,multiple:!1,showDeleteButton:!1,attachments:[],onMediaUploaded:Le=>We(se,Le)},null,8,["onMediaUploaded"])]),((me=se==null?void 0:se.media)==null?void 0:me.length)>0?(r(),h("div",nK,[o("img",{src:(Qe=se.media[0])==null?void 0:Qe.url,alt:se.variation_title,class:"!object-contain rounded border border-solid border-gray-outline dark:border-dark-400"},null,8,oK)])):(r(),h("img",{key:1,src:pe.appVars.asset_url+"images/empty-image.svg",alt:A(u)("No Image")},null,8,iK))]),o("div",rK,[o("div",dK,[R(m(se.variation_title)+" ",1),se.item_status==="inactive"?(r(),h("span",uK,m(A(u)("Inactive")),1)):x("",!0)]),o("div",cK,m(Rt(se)||"—"),1),o("ul",null,[o("li",null,[se.compare_price?(r(),h("div",AK,m(A(Kt)(se.compare_price,!0)),1)):x("",!0),o("div",pK,m(A(Kt)(se.item_price,!0)),1)])])])]),o("div",fK,[o("div",mK,[n(at,{size:"small",tag:"button",onClick:Le=>Dt(se)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(De,{class:"fct-more-option-wrap","popper-class":"fct-dropdown",trigger:"click",onCommand:Le=>{Le==="toggle_status"&>(se)}},{dropdown:d(()=>[n(pt,null,{default:d(()=>[n(Ne,null,{default:d(()=>[se.id?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline",text:String(se.id),showMode:"icon_with_text",buttonText:A(u)("Copy Variation ID")},null,8,["text","buttonText"])):x("",!0)]),_:2},1024),se.id?(r(),E(Ne,{key:0,command:"toggle_status",class:de({"item-destructive":se.item_status!=="inactive"})},{default:d(()=>[n(Y,{name:se.item_status==="inactive"?"CheckCircle":"InActive"},null,8,["name"]),R(" "+m(se.item_status==="inactive"?A(u)("Set Active"):A(u)("Set Inactive")),1)]),_:2},1032,["class"])):x("",!0)]),_:2},1024)]),default:d(()=>[o("button",{type:"button",class:"more-btn","aria-label":A(u)("Variation actions")},[n(Y,{name:"More"})],8,hK)]),_:2},1032,["onCommand"])])])])])}),128))])),n(xt,{modelValue:k.value,"onUpdate:modelValue":_e[11]||(_e[11]=se=>k.value=se),title:A(u)("Pricing"),size:wa.value,"append-to-body":!0,"close-on-click-modal":!0,"close-on-press-escape":!1,"destroy-on-close":!0,"before-close":ot,class:"fct-shared-variant-drawer",onClose:_t},{default:d(()=>{var se,me,Qe,Le,qe,At;return[o("div",_K,[!zt.value&&s.value?(r(),h("aside",vK,[n(zr,{product:e.product},null,8,["product"]),o("div",gK,[o("p",yK,[R(m(A(u)("Editing group"))+": ",1),o("span",bK,m((se=i.value)==null?void 0:se.title),1)]),o("p",wK,m(A(u)("Changes will apply to %1$s of %2$s variants in this group.",bt.value.length,(me=i.value)==null?void 0:me.count)),1),o("ul",CK,[(r(!0),h(P,null,te((Qe=i.value)==null?void 0:Qe.items,tt=>(r(),h("li",{key:tt.key,class:"fct-group-edit-aside__item"},[n(ct,{"model-value":p.value.has(tt.key),onChange:Ut=>St(tt.key)},{default:d(()=>[R(m(tt.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])])):zt.value?x("",!0):(r(),h("aside",kK,[n(zr,{product:e.product},null,8,["product"]),o("div",BK,[n(Me,{modelValue:I.value,"onUpdate:modelValue":_e[10]||(_e[10]=tt=>I.value=tt),placeholder:A(u)("Search variants"),size:"small",clearable:"",class:"fct-shared-variant-nav__search"},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),z.value.length>0?(r(),h("div",xK,[(r(!0),h(P,null,te(z.value,tt=>(r(),E(ee,{key:"nav-chip-"+tt.id,placement:"bottom-start",width:220,trigger:"click","popper-class":"fct-adv-filter-popover"},{reference:d(()=>[o("button",{class:de(["fct-adv-filter-chip",{"is-active":J(tt.id)>0}]),"aria-pressed":J(tt.id)>0,type:"button"},[o("span",null,m(tt.title),1),J(tt.id)>0?(r(),h("span",FK,m(J(tt.id)),1)):x("",!0),n(Y,{name:"ChevronDown"})],10,SK)]),default:d(()=>[o("div",$K,[o("div",EK,[o("span",null,m(A(u)("Filter by %1$s",tt.title)),1),J(tt.id)>0?(r(),h("button",{key:0,type:"button",class:"fct-adv-filter-clear",onClick:Ut=>N(tt.id)},m(A(u)("Clear")),9,UK)):x("",!0)]),o("ul",IK,[(r(!0),h(P,null,te(tt.terms,Ut=>(r(),h("li",{key:Ut.id},[n(ct,{"model-value":ue(tt.id,Ut.id),onChange:jt=>ie(tt.id,Ut.id)},{default:d(()=>[R(m(Ut.title),1)]),_:2},1032,["model-value","onChange"])]))),128))])])]),_:2},1024))),128))])):x("",!0),oe.value?(r(),h("button",{key:1,type:"button",class:"fct-shared-variant-nav__clear",onClick:ae},m(A(u)("Clear filters")),1)):x("",!0)]),n(pf,{items:qa.value,"grouped-items":il.value,"active-key":Ya.value,"is-dirty":F.value,"is-saving":D.value,"drawer-mode":"update",product:e.product,"product-edit-model":e.productEditModel,"can-copy-direct-checkout":le,onSelect:we,onSave:Fe,onCommand:Ye,onEditGroup:vt},null,8,["items","grouped-items","active-key","is-dirty","is-saving","product","product-edit-model"])])),o("div",QK,[zt.value&&s.value?(r(),h("div",DK,[o("div",VK,[R(m(A(u)("Editing group"))+": ",1),o("span",null,m((Le=i.value)==null?void 0:Le.title),1)]),o("div",TK,m(A(u)("Changes will apply to %1$s of %2$s variants in this group.",bt.value.length,(qe=i.value)==null?void 0:qe.count)),1),o("ul",MK,[(r(!0),h(P,null,te((At=i.value)==null?void 0:At.items,tt=>(r(),h("li",{key:tt.key},[n(ct,{"model-value":p.value.has(tt.key),onChange:Ut=>St(tt.key)},{default:d(()=>[R(m(tt.label),1)]),_:2},1032,["model-value","onChange"])]))),128))])])):zt.value?(r(),h(P,{key:1},[il.value&&il.value.length?(r(),h("div",LK,[(r(!0),h(P,null,te(il.value,tt=>(r(),h("button",{key:"cge-"+tt.termId,type:"button",class:"fct-compact-group-edit-bar__btn",disabled:F.value,"aria-label":A(u)("Edit group %1$s",tt.title),onClick:Ut=>vt(tt)},[n(Y,{name:"Edit"}),o("span",null,m(tt.title),1)],8,RK))),128))])):x("",!0),n(ff,{items:qa.value,"active-key":Ya.value,"is-dirty":F.value,onSelect:we},null,8,["items","active-key","is-dirty"])],64)):x("",!0),o("div",OK,[k.value&&b.value!==null&&!s.value?(r(),E(Vd,{ref_key:"pricingFormRef",ref:S,key:Ya.value,index:b.value,modeType:"update",fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,"variant-title-info":X.value,onCreateOrUpdateVariant:kt,onCloseModal:wt,onDirtyStateChange:Qt},null,8,["index","product","productEditModel","variant-title-info"])):k.value&&s.value&&i.value?(r(),E(DN,{ref_key:"pricingFormRef",ref:S,key:`group-${i.value.termId}`,"group-variant-ids":bt.value,fieldKey:"variants",product:e.product,productEditModel:e.productEditModel,onCreateOrUpdateVariant:kt,onCloseModal:wt,onDirtyStateChange:Qt},null,8,["group-variant-ids","product","productEditModel"])):x("",!0)])])])]}),_:1},8,["modelValue","title","size"]),n(Wa,{modelValue:$.value,"onUpdate:modelValue":_e[12]||(_e[12]=se=>$.value=se),"close-on-click-modal":!1,"close-on-press-escape":!D.value,"show-close":!D.value,class:"fct-variant-dirty-dialog",onClose:qt},{header:d(({titleId:se})=>[o("div",PK,[o("h3",{id:se},m(A(u)("Unsaved changes")),9,HK)])]),default:d(()=>[o("p",null,m(A(u)("You have unsaved variation changes. Discard them or save before continuing.")),1),o("div",NK,[o("div",KK,[n(Oe,{disabled:D.value,size:"small",onClick:qt},{default:d(()=>[R(m(A(u)("Continue editing")),1)]),_:1},8,["disabled"]),n(Oe,{disabled:D.value,size:"small",onClick:ge},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(Oe,{type:"primary",loading:D.value,size:"small",onClick:Fe},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])]),_:1},8,["modelValue","close-on-press-escape","show-close"])])}}},zK=["src","alt"],jK={class:"fct-swatch-tag-label"},qK=["aria-label","onClick","onKeydown"],or={__name:"DraggableOptionValues",props:{modelValue:{type:Array,default:()=>[]},terms:{type:Array,default:()=>[]},type:{type:String,default:"options"}},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=t,s=(y,v)=>String(y)===String(v),i=K({get:()=>a.modelValue,set:y=>l("update:modelValue",y)}),c=y=>a.terms.find(v=>s(v.id,y))||null,p=y=>{if(typeof y=="string")return y;const v=c(y);return v?v.title:String(y)},f=y=>{const v=c(y);return v&&v.settings&&v.settings.color?{background:v.settings.color}:{}},_=y=>{const v=c(y);return v&&v.settings&&v.settings.image?v.settings.image:""},g=y=>{l("update:modelValue",a.modelValue.filter(v=>!s(v,y)))};return(y,v)=>(r(),E(A(sn),{modelValue:i.value,"onUpdate:modelValue":v[2]||(v[2]=w=>i.value=w),handle:".fct-value-tag-handle",disabled:i.value.length<2,class:"fct-value-tag-list",tag:"div"},{default:d(()=>[(r(!0),h(P,null,te(i.value,w=>(r(),h("span",{key:String(w),class:"fct-swatch-tag"},[i.value.length>1?(r(),h("span",{key:0,class:"fct-value-tag-handle",onMousedown:v[0]||(v[0]=Ge(()=>{},["stop"]))},[n(Y,{name:"ReorderDotsVertical"})],32)):x("",!0),e.type==="color"?(r(),h("span",{key:1,class:"fct-swatch-tag-dot",style:ra(f(w))},null,4)):e.type==="image"?(r(),h("img",{key:2,class:"fct-swatch-tag-img",src:_(w),alt:p(w)},null,8,zK)):x("",!0),o("span",jK,m(p(w)),1),o("span",{class:"fct-swatch-tag-close",role:"button",tabindex:"0","aria-label":A(u)("Remove"),onMousedown:v[1]||(v[1]=Ge(()=>{},["stop"])),onClick:Ge(k=>g(w),["stop"]),onKeydown:xa(Ge(k=>g(w),["prevent"]),["enter","space"])},"×",40,qK)]))),128))]),_:1},8,["modelValue","disabled"]))}},YK={class:"fct-add-term-modal"},WK={class:"dialog-footer"},JK={__name:"AddTermModal",props:{groupId:{type:[String,Number],required:!0},group:{type:Object,default:()=>({})},initialTitle:{type:String,default:""}},emits:["isTermCreatingDone"],setup(e,{emit:t}){const a=e,l=t,s=T(!1),i=T({}),c=T(null),p=K(()=>{const y=a.group&&a.group.settings;return y&&y.type?y.type:"options"}),f=T({title:(a.initialTitle||"").trim(),settings:{color:"",image:""}}),_=K(()=>(f.value.title||"").trim()!==""),g=()=>{if(!_.value||s.value)return;s.value=!0,i.value={};const y={terms:[{title:f.value.title.trim(),settings:{color:f.value.settings.color||"",image:f.value.settings.image||""}}]};Ae.post("options/attr/group/"+a.groupId+"/terms",y).then(v=>{ln(v.message);const w=Array.isArray(v.data)?v.data[0]:v.data;l("isTermCreatingDone",w)}).catch(v=>{var w;(v==null?void 0:v.status_code)==422&&v.data?i.value=v.data:q.error(((w=v==null?void 0:v.data)==null?void 0:w.message)||(v==null?void 0:v.message)||u("Failed to add the term."))}).finally(()=>{s.value=!1})};return(y,v)=>{const w=C("el-button");return r(),h("div",YK,[n(Bo,{ref_key:"formRef",ref:c,term:f.value,"group-type":p.value,"show-remove-button":!1,"validation-errors":i.value,"field-key":"terms.0",onSubmit:g,onRemove:v[0]||(v[0]=k=>l("isTermCreatingDone"))},null,8,["term","group-type","validation-errors"]),o("div",WK,[n(w,{disabled:!_.value||s.value,loading:s.value,type:"primary",onClick:g},{default:d(()=>[R(m(A(u)("Add term")),1)]),_:1},8,["disabled","loading"])])])}}},pc=10,XK=async(e,t,a)=>{const l=[];let s="";for(let i=0;i<a.length;i+=pc){const c=a.slice(i,i+pc);try{const p=await e("options/attr/group/"+t+"/terms",{terms:c.map(f=>({title:f}))});l.push(...(p==null?void 0:p.data)||[]),s=(p==null?void 0:p.message)||s}catch(p){return{created:l,message:s,error:p}}}return{created:l,message:s,error:null}},ZK={class:"fct-advanced-variation-config"},eG={class:"fct-adv-var-attributes"},tG={key:0,class:"fct-adv-var-loading"},aG={key:1,class:"fct-adv-var-empty-hint"},lG={key:2,class:"fct-adv-var-empty-state"},sG={class:"fct-adv-var-empty-state__icon","aria-hidden":"true"},nG={class:"fct-adv-var-empty-state__copy"},oG=["aria-expanded","onClick","onKeydown"],iG={class:"fct-option-card-summary"},rG={class:"fct-option-card-summary-header"},dG={key:0,class:"fct-option-card-chips"},uG=["src","alt"],cG={class:"fct-option-value-chip-label"},AG=["aria-label","title","onClick"],pG={key:0,class:"fct-option-card-body"},fG={class:"fct-option-label"},mG={key:0,class:"mt-2"},hG={key:1,class:"fct-option-error"},_G={class:"fct-option-label"},vG={key:0,class:"fct-select-all-header"},gG={class:"fct-option-item"},yG={class:"fct-option-item"},bG={key:1,class:"fct-picker-inline-form-body"},wG={class:"fct-picker-inline-form-actions"},CG={key:1,class:"fct-option-field-values"},kG={class:"fct-option-empty-default"},BG={key:0,class:"fct-select-all-header"},xG={class:"fct-color-option"},SG={key:1,class:"fct-picker-inline-form-body"},FG={class:"fct-picker-inline-form-actions"},$G={key:2,class:"fct-option-field-values"},EG={class:"fct-option-empty-default"},UG={key:0,class:"fct-select-all-header"},IG={class:"fct-image-option"},QG=["src"],DG={key:1,class:"fct-picker-inline-form-body"},VG={class:"fct-picker-inline-form-actions"},TG={key:3,class:"fct-option-error"},MG={class:"fct-option-card-actions"},LG=["title"],RG={key:5,class:"fct-adv-order-save-bar"},OG={class:"fct-adv-order-save-bar__msg"},PG={class:"fct-adv-order-save-bar__actions"},HG={key:6},NG={key:0,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},KG={key:1,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},GG={key:2,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},zG={key:3,class:"fct-adv-var-generate-info fct-adv-var-generate-error"},bo=200,ir=10,rr=100,fc=200,jG={__name:"AdvancedVariationConfig",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T([]),l=T([]),s=T(!1),i=T(!1),c=T(!1),p=T(null),f=T(!1),_=T(null),g=T(!1),y=T(null),v=T(null),w=T([]),k=T([]),b=T(""),S=se=>JSON.stringify(se.map(me=>({group_id:me.group_id||null,variants:[...me.variants||[]].map(Qe=>String(Qe))}))),$=()=>{k.value=l.value.map(se=>({group_id:se.group_id||null,title:se.title||"",variants:Array.isArray(se.variants)?[...se.variants]:[]})),b.value=S(l.value)},D=K(()=>{const se=l.value.filter(me=>me.group_id&&Array.isArray(me.variants)&&me.variants.length>0);return se.length===0?b.value!==S([]):S(se)!==b.value}),F=K(()=>l.value.length===0?u("All options removed. Save to delete all variations."):u("Option config changed. Save to update variants.")),B=K(()=>{if(p.value===null||!v.value)return!1;const se=l.value[p.value];if(!se)return!1;if(String(se.group_id||"")!==String(v.value.group_id||"")||(se.title||"")!==(v.value.title||""))return!0;const me=Array.isArray(se.variants)?se.variants:[],Qe=Array.isArray(v.value.variants)?v.value.variants:[];if(me.length!==Qe.length)return!0;const Le=me.map(At=>String(At)),qe=Qe.map(At=>String(At));return Le.some((At,tt)=>At!==qe[tt])});Ie(()=>{Q(),U()}),Bt(()=>{Ne()});const U=()=>{c.value=!0,Ae.get("options/attr/groups/library").then(se=>{a.value=(se.groups||[]).slice(0,fc),l.value.forEach(me=>O(me.group_id))}).catch(se=>{var me;q.error(((me=se==null?void 0:se.data)==null?void 0:me.message)||u("Failed to load attribute groups"))}).finally(()=>{c.value=!1})},Q=()=>{var Qe,Le;const se=(Le=(Qe=t.product)==null?void 0:Qe.detail)==null?void 0:Le.other_info,me=se==null?void 0:se.attribute_config;me&&Array.isArray(me)&&(l.value=me.map(qe=>({group_id:/^\d+$/.test(String(qe.group_id))?parseInt(qe.group_id,10):qe.group_id,title:qe.title||"",variants:(qe.variants||[]).map(At=>parseInt(At,10)).filter(Number.isFinite),errors:{name:"",values:""}}))),ne(),$()},V=new Set,I=T({}),M=K(()=>{if(!v.value||!v.value.group_id)return!1;const se=parseInt(v.value.group_id,10);return!!I.value[se]}),O=se=>{if(!/^\d+$/.test(String(se)))return;const me=parseInt(se,10),Qe=a.value.find(qe=>$e(qe.id,me));if(!Qe||Array.isArray(Qe.terms)||V.has(me))return;V.add(me),I.value[me]=!0;const Le=Math.min(Math.max(parseInt(Qe.terms_count,10)||0,50),200);Ae.get("options/attr/group/"+me+"/terms",{per_page:Le}).then(qe=>{Qe.terms=qe.terms&&qe.terms.data||[]}).catch(qe=>{var At;q.error(((At=qe==null?void 0:qe.data)==null?void 0:At.message)||u("Failed to load option values"))}).finally(()=>{V.delete(me),delete I.value[me]})},L=new Set;let H=null;const j=(se,me)=>{const Qe=(me||"").trim();if(!Qe||!/^\d+$/.test(String(se)))return;const Le=parseInt(se,10),qe=a.value.find(Ut=>$e(Ut.id,Le));if(!qe)return;const At=Array.isArray(qe.terms)?qe.terms.length:0,tt=parseInt(qe.terms_count,10)||0;tt&&At>=tt||Array.isArray(qe.terms)&&qe.terms.some(Ut=>(Ut.title||"").trim().toLowerCase()===Qe.toLowerCase())||(H&&clearTimeout(H),H=setTimeout(()=>{const Ut=Le+":"+Qe.toLowerCase();L.has(Ut)||(L.add(Ut),Ae.get("options/attr/group/"+Le+"/terms",{search:Qe,per_page:50}).then(jt=>{const Ta=jt.terms&&jt.terms.data||[];if(!Ta.length)return;Array.isArray(qe.terms)||(qe.terms=[]);const $t=new Set(qe.terms.map(ha=>ha.id)),Zt=Ta.filter(ha=>!$t.has(ha.id));Zt.length&&(qe.terms=[...qe.terms,...Zt])}).catch(()=>{}).finally(()=>{L.delete(Ut)}))},250))},W=se=>{if(!/^\d+$/.test(String(se)))return;const me=parseInt(se,10),Qe=a.value.find(qe=>$e(qe.id,me));if(!Qe||V.has(me))return;V.add(me);const Le=Math.min(Math.max(parseInt(Qe.terms_count,10)||0,50),200);Ae.get("options/attr/group/"+me+"/terms",{per_page:Le}).then(qe=>{const At=qe.terms&&qe.terms.data||[],tt=new Map((Array.isArray(Qe.terms)?Qe.terms:[]).map(jt=>[jt.id,jt]));At.forEach(jt=>tt.set(jt.id,jt)),Qe.terms=Array.from(tt.values());const Ut=qe.terms&&qe.terms.total;typeof Ut=="number"&&(Qe.terms_count=Ut)}).catch(()=>{}).finally(()=>{V.delete(me)})};let G=!1;const Z=()=>{G||(G=!0,Ae.get("options/attr/groups/library").then(se=>{const me=(se.groups||[]).slice(0,fc),Qe=new Map(a.value.map(Le=>[Le.id,Le]));me.forEach(Le=>{const qe=Qe.get(Le.id);Qe.set(Le.id,qe&&Array.isArray(qe.terms)?{...Le,terms:qe.terms}:Le)}),a.value=Array.from(Qe.values())}).catch(()=>{}).finally(()=>{G=!1}))},ne=()=>{w.value=l.value.map(se=>se.group_id).filter(Boolean)},ce=()=>{v.value=null,p.value=null,l.value=k.value.map(se=>({group_id:se.group_id,title:se.title,variants:[...se.variants],errors:{name:"",values:""}}))},z=async()=>{if(p.value!==null&&(await oe(p.value),p.value!==null))return;if(i.value=!0,!await ot()){i.value=!1;return}qt({silent:!1})},ue=se=>{const me=l.value.filter((Qe,Le)=>Le!==se).map(Qe=>Qe.group_id).filter(Boolean);return a.value.filter(Qe=>!me.includes(Qe.id))},ie=async()=>{if(p.value!==null&&(await oe(p.value),p.value!==null))return;l.value.push({group_id:null,title:"",variants:[],errors:{name:"",values:""}});const se=l.value.length-1;ae(se)},J=se=>{l.value.splice(se,1),p.value===se?(p.value=null,v.value=null):p.value!==null&&p.value>se&&p.value--},N=se=>{p.value===se?oe(se):ae(se)},ae=se=>{const me=l.value[se];v.value={group_id:me.group_id||null,title:me.title||"",variants:Array.isArray(me.variants)?[...me.variants]:[],errors:{name:"",values:""}},p.value=se,O(me.group_id)},oe=async se=>{if(!v.value||(v.value.errors.name=v.value.group_id?"":u("Option name is required."),v.value.errors.values=!v.value.variants||v.value.variants.length===0?u("Please add at least one option value."):"",v.value.errors.name||v.value.errors.values))return;const me=l.value[se];me.group_id=v.value.group_id,me.title=v.value.title,me.variants=[...v.value.variants],me.errors={name:"",values:""},v.value=null,p.value=null},fe=T(""),re=se=>{fe.value=se||""},Ee=se=>{if(se){Z();return}fe.value=""},ye=se=>{const me=ue(se),Qe=fe.value.trim().toLowerCase();return Qe?me.filter(Le=>typeof Le.title=="string"&&Le.title.toLowerCase().includes(Qe)):me},Ce=K(()=>{const se=fe.value.trim().toLowerCase();return se?!a.value.some(me=>typeof me.title=="string"&&me.title.trim().toLowerCase()===se):!0}),ve=se=>{if(v.value){if(typeof se=="string"&&se!==""){const me=se.trim().toLowerCase(),Qe=a.value.find(Le=>typeof Le.title=="string"&&Le.title.trim().toLowerCase()===me);Qe?(v.value.group_id=Qe.id,v.value.title=Qe.title,v.value.variants=[],O(Qe.id)):(v.value.title=se,v.value.variants=[])}else{const me=a.value.find(Qe=>$e(Qe.id,se));me&&(v.value.title=me.title,v.value.variants=[]),O(se)}v.value.errors&&(v.value.errors.name="")}},Ue=K(()=>v.value?typeof v.value.group_id=="string"&&v.value.group_id.trim()!=="":!1),Ke=T(!1),We=async se=>{var qe;if(!se||typeof se.group_id!="string"||se.group_id.trim()==="")return se?se.group_id:null;const me=se.group_id.trim(),Qe=me.toLowerCase(),Le=a.value.find(At=>typeof At.title=="string"&&At.title.trim().toLowerCase()===Qe);if(Le)return se.group_id=Le.id,se.title=Le.title,O(Le.id),Le.id;Ke.value=!0;try{const At=await Ae.post("options/attr/group/",{title:me,slug:me}),tt=At.data||At.group||At;if(!tt||!tt.id)return q.error(u("Failed to create attribute group")),null;a.value=[...a.value,{...tt,terms:tt.terms||[]}];const Ut=parseInt(tt.id,10);return se.group_id=Ut,se.title=tt.title||me,Ut}catch(At){let tt="";if((At==null?void 0:At.status_code)===422||(At==null?void 0:At.status)===422){q.validationErrors(At);const Ut=At!=null&&At.data&&typeof At.data=="object"?At.data:{},jt=Object.values(Ut)[0],Ta=jt&&typeof jt=="object"?Object.values(jt)[0]:jt;tt=typeof Ta=="string"?Ta:u("Failed to create attribute group")}else tt=((qe=At==null?void 0:At.data)==null?void 0:qe.message)||u("Failed to create attribute group"),q.error(tt);return se.errors&&(se.errors.name=tt),null}finally{Ke.value=!1}},Be=async()=>!v.value||!Ue.value?!0:await We(v.value)!==null,$e=(se,me)=>String(se)===String(me),He=se=>{const me=a.value.find(Qe=>$e(Qe.id,se));return me?me.terms||[]:[]},Re=se=>{if(!v.value||!$e(v.value.group_id,se))return[];const me=He(se).map(Qe=>Qe.title.toLowerCase());return(v.value.variants||[]).filter(Qe=>typeof Qe=="string"&&Qe.trim()!==""&&!me.includes(Qe.toLowerCase()))},yt=K(function(){if(!v.value||!v.value.group_id)return!1;var se=He(v.value.group_id);return se.length?se.every(function(me){return v.value.variants.some(function(Qe){return $e(Qe,me.id)})}):!1}),gt=K(function(){if(!v.value||!v.value.group_id)return!1;var se=He(v.value.group_id),me=se.filter(function(Qe){return v.value.variants.some(function(Le){return $e(Le,Qe.id)})}).length;return me>0&&me<se.length}),Rt=function(se){if(v.value){var me=String(se),Qe=v.value.variants.findIndex(function(Le){return String(Le)===me});Qe===-1?v.value.variants.push(se):v.value.variants.splice(Qe,1)}},Tt=function(se){if(v.value){var me=He(v.value.group_id);v.value.variants=se?me.map(function(Qe){return Qe.id}):[]}},Dt=(se,me)=>{const Qe=p.value===me&&v.value?v.value:se;if(Qe.title)return Qe.title;const Le=a.value.find(qe=>$e(qe.id,Qe.group_id));return Le&&Le.title?Le.title:u("Untitled option")},_t=K(()=>{const se=l.value.map(me=>me.group_id).filter(Boolean);return new Set(se).size!==se.length}),Gt=K(()=>l.value.length>ir),bt=K(()=>l.value.length>0&&l.value.length<=ir&&!_t.value&&l.value.every(se=>se.group_id&&se.variants&&se.variants.length>0&&se.variants.every(me=>typeof me=="number"))),St=K(()=>bt.value?l.value.reduce((se,me)=>se*(me.variants?me.variants.length:0),1):0),Pt=K(()=>St.value>bo),Ht=K(()=>{const se=l.value.filter(me=>me.group_id&&Array.isArray(me.variants)&&me.variants.length>0);return se.length?se.reduce((me,Qe)=>me*Qe.variants.length,1):0}),Qt=K(()=>{const se=l.value.filter(Qe=>Array.isArray(Qe.variants)&&Qe.variants.length>0);if(!se.length)return 0;let me=se.length-1;return se.forEach(Qe=>{const Le=Qe.variants.map(At=>parseInt(At,10)).filter(Number.isFinite),qe=Le.length?Math.max(...Le):0;me+=String(qe).length}),me}),ht=K(()=>Qt.value>rr),qt=({silent:se=!1}={})=>{if(s.value)return;if(l.value.length===0){s.value=!0,Ae.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:[]}).then(()=>{const Le=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;Le&&(Le.variants=[]),ne(),$(),t.productEditModel&&t.productEditModel.data&&typeof t.productEditModel.data.reloader=="function"&&t.productEditModel.data.reloader(),t.productEditModel&&typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Le=>{var qe;q.error(((qe=Le==null?void 0:Le.data)==null?void 0:qe.message)||u("Failed to clear variations"))}).finally(()=>{s.value=!1,i.value=!1});return}if(!bt.value){se||q.error(u("Please select at least one term for each attribute.")),i.value=!1;return}if(Pt.value){se||q.error(u("Too many combinations (%1$s). Maximum allowed is %2$s.",St.value,bo)),i.value=!1;return}if(ht.value){se||q.error(u("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",rr)),i.value=!1;return}s.value=!0;const me=l.value.map(Le=>({group_id:Le.group_id,title:Le.title,variants:[...new Set((Le.variants||[]).map(qe=>parseInt(qe,10)).filter(Number.isFinite))]}));let Qe=null;Ae.post(`products/${t.product.ID}/update-variant-option`,{variation_type:"advanced_variations",options:me}).then(Le=>{se||(Qe=Le.message||u("Variations generated successfully!")),ne(),$();const qe=Le&&Array.isArray(Le.data)?Le.data:null,At=t.productEditModel&&t.productEditModel.data?t.productEditModel.data.product:null;qe&&At&&(At.variants=qe),t.productEditModel.data.reloader(),typeof t.productEditModel.triggerProductUpdated=="function"&&t.productEditModel.triggerProductUpdated(["bundle"])}).catch(Le=>{var qe;q.error(((qe=Le==null?void 0:Le.data)==null?void 0:qe.message)||u("Failed to generate variations"))}).finally(async()=>{var Ut,jt;await xe();const Le=(jt=(Ut=t.productEditModel)==null?void 0:Ut.data)==null?void 0:jt.product,qe=()=>{const Ta=Le?Le.variants:null;return Array.isArray(Ta)&&Ta.some($t=>Array.isArray($t.attr_map)&&$t.attr_map.length>0)},At=2500,tt=Date.now();for(;!qe()&&Date.now()-tt<At;)await new Promise(Ta=>setTimeout(Ta,50));await xe(),s.value=!1,await xe(),await xe(),i.value=!1,Qe&&(q.success(Qe),Qe=null)})},ge=se=>{v.value&&v.value.errors&&se&&se.length>0&&(v.value.errors.values="")},Fe=async(se,{silent:me=!1}={})=>{var Ta;const Qe=He(se.group_id).map($t=>$t.title.toLowerCase()),Le=(se.variants||[]).filter($t=>typeof $t=="string"&&!Qe.includes($t.toLowerCase()));if(!Le.length)return!0;const qe=a.value.find($t=>$e($t.id,se.group_id)),At=$t=>{$t.length&&(qe&&(Array.isArray(qe.terms)||(qe.terms=[]),qe.terms=[...qe.terms,...$t]),$t.forEach(Zt=>{se.variants=se.variants.map(ha=>typeof ha=="string"&&ha.toLowerCase()===Zt.title.toLowerCase()?Zt.id:ha)}))},{created:tt,message:Ut,error:jt}=await XK(($t,Zt)=>Ae.post($t,Zt),se.group_id,Le);return At(tt),se.variants=se.variants.filter($t=>typeof $t!="string"),jt?((jt==null?void 0:jt.status_code)===422||(jt==null?void 0:jt.status)===422?q.validationErrors(jt):q.error(((Ta=jt==null?void 0:jt.data)==null?void 0:Ta.message)||u("Failed to create option values")),!1):(me||q.success(Ut||u("Option values created successfully")),!0)},ot=async()=>{for(const se of l.value)if(typeof se.group_id=="string"&&se.group_id.trim()!==""&&!await We(se)||!await Fe(se,{silent:!0}))return!1;return!0},wt=se=>{const me=a.value.find(Qe=>$e(Qe.id,se));return me&&me.settings&&me.settings.type?me.settings.type:"options"},kt=se=>({options:u("Text"),color:u("Color"),image:u("Image")})[wt(se)]||wt(se),Xt=se=>({options:"info",color:"warning",image:"success"})[wt(se)]||"info",vt=se=>{if(!se.variants||se.variants.length===0)return[];const me=He(se.group_id);return se.variants.map(Qe=>typeof Qe=="string"?{id:Qe,title:Qe}:me.find(Le=>$e(Le.id,Qe))).filter(Boolean)},ea=se=>se.title?u("Add %1$s",se.title.toLowerCase()):u("Add more value"),ta=T(""),zt=T(""),wa=T("");let qa=null;const il=se=>{qa=se},Ya=T(!1),ma=T({title:"",settings:{color:"",image:""}}),X=T(!1),we=T({}),le=se=>{zt.value=se||"",v.value&&j(v.value.group_id,se)},he=K(()=>{if(!v.value||!v.value.group_id)return[];const se=He(v.value.group_id),me=zt.value.trim().toLowerCase();return me?se.filter(Qe=>(Qe.title||"").toLowerCase().includes(me)):se}),Ye=()=>{const se=zt.value.trim();if(!se||!v.value||!v.value.group_id)return;const me=wt(v.value.group_id);me!=="color"&&me!=="image"||ee(se)},st=(se,me)=>{if(!se||se.key!=="Enter"||!v.value||!v.value.group_id)return;const Qe=wt(v.value.group_id);if(Qe!=="color"&&Qe!=="image")return;const Le=se.target,qe=(Le&&typeof Le.value=="string"?Le.value:"").trim();!qe||He(v.value.group_id).find(tt=>typeof tt.title=="string"&&tt.title.trim().toLowerCase()===qe.toLowerCase())||(se.preventDefault(),se.stopPropagation(),ee(qe))};let je=null,Xe=null,mt=null,et=null;const It=se=>{je=se},pe=se=>{y.value=se,g.value=!0},_e=se=>{if(!se||!se.id){g.value=!1,y.value=null;return}const me=y.value;a.value=[...a.value,{...se,terms:se.terms||[]}],me!==null&&v.value&&p.value===me&&(v.value.group_id=parseInt(se.id,10),v.value.title=se.title||"",v.value.variants=[],v.value.errors&&(v.value.errors.name=""),O(parseInt(se.id,10))),g.value=!1,y.value=null},Oe=se=>{wa.value=se||"",v.value&&j(v.value.group_id,se)},Me=K(()=>{if(!v.value||!v.value.group_id)return[];const se=He(v.value.group_id),me=wa.value.trim().toLowerCase();return me?se.filter(Qe=>(Qe.title||"").toLowerCase().includes(me)):se}),ct=K(()=>{if(!v.value||!v.value.group_id)return[];const se=Re(v.value.group_id),me=wa.value.trim().toLowerCase();return me?se.filter(Qe=>(Qe||"").toLowerCase().includes(me)):se}),ee=se=>{ma.value={title:(se||"").trim(),settings:{color:"",image:""}},Ya.value=!0,we.value={},Xe||(Xe=function(me){var Qe=document.querySelector(".fct-option-values-select");if(!(Qe&&Qe.contains(me.target))){var Le=document.querySelector(".el-color-picker__panel");Le&&Le.contains(me.target)||me.stopPropagation()}},document.addEventListener("mousedown",Xe,!0),mt=function(me){var Qe=document.querySelector(".el-color-picker__panel");Qe&&Qe.contains(me.target)&&me.stopPropagation()},document.body.addEventListener("mousedown",mt)),et&&document.removeEventListener("keyup",et,!0),et=function(me){me.key==="Enter"&&(me.stopPropagation(),document.removeEventListener("keyup",et,!0),et=null)},document.addEventListener("keyup",et,!0),xe(()=>{var me=document.querySelector(".fct-option-values-select");if(me){var Qe=je||qa;if(Qe){var Le=Qe.$el||Qe,qe=Le?Le.getBoundingClientRect().width:0;qe>0&&(me.style.maxWidth=qe+"px")}}})},Ne=()=>{Ya.value=!1,ma.value={title:"",settings:{color:"",image:""}},we.value={},Xe&&(document.removeEventListener("mousedown",Xe,!0),Xe=null),mt&&(document.body.removeEventListener("mousedown",mt),mt=null),et&&(document.removeEventListener("keyup",et,!0),et=null);var se=document.querySelector(".fct-option-values-select");se&&(se.style.maxWidth="")},pt=async se=>{const me=(ma.value.title||"").trim();if(!me||X.value||!v.value||!v.value.group_id)return;X.value=!0,we.value={};const Qe={terms:[{title:me,settings:{color:ma.value.settings.color||"",image:ma.value.settings.image||""}}]};try{if(Ue.value&&!await Be())return;const Le=await Ae.post("options/attr/group/"+v.value.group_id+"/terms",Qe),qe=Array.isArray(Le.data)?Le.data[0]:Le.data;_.value=se,Wa(qe),Ne(),zt.value="",wa.value=""}catch(Le){Le&&Le.status_code===422&&Le.data?we.value=Le.data:q.error(Le&&Le.data&&Le.data.message||Le&&Le.message||u("Failed to add the term."))}finally{X.value=!1}},De=se=>{if(se){v.value&&W(v.value.group_id);return}Ne(),zt.value=""},xt=se=>{if(se){v.value&&W(v.value.group_id);return}Ne(),wa.value=""},Wa=se=>{const me=_.value,Qe=l.value[me];if(Qe){const Le=v.value?v.value.group_id:Qe.group_id;if(Le&&/^\d+$/.test(String(Le))){const qe=parseInt(Le,10),At=a.value.find(tt=>$e(tt.id,qe));if(At&&se&&Array.isArray(At.terms)?At.terms.push(se):(At&&delete At.terms,O(qe)),se&&v.value&&Array.isArray(v.value.variants)){const tt=(se.title||"").trim().toLowerCase();v.value.variants=v.value.variants.filter(function(Ut){return!(typeof Ut=="string"&&Ut.trim().toLowerCase()===tt)}),v.value.variants.some(function(Ut){return String(Ut)===String(se.id)})||v.value.variants.push(se.id)}}q.success(u("Term created successfully"))}f.value=!1,_.value=null,ta.value=""};return(se,me)=>{var Ta;const Qe=C("router-link"),Le=C("el-tag"),qe=C("el-option"),At=C("el-select"),tt=C("el-button"),Ut=C("el-checkbox"),jt=C("el-dialog");return r(),h("div",ZK,[o("div",eG,[c.value?(r(),h("div",tG,[(r(!0),h(P,null,te(l.value.length||3,$t=>(r(),h("div",{key:$t,class:"fct-adv-var-loading-card"},me[26]||(me[26]=[o("span",{class:"fct-skel-block fct-adv-var-loading-handle"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-title"},null,-1),o("span",{class:"fct-skel-block fct-adv-var-loading-badge"},null,-1)])))),128))])):x("",!0),l.value.length===0&&!c.value&&a.value.length===0?(r(),h("div",aG,[R(m(A(u)("No attribute groups found."))+" ",1),n(Qe,{to:{name:"attributes"}},{default:d(()=>[R(m(A(u)("Create attribute groups")),1)]),_:1})])):l.value.length===0&&!c.value?(r(),h("div",lG,[o("span",sG,[n(Y,{name:"Information"})]),o("div",nG,[o("strong",null,m(A(u)("No options added yet.")),1),o("span",null,m(A(u)("Add options like Color, Size etc. to create variations.")),1)])])):x("",!0),l.value.length>0&&!c.value?(r(),E(A(sn),{key:3,modelValue:l.value,"onUpdate:modelValue":me[22]||(me[22]=$t=>l.value=$t),handle:".fct-option-drag-handle",disabled:l.value.length<=1||p.value!==null,class:"fct-option-card-list"},{default:d(()=>[(r(!0),h(P,null,te(l.value,($t,Zt)=>(r(),h("div",{key:$t.group_id||"new-"+Zt,class:"fct-option-card"},[o("div",{class:"fct-option-card-collapsed",role:"button",tabindex:"0","aria-expanded":p.value===Zt,onClick:ha=>N(Zt),onKeydown:xa(Ge(ha=>N(Zt),["prevent"]),["enter","space"])},[l.value.length>1?(r(),h("span",{key:0,class:"fct-option-drag-handle",onClick:me[0]||(me[0]=Ge(()=>{},["stop"]))},[n(Y,{name:"ReorderDotsVertical"})])):x("",!0),o("div",iG,[o("div",rG,[o("strong",null,m(Dt($t,Zt)),1),$t.group_id?(r(),E(Le,{key:0,size:"small",type:Xt($t.group_id),class:"fct-group-type-badge"},{default:d(()=>[R(m(kt($t.group_id)),1)]),_:2},1032,["type"])):x("",!0)]),vt($t).length?(r(),h("div",dG,[(r(!0),h(P,null,te(vt($t),ha=>(r(),h("span",{key:ha.id,class:de(["fct-option-value-chip",`fct-option-value-chip--${wt($t.group_id)}`])},[wt($t.group_id)==="color"?(r(),h("span",{key:0,class:"fct-option-value-swatch",style:ra({background:ha.settings&&ha.settings.color?ha.settings.color:""})},null,4)):wt($t.group_id)==="image"&&ha.settings&&ha.settings.image?(r(),h("img",{key:1,src:ha.settings.image,alt:ha.title,class:"fct-option-value-img"},null,8,uG)):x("",!0),o("span",cG,m(ha.title),1)],2))),128))])):x("",!0)]),p.value===Zt?(r(),h("button",{key:1,type:"button",class:"fct-option-card-toggle fct-option-card-toggle--open","aria-label":A(u)("Done"),title:A(u)("Done"),onClick:Ge(ha=>oe(Zt),["stop"])},me[27]||(me[27]=[o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M6 4l4 4-4 4",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),8,AG)):x("",!0)],40,oG),n(ya,{accordion:"",visible:p.value===Zt},{default:d(()=>{var ha,Ze,aa,Ha;return[p.value===Zt&&v.value?(r(),h("div",pG,[o("div",{class:de(["fct-option-field",{"fct-option-field--error":(ha=v.value.errors)==null?void 0:ha.name}])},[o("label",fG,m(A(u)("Option name")),1),n(At,{modelValue:v.value.group_id,"onUpdate:modelValue":me[1]||(me[1]=Je=>v.value.group_id=Je),filterable:"","allow-create":Ce.value,"default-first-option":"","filter-method":re,"popper-class":"fct-option-name-select",placeholder:A(u)("Select or type a new option"),onChange:me[2]||(me[2]=Je=>ve(Je)),onVisibleChange:Ee},{default:d(()=>[(r(!0),h(P,null,te(ye(Zt),Je=>(r(),E(qe,{key:Je.id,label:Je.title,value:Je.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","allow-create","placeholder"]),v.value.group_id?x("",!0):(r(),h("div",mG,[n(tt,{type:"primary",size:"small",text:"",class:"fct-option-create-group",onClick:Je=>pe(Zt)},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)("Create new attribute group")),1)]),_:2},1032,["onClick"])])),(Ze=v.value.errors)!=null&&Ze.name?(r(),h("div",hG,[n(Y,{name:"AlertIcon"}),o("span",null,m(v.value.errors.name),1)])):x("",!0)],2),o("div",{class:de(["fct-option-field",{"fct-option-field--error":(aa=v.value.errors)==null?void 0:aa.values}])},[o("label",_G,m(A(u)("Option values")),1),wt(v.value.group_id)==="options"?(r(),E(At,{key:0,ref_for:!0,ref:il,modelValue:v.value.variants,"onUpdate:modelValue":me[8]||(me[8]=Je=>v.value.variants=Je),multiple:"",filterable:"","allow-create":"","default-first-option":"","filter-method":Oe,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ea(v.value),disabled:!v.value.group_id,loading:M.value,"loading-text":A(u)("Loading..."),onChange:me[9]||(me[9]=Je=>ge(Je)),onVisibleChange:xt},{tag:d(()=>[n(or,{modelValue:v.value.variants,"onUpdate:modelValue":me[3]||(me[3]=Je=>v.value.variants=Je),terms:He(v.value.group_id),type:wt(v.value.group_id)},null,8,["modelValue","terms","type"])]),header:d(()=>[He(v.value.group_id).length>0?(r(),h("div",vG,[n(Ut,{"model-value":yt.value,indeterminate:gt.value,onChange:Tt},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):x("",!0)]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:me[7]||(me[7]=Ge(()=>{},["self","prevent"]))},[Ya.value?(r(),h("div",bG,[n(Bo,{term:ma.value,"group-type":"options","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:Je=>pt(Zt),onRemove:Ne},null,8,["term","validation-errors","onSubmit"]),o("div",wG,[n(tt,{type:"primary",size:"small",loading:X.value,disabled:!ma.value.title.trim()||X.value,onClick:Je=>pt(Zt)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(tt,{size:"small",onClick:Ne},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[wa.value.trim()&&!He(v.value.group_id).some(function(Je){return Je.title.toLowerCase()===wa.value.trim().toLowerCase()})?(r(),E(tt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:me[6]||(me[6]=Je=>ee(wa.value))},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',wa.value.trim())),1)]),_:1})):x("",!0)],64))],32)]),default:d(()=>[(r(!0),h(P,null,te(Me.value,Je=>(r(),E(qe,{key:Je.id,label:Je.title,value:Je.id},{default:d(()=>[o("div",gG,[n(Ut,{"model-value":v.value.variants.some(function(Lt){return $e(Lt,Je.id)}),tabindex:"-1",onClick:me[4]||(me[4]=Ge(()=>{},["stop"])),onChange:Lt=>Rt(Je.id)},null,8,["model-value","onChange"]),o("span",null,m(Je.title),1)])]),_:2},1032,["label","value"]))),128)),(r(!0),h(P,null,te(ct.value,Je=>(r(),E(qe,{key:Je,label:Je,value:Je},{default:d(()=>[o("div",yG,[n(Ut,{"model-value":!0,tabindex:"-1",onClick:me[5]||(me[5]=Ge(()=>{},["stop"])),onChange:Lt=>Rt(Je)},null,8,["onChange"]),o("span",null,m(Je),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text"])):wt(v.value.group_id)==="color"?(r(),h("div",CG,[n(At,{ref_for:!0,ref:It,modelValue:v.value.variants,"onUpdate:modelValue":me[15]||(me[15]=Je=>v.value.variants=Je),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ea(v.value),disabled:!v.value.group_id,loading:M.value,"loading-text":A(u)("Loading..."),onKeydownCapture:Je=>st(Je,Zt),onVisibleChange:De},{empty:d(()=>[o("div",kG,m(A(u)("No matching data")),1)]),header:d(()=>[He(v.value.group_id).length>0?(r(),h("div",BG,[n(Ut,{"model-value":yt.value,indeterminate:gt.value,onChange:Tt},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):x("",!0)]),tag:d(()=>[n(or,{modelValue:v.value.variants,"onUpdate:modelValue":me[10]||(me[10]=Je=>v.value.variants=Je),terms:He(v.value.group_id),type:"color"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:me[14]||(me[14]=Ge(()=>{},["self","prevent"]))},[Ya.value?(r(),h("div",SG,[n(Bo,{term:ma.value,"group-type":"color","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:Je=>pt(Zt),onRemove:Ne},null,8,["term","validation-errors","onSubmit"]),o("div",FG,[n(tt,{type:"primary",size:"small",loading:X.value,disabled:!ma.value.title.trim()||X.value,onClick:Je=>pt(Zt)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(tt,{size:"small",onClick:Ne},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[zt.value.trim()&&!he.value.some(function(Je){return Je.title.toLowerCase()===zt.value.trim().toLowerCase()})?(r(),E(tt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:me[12]||(me[12]=Je=>Ye())},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',zt.value.trim())),1)]),_:1})):(r(),E(tt,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:me[13]||(me[13]=Je=>ee(""))},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(P,null,te(he.value,Je=>(r(),E(qe,{key:Je.id,label:Je.title,value:Je.id},{default:d(()=>[o("div",xG,[n(Ut,{"model-value":v.value.variants.some(function(Lt){return $e(Lt,Je.id)}),tabindex:"-1",onClick:me[11]||(me[11]=Ge(()=>{},["stop"])),onChange:Lt=>Rt(Je.id)},null,8,["model-value","onChange"]),o("span",{class:"fct-color-dot",style:ra({background:Je.settings&&Je.settings.color?Je.settings.color:""})},null,4),R(" "+m(Je.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):wt(v.value.group_id)==="image"?(r(),h("div",$G,[n(At,{ref_for:!0,ref:It,modelValue:v.value.variants,"onUpdate:modelValue":me[21]||(me[21]=Je=>v.value.variants=Je),multiple:"",filterable:"","filter-method":le,"reserve-keyword":!1,"tag-type":"info","popper-class":"fct-option-values-select",placeholder:ea(v.value),disabled:!v.value.group_id,loading:M.value,"loading-text":A(u)("Loading..."),onKeydownCapture:Je=>st(Je,Zt),onVisibleChange:De},{empty:d(()=>[o("div",EG,m(A(u)("No matching data")),1)]),header:d(()=>[He(v.value.group_id).length>0?(r(),h("div",UG,[n(Ut,{"model-value":yt.value,indeterminate:gt.value,onChange:Tt},null,8,["model-value","indeterminate"]),o("span",null,m(A(u)("Select all")),1)])):x("",!0)]),tag:d(()=>[n(or,{modelValue:v.value.variants,"onUpdate:modelValue":me[16]||(me[16]=Je=>v.value.variants=Je),terms:He(v.value.group_id),type:"image"},null,8,["modelValue","terms"])]),footer:d(()=>[o("div",{class:"fct-picker-inline-form",onMousedown:me[20]||(me[20]=Ge(()=>{},["self","prevent"]))},[Ya.value?(r(),h("div",DG,[n(Bo,{term:ma.value,"group-type":"image","show-remove-button":!1,"validation-errors":we.value,"field-key":"terms.0",onSubmit:Je=>pt(Zt),onRemove:Ne},null,8,["term","validation-errors","onSubmit"]),o("div",VG,[n(tt,{type:"primary",size:"small",loading:X.value,disabled:!ma.value.title.trim()||X.value,onClick:Je=>pt(Zt)},{default:d(()=>[R(m(A(u)("Add")),1)]),_:2},1032,["loading","disabled","onClick"]),n(tt,{size:"small",onClick:Ne},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1})])])):(r(),h(P,{key:0},[zt.value.trim()&&!he.value.some(function(Je){return Je.title.toLowerCase()===zt.value.trim().toLowerCase()})?(r(),E(tt,{key:0,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:me[18]||(me[18]=Je=>ee(zt.value))},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)('Add "%1$s" as new value',zt.value.trim())),1)]),_:1})):(r(),E(tt,{key:1,type:"primary",size:"small",text:"",class:"fct-inline-add-btn",onClick:me[19]||(me[19]=Je=>ee(""))},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)("Add new value")),1)]),_:1}))],64))],32)]),default:d(()=>[(r(!0),h(P,null,te(he.value,Je=>(r(),E(qe,{key:Je.id,label:Je.title,value:Je.id},{default:d(()=>[o("div",IG,[n(Ut,{"model-value":v.value.variants.some(function(Lt){return $e(Lt,Je.id)}),tabindex:"-1",onClick:me[17]||(me[17]=Ge(()=>{},["stop"])),onChange:Lt=>Rt(Je.id)},null,8,["model-value","onChange"]),o("img",{src:Je.settings&&Je.settings.image?Je.settings.image:"",alt:""},null,8,QG),R(" "+m(Je.title),1)])]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","placeholder","disabled","loading","loading-text","onKeydownCapture"])])):x("",!0),(Ha=v.value.errors)!=null&&Ha.values?(r(),h("div",TG,[n(Y,{name:"AlertIcon"}),o("span",null,m(v.value.errors.values),1)])):x("",!0)],2),o("div",MG,[n(tt,{class:"fct-adv-var-del-button",type:"default",size:"small",onClick:Je=>J(Zt)},{default:d(()=>[R(m(A(u)("Delete")),1)]),_:2},1032,["onClick"])])])):x("",!0)]}),_:2},1032,["visible"])]))),128))]),_:1},8,["modelValue","disabled"])):x("",!0),a.value.length>0?(r(),h("div",{key:4,class:de(["fct-option-add-wrap",{"fct-option-add-wrap--empty":l.value.length===0}])},[n(tt,{class:de(["fct-option-add",{"fct-option-add--empty":l.value.length===0}]),size:"small",onClick:ie},{default:d(()=>[me[28]||(me[28]=o("svg",{fill:"currentColor",width:"14",height:"14",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},[o("path",{d:"M4.25 8a.75.75 0 0 1 .75-.75h2.25v-2.25a.75.75 0 0 1 1.5 0v2.25h2.25a.75.75 0 0 1 0 1.5h-2.25v2.25a.75.75 0 0 1-1.5 0v-2.25h-2.25a.75.75 0 0 1-.75-.75"}),o("path",{"fill-rule":"evenodd",d:"M8 15a7 7 0 1 0 0-14 7 7 0 0 0 0 14m0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11"})],-1)),R(" "+m(l.value.length===0?A(u)("Add options like size or color"):A(u)("Add more")),1)]),_:1,__:[28]},8,["class"]),Ht.value>0?(r(),h("span",{key:0,class:"fct-adv-var-combinations-chip",title:A(u)("Variant combinations the current options will generate (max %1$s)",bo)},m(A(u)("%1$s combinations",Ht.value)),9,LG)):x("",!0)],2)):x("",!0),(D.value||B.value)&&!i.value?(r(),h("div",RG,[o("span",OG,m(F.value),1),o("div",PG,[n(tt,{size:"small",disabled:s.value,onClick:ce},{default:d(()=>[R(m(A(u)("Discard")),1)]),_:1},8,["disabled"]),n(tt,{size:"small",type:"primary",loading:s.value,onClick:z},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading"])])])):x("",!0),Pt.value||Gt.value||_t.value||ht.value?(r(),h("div",HG,[Gt.value?(r(),h("div",NG,[o("span",null,m(A(u)("Too many attribute groups. Maximum allowed is %1$s. Remove some groups.",ir)),1)])):_t.value?(r(),h("div",KG,[o("span",null,m(A(u)("The same attribute group is selected more than once. Remove the duplicate.")),1)])):Pt.value?(r(),h("div",GG,[o("span",null,m(A(u)("Too many combinations (%1$s). Maximum allowed is %2$s. Remove some option values.",St.value,bo)),1)])):ht.value?(r(),h("div",zG,[o("span",null,m(A(u)("These options would create variant identifiers longer than %1$s characters. Use fewer attribute groups.",rr)),1)])):x("",!0)])):x("",!0)]),l.value.some($t=>$t.group_id&&$t.variants&&$t.variants.length>0)&&e.product.variants&&e.product.variants.length>0&&((Ta=e.product.detail)==null?void 0:Ta.variation_type)==="advanced_variations"?(r(),E(GK,{key:0,product:e.product,productEditModel:e.productEditModel,attributeGroups:a.value,"external-busy":i.value||s.value||c.value},null,8,["product","productEditModel","attributeGroups","external-busy"])):x("",!0),n(jt,{"append-to-body":!0,modelValue:f.value,"onUpdate:modelValue":me[23]||(me[23]=$t=>f.value=$t),title:A(u)("Add new attribute term"),onClose:me[24]||(me[24]=$t=>ta.value="")},{default:d(()=>[f.value&&_.value!==null&&v.value?(r(),E(JK,{key:0,"group-id":v.value.group_id,group:a.value.find($t=>$e($t.id,v.value.group_id)),"initial-title":ta.value,onIsTermCreatingDone:Wa},null,8,["group-id","group","initial-title"])):x("",!0)]),_:1},8,["modelValue","title"]),n(jt,{"append-to-body":!0,width:"50%",modelValue:g.value,"onUpdate:modelValue":me[25]||(me[25]=$t=>g.value=$t),title:A(u)("Add new attribute group")},{default:d(()=>[g.value?(r(),E(Fm,{key:0,onWhenGroupCreateIsDone:_e})):x("",!0)]),_:1},8,["modelValue","title"])])}}},qG={class:"fct-product-pricing-wrap"},YG={class:"w-[150px] fct-select-gray"},WG={key:1,class:"fct-simple-product-actions"},JG={__name:"ProductPricing",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){var p,f;const t=e;T(!1);const a=T((f=(p=t.product)==null?void 0:p.detail)==null?void 0:f.variation_type),l=T(null),s=_=>{var b,S;const g=t.product.detail.variation_type,y=((b=t.product.variants)==null?void 0:b.length)??0;if(_==="advanced_variations"&&g!=="advanced_variations"){l.value=_,a.value=g,Mn.confirmDeleteWithInput("proceed",u("Switching to Advanced Variations will delete all current variations for this product and cannot be undone. You won't be able to switch back to Simple Variations.")).then(()=>{i()}).catch(()=>{l.value||(l.value=null)});return}const v=(S=t.product.variants)==null?void 0:S[0],w=v==null?void 0:v.media,k=Array.isArray(w)?w.length>0:Array.isArray(w==null?void 0:w.meta_value)&&w.meta_value.length>0;if(_==="simple"&&g==="simple_variations"&&(y>1||k)){l.value=_,a.value=g;const $=y>1?u("Switching to 'Simple' will permanently delete all variations except the first one, along with any image attached to that variation."):u("Switching to 'Simple' will permanently delete the image attached to this variation.");Mn.confirmDeleteWithInput("proceed",$).then(()=>{i()}).catch(()=>{l.value||(l.value=null)})}else c(_)},i=()=>{l.value&&c(l.value),l.value=null},c=_=>{const g=t.product.detail.variation_type;a.value=_;const y=t.productEditModel.updateVariationType("variation_type",_);Promise.resolve(y).catch(()=>{a.value=g})};return(_,g)=>{var w,k;const y=C("el-option"),v=C("el-select");return r(),h("div",qG,[n(Se,{class:de(((k=(w=e.product)==null?void 0:w.detail)==null?void 0:k.variation_type)==="simple_variations"?"overflow-hidden":"")},{default:d(()=>{var b,S;return[n(Ve,{title:_.$t("Pricing"),border_bottom:""},{action:d(()=>[o("div",YG,[e.product.detail?(r(),E(v,{key:0,size:"small",class:de(e.productEditModel.hasValidationError("detail.variation_type")?"is-error":""),modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=$=>a.value=$),placeholder:_.$t("Select Variation"),onChange:s},{default:d(()=>[(r(!0),h(P,null,te(_.appVars.variation_types,($,D)=>{var F,B;return r(),E(y,{key:D,label:$,value:D,disabled:((B=(F=e.product)==null?void 0:F.detail)==null?void 0:B.variation_type)==="advanced_variations"&&D!=="advanced_variations"},null,8,["label","value","disabled"])}),128))]),_:1},8,["class","modelValue","placeholder"])):x("",!0)])]),_:1},8,["title"]),n(ke,{class:de(((S=(b=e.product)==null?void 0:b.detail)==null?void 0:S.variation_type)==="simple_variations"?"pb-0":"")},{default:d(()=>{var $,D,F,B,U,Q,V,I,M,O,L,H,j,W,G,Z,ne;return[((D=($=e.product)==null?void 0:$.detail)==null?void 0:D.variation_type)==="simple"?(r(),E(Vd,{key:0,class:"simple-product-pricing",index:0,modeType:"add",fieldKey:"variants.0",product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),((B=(F=e.product)==null?void 0:F.detail)==null?void 0:B.variation_type)==="simple"&&((Q=(U=e.product)==null?void 0:U.variants[0])!=null&&Q.id)?(r(),h("div",WG,[n(Ea,{class:"fct-copy-wrap-inline",text:String(e.product.variants[0].id),showMode:"icon_with_text",buttonText:_.$t("Copy Variation ID")},null,8,["text","buttonText"]),((I=(V=e.product)==null?void 0:V.detail)==null?void 0:I.variation_type)==="simple"&&(((M=e.product)==null?void 0:M.post_status)==="publish"||((O=e.product)==null?void 0:O.post_status)==="private")&&((H=(L=e.product)==null?void 0:L.variants[0])!=null&&H.id)?(r(),E(Ea,{key:0,class:"fct-copy-wrap-inline mt-3",text:((j=_.appVars)==null?void 0:j.frontend_url)+"=instant_checkout&item_id="+e.product.variants[0].id+"&quantity=1",showMode:"icon_with_text",placement:"top",buttonText:_.$t("Direct Checkout"),tooltipContent:_.$t("Share direct checkout link to let customers buy this variation directly.")},null,8,["text","buttonText","tooltipContent"])):x("",!0)])):x("",!0),((G=(W=e.product)==null?void 0:W.detail)==null?void 0:G.variation_type)==="simple_variations"?(r(),E(aH,{key:2,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0),((ne=(Z=e.product)==null?void 0:Z.detail)==null?void 0:ne.variation_type)==="advanced_variations"?(r(),E(jG,{key:3,product:e.product,productEditModel:e.productEditModel},null,8,["product","productEditModel"])):x("",!0)]}),_:1},8,["class"])]}),_:1},8,["class"])])}}},XG={class:"fct-sku-input-wrap"},ZG={class:"fct-sku-edit-actions"},mc={__name:"SkuInput",props:{variant:{type:Object,required:!0},productTitle:{type:String,default:""}},emits:["saved"],setup(e,{emit:t}){const a=e,l=t,s=T(a.variant.sku||""),i=T(a.variant.sku||""),c=T(!1),p=T(!1),f=T(!1),_=()=>{c.value=!0},g=()=>{i.value=s.value,c.value=!1},y=()=>{p.value=!0,Ae.post("products/variants/group-bulk-update",{variant_ids:[a.variant.id],sku:i.value}).then(w=>{s.value=i.value,l("saved",i.value),c.value=!1,q.success(w.message)}).catch(w=>{var k;w.status_code=="422"?q.validationErrors(w):q.error((k=w.data)==null?void 0:k.message)}).finally(()=>{p.value=!1})},v=()=>{f.value=!0,Ae.get("products/suggest-sku",{title:a.productTitle,variant_title:a.variant.variation_title||"",exclude_id:a.variant.id}).then(w=>{i.value=w.sku,c.value=!0}).catch(w=>{var k;q.error((k=w.data)==null?void 0:k.message)}).finally(()=>{f.value=!1})};return(w,k)=>{const b=C("el-input"),S=C("el-button");return r(),h("div",XG,[n(b,{modelValue:i.value,"onUpdate:modelValue":k[0]||(k[0]=$=>i.value=$),size:"small",placeholder:A(u)("No SKU"),onInput:_,onKeydown:[k[1]||(k[1]=xa(Ge($=>c.value&&y(),["prevent"]),["enter"])),xa(g,["escape"])]},null,8,["modelValue","placeholder"]),o("div",ZG,[c.value?(r(),h(P,{key:0},[n(S,{size:"small",type:"primary",title:A(u)("Save SKU"),"aria-label":A(u)("Save SKU"),loading:p.value,onClick:y},{default:d(()=>[n(Y,{name:"Check"})]),_:1},8,["title","aria-label","loading"]),n(S,{size:"small",type:"danger",title:A(u)("Discard changes"),"aria-label":A(u)("Discard changes"),onClick:g},{default:d(()=>[n(Y,{name:"Close"})]),_:1},8,["title","aria-label"])],64)):(r(),E(S,{key:1,size:"small",class:"fct-sku-suggest-btn",loading:f.value,title:A(u)("Generate SKU"),onClick:v},{default:d(()=>[n(Y,{name:"Generate"})]),_:1},8,["loading","title"]))])])}}},ez={key:0,class:"fct-product-inventory-wrap"},tz={class:"fct-product-inventory-inner-wrap hide-on-mobile"},az={key:0,class:"fct-variant-badge fct-variant-badge--light"},lz={class:"fct-inventory-cell-text pl-5"},sz={class:"fct-inventory-cell-text pl-5"},nz={class:"fct-inventory-cell-text pl-5"},oz={class:"fct-product-inventory-inner-wrap-mobile"},iz={class:"fct-product-inventory-mobile-col"},rz={class:"title"},dz={class:"fct-product-inventory-mobile-col"},uz={class:"fct-product-inventory-mobile-col"},cz={__name:"ProductInventory",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=ze.get("modules_settings.stock_management.active"),s=T([]),i=T({}),c=(y,v)=>{y&&(i.value[v]=y.scrollWidth>y.clientWidth)};Ie(()=>{a.product.variants.forEach(y=>{y.new_stock=y.total_stock,y.adjusted_quantity=0})});const p=y=>a.product.detail.variation_type==="simple_variations"&&y.row.manage_stock==0?"disable_inventory_row":"",f=y=>a.product.detail.variation_type==="simple_variations"&&y.manage_stock==0?"disable_inventory_row":"",_=y=>{let v=parseInt(a.product.variants[y].new_stock);a.product.variants[y].total_stock=v<0?0:v;let w=parseInt(a.product.variants[y].total_stock)-parseInt(a.product.variants[y].committed)-parseInt(a.product.variants[y].on_hold);a.product.variants[y].available=w<0?0:w,a.product.variants[y].adjusted_quantity=0,a.product.variants[y].new_stock=a.product.variants[y].total_stock,Ae.put(`products/${a.product.ID}/update-inventory/${a.product.variants[y].id}`,{total_stock:a.product.variants[y].total_stock,available:a.product.variants[y].available}).then(k=>{q.success(k.message)}).catch(k=>{var b;k.status_code=="422"?q.validationErrors(k):q.error((b=k.data)==null?void 0:b.message)})},g=y=>{Ae.put(`products/${a.product.ID}/update-manage-stock`,{manage_stock:a.product.detail.manage_stock}).then(v=>{q.success(v.message),a.product.variants.forEach(w=>{w.manage_stock=y})}).catch(v=>{var w;v.status_code=="422"?q.validationErrors(v):q.error((w=v.data)==null?void 0:w.message)})};return(y,v)=>{const w=C("el-switch"),k=C("el-tooltip"),b=C("el-table-column"),S=C("el-input"),$=C("el-table");return A(l)==="yes"?(r(),h("div",ez,[n(Se,{class:"overflow-hidden"},{default:d(()=>{var D,F;return[n(Ve,{class:de(((D=e.product.detail)==null?void 0:D.manage_stock.toString())==="0"?"pb-5":"")},{action:d(()=>{var B;return[(B=e.product.detail)!=null&&B.manage_stock?(r(),E(w,{key:0,modelValue:e.product.detail.manage_stock,"onUpdate:modelValue":v[0]||(v[0]=U=>e.product.detail.manage_stock=U),onChange:g,"active-value":"1","inactive-value":"0","active-text":A(u)("Inventory Management")},null,8,["modelValue","active-text"])):x("",!0)]}),_:1},8,["class"]),n(ya,{visible:((F=e.product.detail)==null?void 0:F.manage_stock.toString())==="1",accordion:""},{default:d(()=>[n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",tz,[n($,{data:e.product.variants,"row-class-name":p},{default:d(()=>[n(b,{label:A(u)("Title"),width:"180"},{default:d(B=>{var U,Q;return[o("div",{class:de(["relative",{"fct-inventory-title-cell--has-badge":((U=B.row.other_info)==null?void 0:U.payment_type)==="subscription"}])},[n(k,{content:B.row.variation_title,placement:"top","show-after":300,disabled:!i.value[`title_${B.$index}`]},{default:d(()=>[o("span",{class:"fct-inventory-cell-text truncate block",ref:V=>c(V,`title_${B.$index}`)},m(B.row.variation_title||"--"),513)]),_:2},1032,["content","disabled"]),((Q=B.row.other_info)==null?void 0:Q.payment_type)==="subscription"?(r(),h("span",az,m(B.row.other_info.repeat_interval),1)):x("",!0)],2)]}),_:1},8,["label"]),n(b,{label:A(u)("SKU"),width:"220"},{default:d(B=>[n(mc,{variant:B.row,"product-title":e.product.post_title,onSaved:U=>B.row.sku=U},null,8,["variant","product-title","onSaved"])]),_:1},8,["label"]),n(b,{label:A(u)("Total Stock"),width:"120"},{default:d(B=>[o("div",null,[n(S,{modelValue:B.row.total_stock,"onUpdate:modelValue":U=>B.row.total_stock=U,class:"input-with-total-stock fct-input-group",readonly:"",size:"small",onClick:U=>{var Q;return(Q=s.value[B.$index])==null?void 0:Q.toggle()}},{append:d(()=>[n(Gr,{ref:U=>s.value[B.$index]=U,variant:B.row,"field-key":B.$index,"product-edit-model":e.productEditModel,onSave:U=>_(B.$index),onClick:v[1]||(v[1]=Ge(()=>{},["stop"]))},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue","onClick"])])]),_:1},8,["label"]),n(b,{label:A(u)("Available"),width:"100"},{default:d(B=>[o("span",lz,m(A(u)(B.row.available)),1)]),_:1},8,["label"]),n(b,{label:A(u)("On hold"),width:"100"},{default:d(B=>[o("span",sz,m(A(u)(B.row.on_hold)),1)]),_:1},8,["label"]),n(b,{label:A(u)("Delivered"),width:"100"},{default:d(B=>[o("span",nz,m(A(u)(B.row.committed)),1)]),_:1},8,["label"])]),_:1},8,["data"])]),o("div",oz,[(r(!0),h(P,null,te(e.product.variants,(B,U)=>(r(),h("div",{key:U,class:de(["fct-product-inventory-mobile-row",f(B)])},[o("div",iz,[o("div",rz,m(B.variation_title||"--"),1),n(mc,{variant:B,"product-title":e.product.post_title,class:"mt-1 mb-2",onSaved:Q=>B.sku=Q},null,8,["variant","product-title","onSaved"])]),o("div",dz,[n(S,{modelValue:B.total_stock,"onUpdate:modelValue":Q=>B.total_stock=Q,class:"input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(Gr,{variant:B,"field-key":U,"product-edit-model":e.productEditModel,onSave:Q=>_(U)},null,8,["variant","field-key","product-edit-model","onSave"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",uz,[o("ul",null,[o("li",null,[o("span",null,m(A(u)("Available"))+":",1),R(" "+m(B.available.toString()),1)]),o("li",null,[o("span",null,m(A(u)("On Hold"))+":",1),R(" "+m(B.on_hold.toString()),1)]),o("li",null,[o("span",null,m(A(u)("Delivered"))+":",1),R(" "+m(B.committed.toString()),1)])])])],2))),128))])]),_:1})]),_:1},8,["visible"])]}),_:1})])):x("",!0)}}},Az={class:"el-form el-form--default el-form--label-top"},mf={__name:"SingleFileForm",props:{product:Object,file:Object,index:Number,productDownloadableModel:Object,singleMode:{type:Boolean,default:!1},isEditing:{type:Boolean,default:!1}},setup(e){const t=e,a=K(()=>Yo(t.product));return Ds(()=>{var l;if(t.file&&typeof t.file.product_variation_id=="string")try{t.file.product_variation_id=JSON.parse(t.file.product_variation_id),t.file.product_variation_id=t.file.product_variation_id.map(s=>parseInt(s))}catch{}if(t.file&&Array.isArray(t.file.product_variation_id)&&((l=t.product)!=null&&l.variants)){const s=Array.isArray(t.product.variants)?t.product.variants:[],i=new Set(s.map(p=>parseInt(p.id,10))),c=t.file.product_variation_id.filter(p=>i.has(parseInt(p,10)));c.length!==t.file.product_variation_id.length&&(t.file.product_variation_id=c)}}),(l,s)=>{const i=C("el-option"),c=C("el-select"),p=C("el-form-item"),f=C("el-input");return r(),h("div",Az,[n(p,{label:l.$t("Choose variant")},{default:d(()=>[n(c,{class:"",size:"small",modelValue:e.file.product_variation_id,"onUpdate:modelValue":s[0]||(s[0]=_=>e.file.product_variation_id=_),multiple:"",id:`downloadable_files.${e.index}.product_variation_id`,placeholder:l.$t("Keep empty for all"),"popper-class":"fct-choose-variant-popover","collapse-tags":"","collapse-tags-tooltip":""},{default:d(()=>[(r(!0),h(P,null,te(e.productDownloadableModel.generateVariantOptions(e.product),_=>(r(),E(i,{key:_.id,label:A(Pn)(_,a.value),value:_.id},{default:d(()=>[n(Wo,{variant:_,"group-order":a.value},null,8,["variant","group-order"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","id","placeholder"]),n(Aa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.product_variation_id`},null,8,["validation-errors","field-key"])]),_:1},8,["label"]),e.isEditing||e.productDownloadableModel.insertableFiles.length===1?(r(),E(p,{key:0},{default:d(()=>[n(mA,{isMultiple:!e.singleMode,onOnFileSelected:s[1]||(s[1]=_=>{const g=e.index,y=_;y.forEach((v,w)=>{e.isEditing?(y[w].serial=g+1,y[w].settings.download_limit=e.productDownloadableModel.data.downloadableFiles[g].settings.download_limit,y[w].settings.download_expiry=e.productDownloadableModel.data.downloadableFiles[g].settings.download_expiry,y.length>1?(y[w].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file=y[w]):(y[w].product_variation_id=e.productDownloadableModel.data.downloadableFiles[g].product_variation_id,e.file.file_name=y[w].file_name,e.file.file_path=y[w].file_path,e.file.file_size=y[w].file_size,e.file.file_url=y[w].file_url,e.file.title=y[w].title,e.file.type=y[w].type,e.file.driver=y[w].driver,e.file.settings=y[w].settings)):(y[w].serial=g+1,y[w].settings.download_limit=e.productDownloadableModel.insertableFiles[g].settings.download_limit,y[w].settings.download_expiry=e.productDownloadableModel.insertableFiles[g].settings.download_expiry,y.length>1?(y[w].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g+w]=y[w]):(y[w].product_variation_id=e.productDownloadableModel.insertableFiles[g].product_variation_id,e.productDownloadableModel.insertableFiles[g]=y[w]))})})},null,8,["isMultiple"]),n(Aa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.file_url`},null,8,["validation-errors","field-key"])]),_:1})):x("",!0),e.file.title?(r(),E(p,{key:1,label:l.$t("File Title")},{default:d(()=>[o("p",null,m(e.file.title),1),x("",!0),n(Aa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`downloadable_files.${e.index}.title`},null,8,["validation-errors","field-key"])]),_:1},8,["label"])):x("",!0),e.file.driver?(r(),E(p,{key:2},{default:d(()=>[o("p",null,m(A(u)("Driver: %s",e.file.driver)),1)]),_:1})):x("",!0)])}}},pz={key:0,class:"text-right"},fz={key:1,class:"px-6 py-3"},mz={class:"fct-product-download-inner-wrap flex flex-col gap-4"},hz={class:"fct-product-download-form-box"},_z={key:1},vz={__name:"ProductDownloadAddModal",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=K(()=>window.innerWidth<=768?"90%":"34%");return(a,l)=>{const s=C("el-button"),i=C("el-drawer");return r(),h(P,null,[o("div",{class:de(["add-download-btn",e.productDownloadableModel.hasVariationOption(e.product)?"px-6 py-3 border border-solid border-gray-divider border-x-0 border-b-0 dark:border-dark-400":""])},[e.productDownloadableModel.hasVariationOption(e.product)?(r(),h("div",pz,[n(s,{text:"",type:"primary",onClick:l[0]||(l[0]=()=>{e.productDownloadableModel.openAddModal()})},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(a.$t("Add")),1)]),_:1})])):(r(),h("div",fz,m(a.$t("No pricing added yet")),1))],2),n(i,{modelValue:e.productDownloadableModel.data.addModal.isModalOpen,"onUpdate:modelValue":l[4]||(l[4]=c=>e.productDownloadableModel.data.addModal.isModalOpen=c),size:t.value,onClose:l[5]||(l[5]=()=>{e.productDownloadableModel.clearInsertableFile()}),onOpen:l[6]||(l[6]=()=>{e.productDownloadableModel.addDummyInsertableFile()})},{header:d(()=>[n(pa,{title:a.$t("Add Downloadable Asset(s)"),content:a.$t("Attach the WordPress-supported digital files that customers will receive after purchasing this product. If this downloadable file is only for a specific product variation (e.g., 'eBook Version' or 'Audiobook Version'), please select that variant. Otherwise, you may leave the 'Choose variant' field empty to make the file available for all variants of this product. Please note that any additional files added after any sell will be accessible to both existing and new orders."),placement:"bottom"},null,8,["title","content"])]),footer:d(()=>[o("div",null,[n(s,{onClick:l[2]||(l[2]=c=>e.productDownloadableModel.data.addModal.isModalOpen=!1)},{default:d(()=>[R(m(a.$t("Cancel")),1)]),_:1}),n(s,{type:"primary",onClick:l[3]||(l[3]=()=>{e.productDownloadableModel.attachInsertableFiles(e.product.ID)}),loading:e.productDownloadableModel.data.saving},{default:d(()=>[R(m(a.$t("Save Asset")),1)]),_:1},8,["loading"])])]),default:d(()=>[o("div",mz,[e.productDownloadableModel.insertableFiles.length?(r(!0),h(P,{key:0},te(e.productDownloadableModel.insertableFiles,(c,p)=>(r(),h("div",hz,[e.productDownloadableModel.insertableFiles.length>1?(r(),E(s,{key:0,onClick:f=>e.productDownloadableModel.deleteInsertableFile(p),size:"small",plain:"",class:"absolute right-2 top-2 p-0 border-none hover:text-red-500"},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])):x("",!0),n(mf,{product:e.product,file:c,index:p,productDownloadableModel:e.productDownloadableModel},null,8,["product","file","index","productDownloadableModel"])]))),256)):x("",!0),e.productDownloadableModel.insertableFiles.length>1?(r(),h("div",_z,[n(mA,{uploadBtnText:A(u)("Add More Files"),onOnFileSelected:l[1]||(l[1]=c=>{const p=e.productDownloadableModel.insertableFiles.length-1,f=c;f.value.forEach((_,g)=>{f.value[g].serial=p+1,f.value[g].settings.download_limit=e.productDownloadableModel.insertableFiles[p].settings.download_limit,f.value[g].settings.download_expiry=e.productDownloadableModel.insertableFiles[p].settings.download_expiry,f.value[g].product_variation_id=e.productDownloadableModel.insertableFiles[p].product_variation_id,e.productDownloadableModel.insertableFiles.push(f.value[g])})})},null,8,["uploadBtnText"])])):x("",!0),(r(!0),h(P,null,te(e.product.variants,(c,p)=>(r(),h("div",{key:p},[n(Aa,{"validation-errors":e.productDownloadableModel.data.validationErrors,"field-key":`variants.${p}.downloadable`},null,8,["validation-errors","field-key"])]))),128))])]),_:1},8,["modelValue","size"])],64)}}},gz={class:"fct-product-download-form-wrap"},yz={class:"fct-product-download-form-box"},bz={__name:"ProductDownloadEditModal",props:{product:Object,productDownloadable:Object,productEditModel:Object,productDownloadableModel:Object,index:Number|String},setup(e){const t=e,a=K(()=>window.innerWidth<=768?"90%":"40%"),l=T({...t.productDownloadable}),s=t.productDownloadableModel.data.editModal.states;return Ds(()=>{s[t.index]={},s[t.index].visible=!1}),(i,c)=>{const p=C("el-button"),f=C("el-drawer");return r(),h(P,null,[n(f,{"append-to-body":"",modelValue:A(s)[e.index].visible,"onUpdate:modelValue":c[1]||(c[1]=_=>A(s)[e.index].visible=_),size:a.value,title:A(u)("Edit Downloadable Asset"),onClose:c[2]||(c[2]=()=>{e.productDownloadableModel.closeEditModal(e.index)})},{footer:d(()=>[n(p,{type:"primary",loading:e.productDownloadableModel.saving,onClick:c[0]||(c[0]=()=>{e.productDownloadableModel.updateDownloadableFile()})},{default:d(()=>[R(m(A(u)("Update")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",gz,[o("div",yz,[n(mf,{product:e.product,file:l.value,index:e.index,productDownloadableModel:e.productDownloadableModel,singleMode:!0,"is-editing":""},null,8,["product","file","index","productDownloadableModel"])])])]),_:1},8,["modelValue","size","title"]),o("div",{class:"el-dropdown-menu__item w-full",onClick:c[3]||(c[3]=Ge(()=>{A(s)[e.index].visible=!0,e.productDownloadableModel.openEditModal(e.index,l.value)},["prevent"]))},[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)])],64)}}},wz={class:"fct-product-download-wrap"},Cz={key:0,class:"fct-product-download-inner-wrap border border-x-0 border-b-0 border-solid border-gray-divider dark:border-dark-400"},kz={class:"fct-media-content-list"},Bz={class:"product-thumbnail bg-gray-100 rounded flex items-center justify-center dark:bg-dark-500"},xz={class:"product-details"},Sz={class:"product-details-content-row"},Fz={class:"product-details-content-first"},$z={class:"product-title text-sm font-medium text-system-dark dark:text-gray-50"},Ez={key:0,class:"font-normal text-system-mid"},Uz={class:"product-variation-title inline-flex"},Iz={key:1,class:"product-variation-title"},Qz={class:"product-details-content-second"},Dz={class:"more-btn"},Vz={__name:"ProductDownload",props:{product:Object,productEditModel:Object,productDownloadableModel:Object},setup(e){const t=e,a=function(s){Ae.get(`products/getDownloadableUrl/${s.id}`).then(i=>{as.copy(i.url)}).catch(i=>{q.error({title:u("Error"),message:u("Failed to copy file URL")})})},l=s=>{s.action==="copy-download-link"?a(s.data):s.action==="delete"&&t.productDownloadableModel.deleteDownloadableFile(s.data.id,s.idx)};return(s,i)=>{const c=C("el-switch"),p=C("el-popover"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",wz,[n(Se,null,{default:d(()=>{var y;return[n(Ve,{class:"pb-5"},{action:d(()=>[e.product.detail?(r(),E(c,{key:0,modelValue:e.product.detail.manage_downloadable,"onUpdate:modelValue":i[0]||(i[0]=v=>e.product.detail.manage_downloadable=v),"active-value":"1","inactive-value":"0","active-text":s.$t("Downloadable Asset(s)"),onChange:i[1]||(i[1]=v=>e.productEditModel.onChangeInputField("manage_downloadable",v))},null,8,["modelValue","active-text"])):x("",!0)]),_:1}),n(ya,{visible:((y=e.product.detail)==null?void 0:y.manage_downloadable.toString())==="1",accordion:""},{default:d(()=>[n(ke,{class:"p-0"},{default:d(()=>[e.productDownloadableModel.hasDownloadableFiles()?(r(),h("div",Cz,[o("div",kz,[(r(!0),h(P,null,te(e.productDownloadableModel.downloadableFiles,(v,w)=>(r(),h("div",{class:"fct-media-content-list-item",key:w},[o("div",Bz,m(v.type),1),o("div",xz,[o("div",Sz,[o("div",Fz,[o("div",$z,[R(m(v.title)+" ",1),v.driver!=="local"?(r(),h("span",Ez," - "+m(v.driver),1)):x("",!0)]),e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product).length?(r(),E(p,{key:0,placement:"top",trigger:"hover",width:200},{reference:d(()=>[o("div",Uz," – "+m(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1)]),default:d(()=>[(r(!0),h(P,null,te(e.productDownloadableModel.getHiddenVariationNames(v.product_variation_id,e.product),(k,b)=>(r(),h("div",{style:{"margin-top":"4px"},key:b},m(k),1))),128))]),_:2},1024)):(r(),h("div",Iz," – "+m(e.productDownloadableModel.generateDownloadableVariationName(v.product_variation_id,e.product)),1))]),o("div",Qz,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",placement:"bottom-end",onCommand:l},{dropdown:d(()=>[n(_,null,{default:d(()=>[n(f,{class:"item-link"},{default:d(()=>[n(bz,{product:e.product,productDownloadableModel:e.productDownloadableModel,productEditModel:e.productEditModel,productDownloadable:v,index:w},null,8,["product","productDownloadableModel","productEditModel","productDownloadable","index"])]),_:2},1024),n(f,{command:{action:"copy-download-link",data:v}},{default:d(()=>[n(Y,{name:"Copy"}),R(" "+m(A(u)("Copy Download Link")),1)]),_:2},1032,["command"]),n(f,{command:{action:"delete",data:v,idx:w},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",Dz,[n(Y,{name:"More"})])]),_:2},1024)])])])]))),128))])])):x("",!0),n(vz,{product:e.product,productEditModel:e.productEditModel,productDownloadableModel:e.productDownloadableModel},null,8,["product","productEditModel","productDownloadableModel"])]),_:1})]),_:1},8,["visible"])]}),_:1})])}}},Tz={class:"fct-product-status-wrap"},Mz={class:"fct-admin-summary-item-list"},Lz={class:"fct-admin-summary-item"},Rz={class:"fct-admin-summary-item-title"},Oz={class:"fct-product-status-chosen-wrap",id:"fct-product-status-chosen-wrap"},Pz={id:"fct-product-status-chosen-dropdown",class:"fct-product-status-chosen-dropdown"},Hz={key:0,style:{"margin-top":"20px"}},Nz={class:"title"},Kz={key:1},Gz={class:"text-sm text-gray-500 mt-4"},zz={class:"capitalize"},jz={key:1},qz={class:"fct-admin-summary-item"},Yz={class:"fct-admin-summary-item-title flex items-center gap-1"},Wz=["href"],Jz={class:"fct-product-url-slug-container"},Xz={class:"filter-popover-item fct-admin-summary-popover-item"},Zz={class:"filter-popover-title"},ej={class:"filter-popover-input-group"},tj={class:"fct-product-url-label"},aj=["href"],lj={class:"fct-product-url-slug"},sj={key:0,class:"fct-admin-summary-item"},nj={class:"fct-admin-summary-item-title"},oj={class:"fct-admin-summary-item-select"},ij={key:1,class:"fct-admin-summary-item"},rj={class:"fct-admin-summary-item-title"},dj={key:0,class:"fct-admin-summary-item-select"},uj={key:0,class:"mt-4 pt-4"},hc={__name:"ProductStatus",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(""),l=T(""),s=T(""),i=T(!1),c=v=>Pn(v,Yo(t.product))||v.variation_title;be(()=>{var v,w,k;return[(w=(v=t.product)==null?void 0:v.detail)==null?void 0:w.default_variation_id,(k=t.product)==null?void 0:k.variants]},([v,w])=>{var S;if(!v||!((S=t.product)!=null&&S.detail))return;(Array.isArray(w)?w:[]).some($=>String($.id)===String(v))||(t.product.detail.default_variation_id="",t.productEditModel&&typeof t.productEditModel.onChangeInputField=="function"&&t.productEditModel.onChangeInputField("default_variation_id",""))},{immediate:!0,deep:!1});const p=u("Customize the product's URL ending. Remember, this will affect SEO and readability. The URL will be activated when publish. Check Google's %s Structure Best Practices.",'<a href="https://developers.google.com/search/docs/crawling-indexing/url-structure">'+u("URL")+"</a>"),f=()=>t.product.variants.filter(w=>w.created_at).length>0,_=v=>{t.productEditModel.onChangeInputField("post_status",v),(v==="draft"||v==="publish")&&(i.value=!1)},g=()=>u("Status controls the product's visibility on the public page and its purchasability. 'Publish' indicates that it is live and can be purchased, 'Draft' signifies that it is in private editing, and 'Schedule' means it will be publish on a specified date. 'Private' means, Only visible to adminstrators but can be purchased via direct purchase link. The status can only be changed once pricing is set."),y={use_pricing_table:"no",group_pricing_by:"payment_type",sold_individually:"no"};return be(()=>t.product.detail,v=>{v&&(!v.other_info||Object.keys(v.other_info).length===0)&&(t.product.detail.other_info={...y})},{immediate:!0}),Ie(()=>{a.value=window.location.protocol,l.value=window.location.hostname,s.value=`${a.value}//${l.value}`}),(v,w)=>{const k=C("el-radio"),b=C("el-radio-group"),S=C("el-date-picker"),$=C("el-button"),D=C("el-popover"),F=C("el-input"),B=C("el-option"),U=C("el-select"),Q=C("el-checkbox");return r(),h("div",Tz,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Publishing"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>{var V,I;return[o("ul",Mz,[o("li",Lz,[o("span",Rz,[n(pa,{title:A(u)("Status"),content:g()},null,8,["title","content"])]),o("div",Oz,[f()?(r(),E(D,{key:0,trigger:"click",placement:"bottom-end",width:"300","popper-class":"filter-popover"},{reference:d(()=>[f()?(r(),E($,{key:0,id:"fct-product-status-toggle",type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",zz,m(e.product.post_status==="future"?A(u)("Scheduled"):e.product.post_status),1),n(Y,{name:"ChevronUpDown"})]),_:1})):(r(),h("span",jz,m(A(da).headline(e.product.post_status)),1))]),default:d(()=>[o("div",Pz,[n(b,{class:"fct-radios-blocks",modelValue:e.product.post_status,"onUpdate:modelValue":w[0]||(w[0]=M=>e.product.post_status=M),onChange:_},{default:d(()=>[n(k,{value:"draft"},{default:d(()=>[R(m(A(u)("Draft")),1)]),_:1}),n(k,{value:"future"},{default:d(()=>[R(m(A(u)("Scheduled")),1)]),_:1}),n(k,{value:"private"},{default:d(()=>[R(m(A(u)("Private (Invisible except Admin)")),1)]),_:1}),n(k,{value:"publish"},{default:d(()=>[R(m(A(u)("Publish")),1)]),_:1})]),_:1},8,["modelValue"]),e.product.post_status==="future"?(r(),h("div",Hz,[o("h3",Nz,m(A(u)("Scheduled Date")),1),n(S,{clearable:!1,modelValue:e.product.post_date,"onUpdate:modelValue":w[1]||(w[1]=M=>e.product.post_date=M),type:"datetime",placeholder:A(u)("Schedule Date"),"value-format":"YYYY-MM-DDTHH:mm:ssZ",onChange:w[2]||(w[2]=M=>{e.productEditModel.onChangeInputField("post_date",M)})},null,8,["modelValue","placeholder"])])):e.product.post_status==="private"?(r(),h("div",Kz,[o("p",Gz,m(A(u)("Note: Private products are only visible to administrators but can be purchased via direct purchase link.")),1)])):x("",!0)])]),_:1})):x("",!0)])]),o("li",qz,[o("span",Yz,[R(m(A(u)("URL Slug"))+" ",1),o("a",{href:e.product.view_url,class:"focus:outline-none focus:shadow-none",target:"_blank"},[n(Y,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})],8,Wz)]),o("div",Jz,[n(D,{trigger:"click",placement:"bottom-end",width:"250","popper-class":"filter-popover"},{reference:d(()=>[n($,{type:"primary",class:"is-tertiary el-button--x-small"},{default:d(()=>[o("span",null,m(e.product.post_name),1),n(Y,{name:"ChevronUpDown"})]),_:1})]),default:d(()=>[o("div",Xz,[o("h3",Zz,m(A(u)("URL")),1),o("div",ej,[n(pa,{title:A(u)("Permalink"),content:A(p),hideAfter:300},null,8,["title","content"]),n(F,{placeholder:A(u)("Slug"),type:"text",modelValue:e.product.post_name,"onUpdate:modelValue":w[3]||(w[3]=M=>e.product.post_name=M),onInput:w[4]||(w[4]=M=>{e.productEditModel.onChangeInputField("post_name",M)})},null,8,["placeholder","modelValue"])]),o("div",tj,m(A(u)("View Product")),1),o("a",{class:"fct-product-url-slug-wrap",target:"_blank",href:e.product.view_url,rel:"external noreferrer noopener"},[o("span",lj,m(e.product.view_url),1),n(Ea,{text:e.product.view_url,showMode:"basic_copy_btn",tooltipText:A(u)("Copy Link")},null,8,["text","tooltipText"])],8,aj)])]),_:1})])]),((V=e.product.detail)==null?void 0:V.variation_type)==="simple_variations"||((I=e.product.detail)==null?void 0:I.variation_type)==="advanced_variations"?(r(),h("li",sj,[o("span",nj,[n(pa,{title:A(u)("Default Variant"),content:A(u)("Select the default variant that users will see pre-selected on the product page.")},null,8,["title","content"])]),o("div",oj,[n(U,{class:"el-select--x-small",modelValue:e.product.detail.default_variation_id,"onUpdate:modelValue":w[5]||(w[5]=M=>e.product.detail.default_variation_id=M),placeholder:A(u)("Select Default Variant"),onChange:w[6]||(w[6]=M=>{e.productEditModel.onChangeInputField("default_variation_id",M)}),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(e.product.variants,M=>(r(),E(B,{key:M.id,label:c(M),value:M.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])])):x("",!0),e.product.detail&&e.product.detail.variation_type==="simple_variations"?(r(),h("li",ij,[o("span",rj,[n(pa,{title:A(u)("Pricing Table Layout"),content:A(u)("Organize product variations by repeat interval (Monthly, Yearly) or payment term (One time, Subscription).")},null,8,["title","content"])]),e.product.detail?(r(),h("div",dj,[n(U,{class:"el-select--x-small",clearable:"",modelValue:e.product.detail.other_info.group_pricing_by,"onUpdate:modelValue":w[7]||(w[7]=M=>e.product.detail.other_info.group_pricing_by=M),placeholder:A(u)("Pricing Table Layout"),onChange:w[8]||(w[8]=M=>{e.productEditModel.onChangeInputField("group_pricing_by",M)})},{default:d(()=>[n(B,{label:A(u)("Payment Term"),value:"payment_type"},null,8,["label"]),n(B,{label:A(u)("Repeat Interval"),value:"repeat_interval"},null,8,["label"]),n(B,{label:A(u)("None"),value:"none"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])])):x("",!0)])):x("",!0)]),e.product.detail?(r(),h("div",uj,[n(Q,{onChange:w[9]||(w[9]=M=>{e.productEditModel.onChangeInputField("sold_individually",M)}),modelValue:e.product.detail.other_info.sold_individually,"onUpdate:modelValue":w[10]||(w[10]=M=>e.product.detail.other_info.sold_individually=M),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Limit purchases to 1 item per order")),1)]),_:1},8,["modelValue"])])):x("",!0)]}),_:1})]),_:1})])}}},cj={class:"fct-product-media-wrap"},Aj={class:"fct-admin-summary-item"},pj={class:"fct-gallery-tab-label"},_c={__name:"ProductMedia",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=yn([]),l=yn({}),s=T({}),i=T({}),c=K(()=>Nm(i.value)),p=(B,U)=>{i.value=Wm(i.value,B,U)},f=()=>({product:t.product,productEditModel:t.productEditModel}),_=yn([]);let g=0;const y=()=>{var Q;const B=++g,U=Kd((Q=window.fluent_cart_admin)==null?void 0:Q.hooks,f());Km(U,t.product).then(V=>{B===g&&(_.value=V)})};Ie(y),be(()=>{var B,U;return(U=(B=t.product)==null?void 0:B.detail)==null?void 0:U.other_info},y,{deep:!0});const v=yn([]);let w=0;const k=T(!1),b=()=>{const B=++w;Gm(a.value,s.value).then(U=>{B===w&&(v.value=U,k.value=!1)})};be(s,b,{deep:!0});const S=()=>{var Q;const B=Kd((Q=window.fluent_cart_admin)==null?void 0:Q.hooks,f()),U={};B.forEach(V=>{U[V.name]=vs(V.component)}),a.value=B,l.value=U,s.value=Ym(B,t.product),i.value={},k.value=B.some(V=>V.items),b()},$=B=>{s.value=jm(a.value,s.value,B)},D=B=>{s.value=zm(a.value,s.value,B)},F=()=>{qm(a.value,s.value,f()),y()};return(B,U)=>{const Q=C("el-tag"),V=C("el-tab-pane");return r(),h("div",cj,[n(Se,null,{default:d(()=>[n(Ve,{title:B.$t("Media"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",Aj,[n(yl,{modelValue:e.product.gallery,"onUpdate:modelValue":U[0]||(U[0]=I=>e.product.gallery=I),compact:!1,title:B.$t("Product Gallery"),onChange:U[1]||(U[1]=I=>e.productEditModel.updateMedia("gallery",I)),busy:c.value,"extra-previews":_.value,"extra-items":v.value,"extra-items-loading":k.value,onOpen:S,onSave:F,onExtraReorder:$,onExtraRemove:D},oa({_:2},[a.value.length?{name:"extra-tabs",fn:d(()=>[(r(!0),h(P,null,te(a.value,I=>(r(),E(V,{key:I.name,name:I.name,lazy:"",class:de(`fct-gallery-tab-pane fct-gallery-tab-pane--${I.name}`)},{label:d(()=>[o("span",pj,m(I.label),1),A(Nd)(I,s.value[I.name])?(r(),E(Q,{key:0,size:"small",round:"",class:"fct-gallery-tab-label__badge"},{default:d(()=>[R(m(A(Nd)(I,s.value[I.name])),1)]),_:2},1024)):x("",!0)]),default:d(()=>[(r(),E(gl(l.value[I.name]),va({modelValue:s.value[I.name],"onUpdate:modelValue":M=>s.value[I.name]=M},{ref_for:!0},I.props,{onBusy:M=>p(I.name,M)}),null,16,["modelValue","onUpdate:modelValue","onBusy"]))]),_:2},1032,["name","class"]))),128))]),key:"0"}:void 0]),1032,["modelValue","title","busy","extra-previews","extra-items","extra-items-loading"])])]),_:1})]),_:1})])}}},fj={class:"fct-term-input-item"},mj={class:"el-tag__content"},hj=["innerHTML"],_j=["innerHTML"],vj={class:"pt-1.5 text-right"},gj={class:"relative w-3 h-3"},yj={class:"fct-term-add-input-wrap"},bj={__name:"TermInput",props:{modelValue:Array,taxonomy:Object,product_id:Number},emits:["update:modelValue","onChanged"],setup(e,{emit:t}){Jt().ctx;const a=e,l=t,s=T([]),i=T(!1),c=T(),p=T(""),f=T([]),_=T(""),g=T(!1);Ie(()=>{s.value=a.modelValue,f.value=a.taxonomy.terms,be(()=>a.taxonomy.terms,(U,Q)=>{f.value=U}),be(()=>a.modelValue,(U,Q)=>{g.value=!0,s.value=U})});const y=U=>{U.stopPropagation(),U.preventDefault(),S()},v=()=>{g.value&&Ae.post("products/sync-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,terms:s.value}).then(U=>{q.success(U.message),l("update:modelValue",s.value)}).catch(U=>{var Q;U.status_code=="422"?q.validationErrors(U):q.error((Q=U.data)==null?void 0:Q.message)}).finally(()=>{g.value=!1})},w=cd.debounce(U=>{b(U)},1200),k=()=>{l("update:modelValue",s.value)},b=U=>{g.value=!1,Ae.post("products/delete-taxonomy-term/"+a.product_id,{taxonomy:a.taxonomy.name,term:U}).then(Q=>{ln(Q.message),l("update:modelValue",s.value)}).catch(Q=>{var V;Q.status_code=="422"?q.validationErrors(Q):q.error((V=Q.data)==null?void 0:V.message)}).finally(()=>{g.value=!1})};[...s.value];const S=()=>{g.value=!0,Ae.post("products/add-product-terms",{term:{name:p.value,taxonomy:a.taxonomy.name,parent:_.value}}).then(U=>{i.value=!1,p.value="",U.term_ids.forEach(function(Q,V){f.value.push({value:Q,label:U.names[V]}),s.value.push(Q)}),v()}).catch(U=>{})},$=()=>{i.value=!i.value,i.value&&xe(()=>{c.value.focus()})},D={categories:"Category",types:"Type"};K(()=>{let U=a.taxonomy.label.replace(/product\s*/i,"").trim();return Object.keys(D).forEach(Q=>{U.toLowerCase().includes(Q)&&(U=U.replace(new RegExp(Q,"i"),D[Q]))}),U});const F=U=>{const Q=s.value.indexOf(U);Q>-1&&s.value.splice(Q,1),g.value=!1,w(U)},B=U=>{const Q=V=>{for(const I of V){if(I.value==U)return I.label;if(I.children&&I.children.length>0){const M=Q(I.children);if(M)return M}}return null};return Q(f.value)};return(U,Q)=>{const V=C("el-tag"),I=C("el-tree-select"),M=C("el-button"),O=C("el-input");return r(),h("div",fj,[n(I,{modelValue:s.value,"onUpdate:modelValue":Q[0]||(Q[0]=L=>s.value=L),data:f.value,multiple:"","render-after-expand":!1,"show-checkbox":"","check-strictly":"","check-on-click-node":"",onCheck:Q[1]||(Q[1]=()=>{g.value=!0}),onBlur:v,onChange:k,onRemoveTag:Q[2]||(Q[2]=L=>{g.value=!1,A(w)(L)})},{tag:d(()=>[(r(!0),h(P,null,te(s.value,(L,H)=>(r(),E(V,{key:H,closable:"",onClose:j=>F(L)},{default:d(()=>[o("span",mj,[o("span",{class:"el-select__tags-text",innerHTML:B(L)},null,8,hj)])]),_:2},1032,["onClose"]))),128))]),default:d(({data:L})=>[o("span",{innerHTML:L.label},null,8,_j)]),_:1},8,["modelValue","data"]),o("div",vj,[n(M,{text:"",onClick:$,size:"small"},{default:d(()=>[o("span",gj,[n(ya,{visible:i.value,fade:""},{default:d(()=>[n(Y,{name:"Cross",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"]),n(ya,{visible:!i.value,fade:""},{default:d(()=>[n(Y,{name:"Plus",class:"absolute justify-center inset-0 w-full he-full"})]),_:1},8,["visible"])]),R(" "+m(A(u)("Add %s",a.taxonomy.labels.singular_name)),1)]),_:1})]),n(ya,{visible:i.value,accordion:""},{default:d(()=>[o("div",yj,[n(O,{modelValue:p.value,"onUpdate:modelValue":Q[3]||(Q[3]=L=>p.value=L),ref_key:"inputRef",ref:c,onKeydown:xa(y,["enter"])},null,8,["modelValue"]),n(M,{type:"info",plain:"",onClick:S,class:"el-button--x-small"},{default:d(()=>[R(m(A(u)("Add")),1)]),_:1})])]),_:1},8,["visible"])])}}},wj={class:"fct-product-simple-wrap"},Cj={__name:"ProductTermTaxonomy",props:{product:Object,productEditModel:Object},setup(e){return(t,a)=>(r(),h("div",wj,[n(Se,null,{default:d(()=>[n(Ve,{title:t.$t("Product Taxonomies"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[(r(!0),h(P,null,te(e.product.taxonomies,l=>(r(),h("div",{class:"fct-admin-summary-item",key:l.id},[o("h4",null,m(l.labels.name),1),n(bj,{product_id:e.product.ID,taxonomy:l,modelValue:e.product.product_terms[l.name],"onUpdate:modelValue":s=>e.product.product_terms[l.name]=s},null,8,["product_id","taxonomy","modelValue","onUpdate:modelValue"])]))),128))]),_:1})]),_:1})]))}};class kj extends tl{constructor(){super(...arguments);Pe(this,"data",{downloadableFiles:{},sourceProduct:null,addModal:{files:[],isModalOpen:!1},editModal:{file:{},isCurrentlyEditing:!1,states:{},currentIndex:-1},validationErrors:{},saving:!1});Pe(this,"generateDownloadableVariationName",(a,l)=>{if(!a)return u("For all variants");let s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{}else typeof a=="object"&&(s=Object.values(a));if(s.length===0)return u("For all variants");const i=Yo(l),c=l.variants.reduce((f,_)=>(f[_.id]=Pn(_,i),f),{}),p=s.map(f=>c[f]).filter(Boolean);return p.length===0?"--":p.length===1?p[0]:`${p[0]} +${p.length-1}`});Pe(this,"deleteDownloadableFile",(a,l)=>{Mn.ofDelete(u("Deleting this asset will break the download link in existing purchase emails. To update the file, edit the asset instead of deleting it.")).then(()=>{Ae.delete(`products/${a}/delete`).then(()=>{q.success(u("Downloadable File Deleted Successfully")),this.downloadableFiles.splice(l,1)}).catch(s=>{q.error(u("Failed To Delete"))})}).catch(()=>{})});Pe(this,"addDummyDownloadableFileForAllVariant",a=>{this.data.addModal.files=this.data.addModal.files.filter(l=>Object.values(l).every(s=>s!=null&&s!=="")),Object.values(this.generateVariantOptions(a)).forEach(l=>{l.id>0&&this.addDummyInsertableFile(l.id)})});Pe(this,"deleteInsertableFile",a=>{this.insertableFiles.splice(a,1)});Pe(this,"clearInsertableFile",()=>{this.data.addModal.files=[]});Pe(this,"attachInsertableFiles",a=>{this.setSaving(!0),Ae.post(`products/${a}/sync-downloadable-files`,{downloadable_files:this.insertableFiles}).then(l=>{this.setDownloadableFiles(l.downloadable_files),this.syncToSourceProduct(),this.closeAddModal(),q.success(u("Variations Synced Successfully"))}).catch(l=>{this.setSaving(!1),l.status_code=="422"?this.setValidationError(l.data):q.error(u("Please fill up all the fields"))}).finally(()=>{this.setSaving(!1)})});Pe(this,"openAddModal",()=>{this.data.addModal.isModalOpen=!0});Pe(this,"closeAddModal",()=>{this.data.addModal.isModalOpen=!1,this.resetValidationError()});Pe(this,"openEditModal",(a,l)=>{this.data.editModal.isCurrentlyEditing=!0,this.data.editModal.states[a].visible=!0,this.data.editModal.states[a].file=l,this.data.editModal.currentIndex=a});Pe(this,"closeEditModal",a=>{this.data.editModal.isCurrentlyEditing=!1,this.data.editModal.states[a].visible=!1,this.data.editModal.states[a].file=null,this.data.editModal.currentIndex=-1,this.resetValidationError()});Pe(this,"isEditModalOpen",()=>this.data.editModal.isCurrentlyEditing===!0);Pe(this,"setValidationError",a=>{this.data.validationErrors=a});Pe(this,"hasValidationError",a=>this.data.validationErrors.hasOwnProperty(a));Pe(this,"clearValidationError",()=>{this.data.validationErrors={}});Pe(this,"deleteValidationError",a=>{this.data.validationErrors.hasOwnProperty(a)&&delete this.data.validationErrors[a]})}setDownloadableFiles(a,l=null){a=a.map(s=>{if(typeof s.settings=="string")try{s.settings=JSON.parse(s.settings)}catch{}return s}),this.data.downloadableFiles=a,l&&(this.data.sourceProduct=l)}syncToSourceProduct(){this.data.sourceProduct&&Array.isArray(this.data.downloadableFiles)&&(this.data.sourceProduct.downloadable_files=[...this.data.downloadableFiles])}get downloadableFiles(){return this.data.downloadableFiles}get saving(){return this.data.saving}setSaving(a){this.data.saving=a}hasDownloadableFiles(){return Array.isArray(this.data.downloadableFiles)&&this.data.downloadableFiles.length>0}getHiddenVariationNames(a,l){if(!a)return[];let s=[];if(typeof a=="string")try{s=JSON.parse(a)}catch{return[]}else typeof a=="object"&&(s=Object.values(a));const i=Yo(l),c=l.variants.reduce((f,_)=>(f[_.id]=Pn(_,i),f),{});return s.map(f=>c[f]).filter(Boolean).slice(1)}generateVariantOptions(a){return[...a.variants.filter(s=>s.created_at)]}hasVariationOption(a){return Object.values(this.generateVariantOptions(a)).length>0}get downloadableFileSchema(){return{product_variation_id:[],title:"",type:"",driver:"",file_name:"",file_path:"",file_url:"",file_size:"",settings:{download_limit:"",download_expiry:"",bucket:""},serial:""}}setInsertableFiles(a){this.data.addModal.files=a}get insertableFiles(){return this.data.addModal.files}addDummyInsertableFile(a=null){const l=this.downloadableFileSchema;a&&(l.product_variation_id=[a]),this.data.addModal.files.push(l)}getCurrentEditableIndex(){return this.data.editModal.currentIndex}getCurrentEditableFile(){var a;return((a=this.data.editModal.states[this.getCurrentEditableIndex()])==null?void 0:a.file)??null}updateDownloadableFile(){const a=this.getCurrentEditableFile(),l=this.getCurrentEditableIndex();!a||l<0||(this.setSaving(!0),Ae.put("products/"+a.id+"/update",a).then(s=>{this.closeEditModal(l),q.success(s.message),this.downloadableFiles[l]={...a},this.syncToSourceProduct()}).catch(s=>{s.hasOwnProperty("message")?q.error(s.message):q.error(u("Failed To Update"))}).finally(()=>{this.setSaving(!1)}))}resetValidationError(){this.data.validationErrors={}}isAddModalOpen(){return this.data.addModal.isModalOpen}}function Bj(){return kj.init()}const xj={class:"fct-product-simple-wrap"},Sj={class:"flex items-center gap-1 justify-between w-full"},Fj={class:"fct-shipping-class-select-wrap relative"},$j={class:"fct-select-option-with-leftright-value"},Ej={class:"text-sm text-gray-500"},Uj={class:"pt-1.5 text-right"},Ij={key:0},Qj={class:"mb-0 mt-2"},Dj={__name:"ShippingClass",props:{product:Object,productEditModel:Object},setup(e){const t=e,a=T(dt.get(t,"product.detail.other_info.shipping_class")),l=T(),s=T(!1),i=T(!1),c=T([]),p=ze.get("admin_url")+"settings/shipping/shipping_classes",f=(k="")=>{i.value=!0,c.value=[],Ae.get("shipping/classes",{search:k}).then(b=>{c.value=b.shipping_classes.data,g()}).finally(()=>{i.value=!1})},_=k=>{f(),k.id&&(a.value=k.id,t.productEditModel.onChangeInputField("shipping_class",a.value))},g=()=>{const k=dt.where(c.value,"id",a.value);l.value=dt.get(k,"0")},y=()=>{s.value=!0},v=()=>{a.value&&Ae.post("products/"+t.product.ID+"/shipping-class",{shipping_class:a.value}).then(k=>{q.success(k.message)}).catch(k=>{var b;k.status_code=="422"?q.validationErrors(k):q.error((b=k.data)==null?void 0:b.message)})},w=()=>{Ae.post("products/"+t.product.ID+"/shipping-class/remove").then(k=>{q.success(k.message)}).catch(k=>{var b;k.status_code=="422"?q.validationErrors(k):q.error((b=k.data)==null?void 0:b.message)})};return Ie(()=>{f()}),(k,b)=>{const S=C("el-option"),$=C("el-select"),D=C("el-button");return r(),h("div",xj,[n(Se,null,{default:d(()=>[n(Ve,{border_bottom:""},{default:d(()=>[o("div",Sj,[n(pa,{title:A(u)("Shipping Class"),content:A(u)("Use a shipping class to group products with similar shipping requirements. This allows you to set specific shipping rates for different types of items, such as 'Bulky Items', 'Fragile Goods'. Select an existing class from the search box or click + Add to create a new one. If no class is assigned, the product will use your store's default shipping rates.")},null,8,["title","content"]),o("a",{href:p,class:"focus:outline-none focus:shadow-none w-4 h-4 inline-flex items-center justify-center",target:"_blank"},[n(Y,{name:"Redirect",class:"w-3 h-3 text-primary-500 dark:text-gray-200"})])])]),_:1}),n(ke,null,{default:d(()=>[o("div",Fj,[n($,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=F=>a.value=F),remote:"",placeholder:A(u)("Search Shipping Class"),"remote-method":f,loading:i.value,filterable:"",clearable:"",onChange:v,onClear:w,"popper-class":"fct-shipping-class-select"},{default:d(()=>[(r(!0),h(P,null,te(c.value,F=>(r(),E(S,{key:F.id,label:F.name,value:F.id},{default:d(()=>[o("div",$j,[R(m(F.name)+" ",1),o("span",Ej,m(F.type==="percentage"?F.cost+"%":A(ft).formatNumber(F.cost*100,!0)),1)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"]),o("div",Uj,[n(D,{onClick:Ge(y,["stop"]),size:"small",text:""},{default:d(()=>[n(Y,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add Shipping Class")),1)]),_:1})])]),l.value?(r(),h("div",Ij,[o("p",Qj,m(A(u)("Cost: %s",l.value.type==="percentage"?l.value.cost+"%":A(ft).formatNumber(l.value.cost*100,!0))),1)])):x("",!0)]),_:1})]),_:1}),n(km,{modelValue:s.value,"onUpdate:modelValue":b[1]||(b[1]=F=>s.value=F),onSaved:_},null,8,["modelValue"])])}}},Vj={key:0,class:"fct-product-inventory-wrap"},Tj={class:"fct-product-inventory-inner-wrap hide-on-mobile"},Mj={class:"space-x-5"},Lj={key:0,class:"fct-variant-badge bg-white border border-solid border-gray-outline text-primary-500 rounded-xs dark:bg-primary-700 dark:text-gray-50 dark:border-primary-500"},Rj={key:1},Oj={class:"fct-card-header-title"},Pj={class:"fct-product-inventory-pro-text"},Hj={class:"m-0"},Nj={__name:"ProductBundleSelector",props:{product:Object,productEditModel:Object},emits:["update:modelValue"],setup(e,{emit:t}){const a=e,l=ze.get("app_config.isProActive"),s=T([]);Ie(()=>{a.productEditModel.addOnProductUpdatedListener("bundle",function(){p()}),p()});const i=(f,_)=>{Ae.post(`products/save-bundle-info/${f}`,{bundle_child_ids:_}).then(g=>{q.success(u("Bundle info saved successfully"))}).catch(g=>{(g==null?void 0:g.status_code)=="422"?q.validationErrors(g):q.error(g==null?void 0:g.message)})},c=T(!0),p=()=>{c.value=!0,Ae.get(`products/get-bundle-info/${a.product.ID}`).then(f=>{s.value=f,c.value=!1})};return(f,_)=>{const g=C("el-table-column"),y=C("el-table");return A(l)?(r(),h("div",Vj,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Map bundle items")},null,8,["title"]),n(ya,{visible:!0,accordion:""},{default:d(()=>[n(ke,{class:"px-0 pb-0"},{default:d(()=>[o("div",Tj,[c.value?x("",!0):(r(),E(y,{key:0,data:s.value},{default:d(()=>[e.product.detail.variation_type!=="simple"?(r(),E(g,{key:0,label:A(u)("Title"),width:"140"},{default:d(v=>{var w;return[o("div",Mj,[o("span",null,m(v.row.variation_title),1),((w=v.row.other_info)==null?void 0:w.payment_type)==="subscription"?(r(),h("span",Lj,m(v.row.other_info.repeat_interval),1)):x("",!0)])]}),_:1},8,["label"])):x("",!0),n(g,{label:A(u)("Bundle Items"),width:"140"},{default:d(v=>[n(fA,{modelValue:v.row.bundle_child_ids,"onUpdate:modelValue":w=>v.row.bundle_child_ids=w,is_multiple:!0,popoverClass:"fct-create-new-order-bump-modal-popover",onVisibleChange:w=>{w||i(v.row.id,v.row.bundle_child_ids)},scopes:["nonBundle"]},null,8,["modelValue","onUpdate:modelValue","onVisibleChange"])]),_:1},8,["label"])]),_:1},8,["data"]))])]),_:1})]),_:1})]),_:1})])):(r(),h("div",Rj,[n(Se,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h2",Oj,[R(m(A(u)("Map bundle items"))+" ",1),n(Y,{name:"Crown",class:"w-4 h-4 text-warning-500"})])]),_:1}),n(ke,null,{default:d(()=>[o("div",Pj,[o("p",Hj,m(A(u)("This feature is only available for pro version.")),1)])]),_:1})]),_:1})]))}}},Kj={class:"fct-edit-product-wrapper fct-layout-width"},Gj={class:"fct-btn-group sm"},zj={class:"hide-on-mobile"},jj={class:"show-on-mobile"},qj=["href"],Yj={key:1,class:"single-page-body"},Wj=["innerHTML"],Jj={class:"fct-product-edit"},Xj={class:"fct-product-main"},Zj={class:"fct-show-on-tablet fct-product-publish-and-media-widgets el-form el-form--default el-form--label-top"},eq={class:"fct-product-aside"},tq={class:"el-form el-form--default el-form--label-top"},aq={key:1},lq={__name:"EditProduct",props:{product:Object,product_id:String,taxonomies:Object},setup(e){const t=e,a=T(),l=B7();let s=null;const i=Bj();l.setProductDownloadableModel(i);const c=T(!1),p=w=>{var k,b;c.value=!1,l.setProduct(w),s=l.data.product,i.setDownloadableFiles(w.downloadable_files,w),s.gallery=((b=(k=s==null?void 0:s.detail)==null?void 0:k.gallery_image)==null?void 0:b.meta_value)??[],s.taxonomies=t.taxonomies,s.product_terms={},Object.keys(s.taxonomies).map(S=>{s.product_terms[S]=s[S]??[]}),l.saveSnapshot(),c.value=!0};x7().onSave(()=>{var w;l.data.metaValue=(w=a.value)==null?void 0:w.getFormStates(),l.update()});const _=bs();_.bind(["mod+s"],w=>{var k;w.preventDefault(),l.data.hasChange&&(i.isAddModalOpen()?i.attachInsertableFiles(t.product.ID):i.isEditModalOpen()?i.updateDownloadableFile():(l.data.metaValue=(k=a.value)==null?void 0:k.getFormStates(),l.update()))});const g=()=>{l.setHasChange(!0)},y=w=>{w==="delete"&&l.delete()};ri("triggerChange",g);const v=oi("reload");return be(()=>t.product,(w,k)=>{w!==k&&p(w)}),Ie(()=>{p(t.product),l.setReloader(v);const w=document.querySelector(".fct-admin-product-header");w&&document.querySelector("#fluent_cart_plugin_app").prepend(w),l.addOnProductUpdatedListener("formreset",function(){var k;(k=a.value)==null||k.resetForms()})}),zc(()=>{_.unbind("mod+s")}),(w,k)=>{const b=C("el-button"),S=C("el-dropdown-item"),$=C("el-dropdown-menu"),D=C("el-dropdown");return r(),h("div",Kj,[(r(),E(ii,{to:"#fct-admin-product-header-buttons"},[o("div",Gj,[n(D,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:y},{dropdown:d(()=>[n($,null,{default:d(()=>[n(S,{command:"preview",class:"item-link"},{default:d(()=>[o("a",{href:A(l).viewUrl(),target:"_blank"},[n(Y,{name:"Eye"}),R(" "+m(A(u)("Preview")),1)],8,qj)]),_:1}),n(S,{command:"delete",class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:1})]),_:1})]),default:d(()=>[n(b,null,{default:d(()=>[o("span",zj,[R(m(A(u)("More Actions"))+" ",1),n(Y,{name:"ChevronDown"})]),o("span",jj,[n(Y,{name:"More"})])]),_:1})]),_:1})])])),c.value?(r(),E(un,{key:0,isActive:A(l).data.hasChange?"is-active":"",loading:A(l).data.saving,onDiscard:A(l).discard,onSave:k[0]||(k[0]=()=>{var F;A(l).data.metaValue=(F=a.value)==null?void 0:F.getFormStates(),A(l).update()}),saveButtonText:A(u)("Update"),"show-cmnd-icon":!0},null,8,["isActive","loading","onDiscard","saveButtonText"])):x("",!0),c.value?(r(),h("div",Yj,[A(l).shouldShowShippingMethodAlert()?(r(),E(el,{key:0,class:"mb-3",type:"warning",icon:"InformationFill"},{default:d(()=>[o("span",{innerHTML:A(u)("This Product has physical variants. Please %s",'<a href="'+A(l).shippingSettingsUrl()+'" target="_blank">'+A(u)("Add Shipping")+"</a>")},null,8,Wj)]),_:1})):x("",!0),A(l).isInDraft()?(r(),E(el,{key:1,class:"mb-3",type:"warning",icon:"InformationFill",content:A(u)("This product is currently in draft and cannot be sold to customers. Please publish the product to make it available for purchase.")},null,8,["content"])):x("",!0),o("div",Jj,[o("div",Xj,[n(j7,{product:A(s),productEditModel:A(l),reload:A(v)},null,8,["product","productEditModel","reload"]),o("div",Zj,[(r(),E(hc,{key:A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(_c,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])]),n(JG,{product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]),n(cz,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).isBundleProduct()?(r(),E(Nj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):x("",!0),A(l).isBundleProduct()?x("",!0):(r(),E(Vz,{key:1,product:A(s),productEditModel:A(l),productDownloadableModel:A(i)},null,8,["product","productEditModel","productDownloadableModel"]))]),o("div",eq,[o("div",tq,[(r(),E(hc,{class:"fct-hide-on-tablet",key:"aside-"+A(l).data.discardKey,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])),n(_c,{class:"fct-hide-on-tablet",product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),n(Cj,{product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"]),A(l).hasPhysicalVariation()?(r(),E(Dj,{key:0,product:A(s),productEditModel:A(l)},null,8,["product","productEditModel"])):x("",!0),A(s)?(r(),h("div",aq,[n(pn,{ref_key:"dynamicTemplates",ref:a,filter:"single_product_page","widgets-query":{product_id:A(s).ID},data:{editableProduct:A(s)}},null,8,["widgets-query","data"])])):x("",!0)])])])])):x("",!0)])}}},sq={class:"fct-upgrade-path-drawer-content"},nq={class:"fct-form-group"},oq={class:"fct-form-group"},iq={class:"fct-form-group"},rq={class:"fct-form-group"},dq={__name:"AddModal",props:{pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,productId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=T(!1),c=()=>{i.value=!0},p={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},f=T({...p}),_=T({}),g=ze.get("shop.currency_sign"),y=()=>{_.value={};const k={...f.value};(!Array.isArray(k.to_variants)||k.to_variants.length===0)&&(k.to_variants=[]),Ae.post(`products/${l.productId}/upgrade-path`,{...k}).then(b=>{q.success(b.message),f.value={...p},i.value=!1,s("pathGenerated")}).catch(b=>{if(_.value=b,b.message)return q.error(b.message)})},v=()=>f.value.from_variant?l.allVariants.filter(k=>{var b,S;return!((b=l.existingUpgradePathMap[f.value.from_variant])!=null&&b.includes(k.id)||(S=l.existingUpgradePathMap[f.value.from_variant])!=null&&S.includes(k.id.toString()))&&k.id!==f.value.from_variant}):[],w=k=>{let b=k==null?void 0:k.toString().replace(/^0+(?=\d)/,"");b===""&&(b="0"),parseInt(b)<0&&(b="0"),f.value.discount_amount=b};return t({openModal:c}),(k,b)=>{const S=C("el-option"),$=C("el-select"),D=C("el-checkbox"),F=C("el-input"),B=C("el-button"),U=C("el-drawer");return r(),E(U,{title:A(u)("Add Upgrade Path"),modelValue:i.value,"onUpdate:modelValue":b[5]||(b[5]=Q=>i.value=Q),onClosed:b[6]||(b[6]=()=>{i.value=!1,f.value={...p}}),"append-to-body":"",class:de(A(Te).isAdminBarEnabled()?"admin-bar-enable":""),"close-on-click-modal":!1},{footer:d(()=>[n(B,{onClick:b[4]||(b[4]=Q=>i.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(B,{onClick:y,type:"primary"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1})]),default:d(()=>[o("div",sq,[o("div",nq,[o("label",null,m(A(u)("From Plan")),1),n($,{modelValue:f.value.from_variant,"onUpdate:modelValue":b[0]||(b[0]=Q=>f.value.from_variant=Q),placeholder:A(u)("Select"),"popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(P,null,te(e.pathOptions,Q=>(r(),E(S,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:f.value.to_variants.includes(Q.id)},{default:d(()=>[n(Wo,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","placeholder"]),_.value.hasOwnProperty("from_variant")?(r(),E(Aa,{key:0,"validation-errors":_.value,"field-key":"from_variant"},null,8,["validation-errors"])):x("",!0)]),o("div",oq,[o("label",null,m(A(u)("To Plan(s)")),1),n($,{disabled:!f.value.from_variant,modelValue:f.value.to_variants,"onUpdate:modelValue":b[1]||(b[1]=Q=>f.value.to_variants=Q),multiple:"",placeholder:A(u)("Select"),clearable:"","popper-class":"fct-variation-select"},{default:d(()=>[(r(!0),h(P,null,te(v(),Q=>(r(),E(S,{key:Q.id,label:Q.variation_title,value:Q.id,disabled:Q.id==f.value.from_variant},{default:d(()=>[n(Wo,{variant:Q},null,8,["variant"])]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),_.value.hasOwnProperty("to_variants")?(r(),E(Aa,{key:0,"validation-errors":_.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),o("div",iq,[n(D,{"true-value":"1","false-value":"0",modelValue:f.value.is_prorate,"onUpdate:modelValue":b[2]||(b[2]=Q=>f.value.is_prorate=Q)},{default:d(()=>[R(m(A(u)("Prorate")),1)]),_:1},8,["modelValue"])]),o("div",rq,[o("label",null,m(A(u)("Discount Amount")),1),n(F,{modelValue:f.value.discount_amount,"onUpdate:modelValue":b[3]||(b[3]=Q=>f.value.discount_amount=Q),type:"number",min:0,onInput:w},{prepend:d(()=>[R(m(A(g)),1)]),_:1},8,["modelValue"]),_.value.hasOwnProperty("discount_amount")?(r(),E(Aa,{key:0,"validation-errors":_.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["title","modelValue","class"])}}},uq={class:"fct-upgrade-path-drawer-content"},cq={class:"fct-form-group"},Aq={class:"text"},pq={class:"fct-form-group"},fq={class:"fct-form-group"},mq={class:"fct-form-group"},vc={__name:"EditModal",props:{fromName:String,preSelectedFromVariant:{type:[String,Number]},preSelectedToVariants:{type:Array},preSelectedIsProrate:{type:[String,Number]},preSelectedDiscountAmount:{type:[String,Number]},pathOptions:Object,allVariants:Object,existingUpgradePathMap:Object,pathId:{type:[Number,String]}},emits:["pathGenerated"],setup(e,{emit:t}){const a=e,l=T({...a.existingUpgradePathMap}),s=t,i=T(!1),c={from_variant:"",to_variants:[],is_prorate:"0",discount_amount:"0"},p=T({...c}),f=T({}),_=()=>{f.value={};const w={...p.value};(!Array.isArray(w.to_variants)||w.to_variants.length===0)&&(w.to_variants=[]),Ae.post(`products/upgrade-path/${a.pathId}/update`,{...w}).then(k=>{q.success(k.message),p.value={...c},i.value=!1,s("pathGenerated")}).catch(k=>{if(f.value=k,k.message)return q.error(k.message)})},g=()=>p.value.from_variant?a.allVariants.filter(w=>{var k,b;return!((k=l[p.value.from_variant])!=null&&k.includes(w.id)||(b=l[p.value.from_variant])!=null&&b.includes(w.id.toString()))&&w.id.toString()!==p.value.from_variant.toString()}):[],y=()=>{p.value.from_variant=a.preSelectedFromVariant,p.value.is_prorate=a.preSelectedIsProrate,p.value.discount_amount=a.preSelectedDiscountAmount,p.value.to_variants=[];for(const w of a.preSelectedToVariants)p.value.to_variants.push(parseInt(w))},v=w=>{let k=w==null?void 0:w.toString().replace(/^0+(?=\d)/,"");k===""&&(k="0"),parseInt(k)<0&&(k="0"),p.value.discount_amount=k};return Ds(()=>{y()}),(w,k)=>{const b=C("el-option"),S=C("el-select"),$=C("el-checkbox"),D=C("el-input"),F=C("el-button"),B=C("el-drawer");return r(),h(P,null,[n(at,{size:"x-small",tag:"button",onClick:k[0]||(k[0]=()=>{i.value=!0})},{default:d(()=>[n(Y,{name:"Edit"})]),_:1}),n(B,{modelValue:i.value,"onUpdate:modelValue":k[5]||(k[5]=U=>i.value=U),title:w.$t("Update Upgrade Path"),onClosed:k[6]||(k[6]=()=>{i.value=!1,p.value={...c}}),onOpen:y,"append-to-body":""},{footer:d(()=>[n(F,{onClick:k[4]||(k[4]=U=>i.value=!1),size:"small"},{default:d(()=>[R(m(w.$t("Cancel")),1)]),_:1}),n(F,{onClick:_,size:"small",type:"primary"},{default:d(()=>[R(m(w.$t("Update")),1)]),_:1})]),default:d(()=>[o("div",uq,[o("div",cq,[o("label",null,m(w.$t("From Plan")),1),o("div",Aq,m(e.fromName),1)]),o("div",pq,[o("label",null,m(w.$t("To Plan(s)")),1),n(S,{disabled:!p.value.from_variant,modelValue:p.value.to_variants,"onUpdate:modelValue":k[1]||(k[1]=U=>p.value.to_variants=U),multiple:"",placeholder:w.$t("Select"),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(g(),U=>(r(),E(b,{key:U.id,label:U.variation_title,value:U.id,disabled:U.id==p.value.from_variant},null,8,["label","value","disabled"]))),128))]),_:1},8,["disabled","modelValue","placeholder"]),f.value.hasOwnProperty("to_variants")?(r(),E(Aa,{key:0,"validation-errors":f.value,"field-key":"to_variants"},null,8,["validation-errors"])):x("",!0)]),o("div",fq,[n($,{class:"m-2","true-value":"1","false-value":"0",modelValue:p.value.is_prorate,"onUpdate:modelValue":k[2]||(k[2]=U=>p.value.is_prorate=U)},{default:d(()=>[n(pa,{class:"flex items-center",title:w.$t("Prorate"),content:`The prorated amount, based on the remaining days, will be credited to the new plan. Upgrading from one-time payment, the full amount will be credited. | |
| 152 | + `},null,8,["title"])]),_:1},8,["modelValue"])]),o("div",mq,[o("label",null,m(w.$t("Discount Amount")),1),n(D,{modelValue:p.value.discount_amount,"onUpdate:modelValue":k[3]||(k[3]=U=>p.value.discount_amount=U),type:"number",min:"0",onInput:v},null,8,["modelValue"]),f.value.hasOwnProperty("discount_amount")?(r(),E(Aa,{key:0,"validation-errors":f.value,"field-key":"discount_amount"},null,8,["validation-errors"])):x("",!0)])])]),_:1},8,["modelValue","title"])],64)}}},hq={__name:"UpgradePathsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-table-column"),c=C("el-table");return r(),E(c,{data:[1,2,3,4,5]},{default:d(()=>[n(i,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("To Plan"),width:200},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Discount Amount"),width:110},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{label:A(u)("Is Prorate"),width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-4/5"})]),_:1})]),_:1},8,["label"]),n(i,{width:100},{default:d(()=>[n(s,{animated:"",class:"flex items-center min-h-[28px]"},{template:d(()=>[n(l,{varient:"p",class:"w-3/5"})]),_:1})]),_:1})]),_:1})}}},_q={class:"fct-upgrade-paths-wrap fct-layout-width"},vq={class:"grid gap-1"},gq={class:"text-system-dark dark:text-gray-50"},yq={class:"text-xs text-system-mid dark:text-gray-300"},bq={class:"flex gap-1 flex-wrap"},wq={key:0},Cq={key:1},kq={class:"fct-btn-group sm"},Bq={key:2,class:"fct-upgrade-paths-mobile"},xq={class:"from-plan"},Sq={class:"title"},Fq={class:"plan-title"},$q={key:0,class:"plan-billing-summary"},Eq={class:"to-plan"},Uq={class:"title"},Iq={class:"discount-amount"},Qq={class:"title"},Dq={key:0},Vq={key:1},Tq={class:"is-prorate"},Mq={class:"title"},Lq={class:"path-actions"},Rq={class:"title"},Oq={class:"fct-btn-group sm mt-3"},Pq={key:0,class:"py-6 text-center"},Hq={key:1},Nq={key:1,class:"border border-solid border-gray-divider mt-5 pt-5 border-x-0 border-b-0 dark:border-dark-400"},Kq={key:2,class:"border border-solid border-gray-divider mt-5 border-x-0 border-b-0 dark:border-dark-400"},Gq={__name:"UpgradePaths",props:{product:{type:Object,required:!0},product_id:{type:[String,Number],required:!0}},setup(e){const t=e,a=K(()=>dt.get(t.product,"detail.other_info.is_bundle_product")==="yes"),l=T(!1),s=T(null);T([]),T({status:"yes",paths:{}});const i=ze.get("app_config.isProActive"),c=T([]),p=K(()=>t.product.variants.filter(S=>{var D;return(((D=w.value[S.id])==null?void 0:D.length)||0)<v.value-1})),f=S=>{_()},_=async()=>{l.value=!0,Ae.get(`products/${t.product_id}/upgrade-paths`).then(function(S){c.value=S.data,k()}).catch(function(S){}).finally(()=>{l.value=!1})},g=T({}),y=T({}),v=T(dt.get(t.product,"variants",[]).length),w=T({}),k=()=>{t.product.variants.entries().forEach(([S,$])=>{g.value[$.id]=$.variation_title,y.value[$.id]=$.other_info.billing_summary}),w.value={},c.value.forEach(S=>{w.value.hasOwnProperty(S.object_id)?(w.value[S.object_id]=[...w.value[S.object_id].concat([...S.meta_value.to_variants])],w.value[S.object_id]=[...new Set(w.value[S.object_id])]):w.value[S.object_id]=[...S.meta_value.to_variants]})},b=S=>{Ae.delete(`products/upgrade-path/${S}/delete`).then(function($){_(),q.success($.message)}).catch(function($){})};return Ie(()=>{_();const S=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");S&&document.querySelector("#fluent_cart_plugin_app").prepend(S)}),(S,$)=>{const D=C("el-table-column"),F=C("el-tag"),B=C("el-table"),U=C("el-button");return r(),h(P,null,[o("div",_q,[n(A(Se),null,{default:d(()=>[n(A(Ve),{title:A(u)("Upgrade Paths")},null,8,["title"]),A(i)&&!a.value?(r(),h(P,{key:0},[n(A(ke),{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(hq,{key:0})):x("",!0),l.value?x("",!0):(r(),E(B,{key:1,class:"hide-on-mobile",data:c.value},{empty:d(()=>[R(m(A(u)("Control available upgrade options and offer tailored discounts when moving between plans.")),1)]),default:d(()=>[n(D,{label:A(u)("From Plan"),prop:"object_id",width:300},{default:d(Q=>[o("div",vq,[o("div",gq,m(A(dt).get(g.value,Q.row.object_id,"")),1),o("div",yq,m(A(dt).get(y.value,Q.row.object_id,"")),1)])]),_:1},8,["label"]),n(D,{label:A(u)("To Plan"),width:200},{default:d(Q=>[o("div",bq,[(r(!0),h(P,null,te(A(dt).get(Q.row,"meta_value.to_variants",[]),V=>(r(),h(P,{key:V},[A(dt).get(g.value,V)?(r(),E(F,{key:0},{default:d(()=>[R(m(A(dt).get(g.value,V)),1)]),_:2},1024)):x("",!0)],64))),128))])]),_:1},8,["label"]),n(D,{label:A(u)("Discount Amount"),width:110},{default:d(Q=>[Q.row.meta_value.discount_amount>0?(r(),h("span",wq,m(A(dt).get(Q.row,"meta_value.discount_amount","0")),1)):(r(),h("span",Cq,"--"))]),_:1},8,["label"]),n(D,{label:A(u)("Is Prorate"),width:100},{default:d(Q=>[R(m(A(dt).get(Q.row,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),_:1},8,["label"]),n(D,{width:100},{default:d(Q=>[o("div",kq,[n(vc,{pathId:Q.row.id,preSelectedToVariants:A(dt).get(Q.row,"meta_value.to_variants",[]),preSelectedIsProrate:A(dt).get(Q.row,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(dt).get(Q.row,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value,fromName:A(dt).get(g.value,Q.row.object_id,""),preSelectedFromVariant:Q.row.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(at,{size:"x-small",tag:"button",outline:"",onClick:()=>b(Q.row.id)},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1})]),_:1},8,["data"])),l.value?x("",!0):(r(),h("div",Bq,[(r(!0),h(P,null,te(c.value,(Q,V)=>(r(),h("div",{class:"fct-upgrade-paths-mobile-row",key:V},[o("div",xq,[o("div",Sq,m(A(u)("From Plan"))+": ",1),o("div",null,[o("div",Fq,m(A(dt).get(g.value,Q.object_id,"")),1),A(dt).get(y.value,Q.object_id,"")?(r(),h("div",$q,m(A(dt).get(y.value,Q.object_id,"")),1)):x("",!0)])]),o("div",Eq,[o("div",Uq,m(A(u)("To Plan"))+": ",1),(r(!0),h(P,null,te(A(dt).get(Q,"meta_value.to_variants",[]),I=>(r(),h(P,{key:I},[A(dt).get(g.value,I)?(r(),E(F,{key:0},{default:d(()=>[R(m(A(dt).get(g.value,I)),1)]),_:2},1024)):x("",!0)],64))),128))]),o("div",Iq,[o("div",Qq,m(A(u)("Discount Amount"))+": ",1),Q.meta_value.discount_amount>0?(r(),h("span",Dq,m(A(dt).get(Q,"meta_value.discount_amount","0")),1)):(r(),h("span",Vq,"--"))]),o("div",Tq,[o("div",Mq,m(A(u)("Is Prorate"))+": ",1),o("span",null,m(A(dt).get(Q,"meta_value.is_prorate","0")==="1"?"Yes":"No"),1)]),o("div",Lq,[o("div",Rq,m(A(u)("Actions"))+": ",1),o("div",Oq,[n(vc,{pathId:Q.id,preSelectedToVariants:A(dt).get(Q,"meta_value.to_variants",[]),preSelectedIsProrate:A(dt).get(Q,"meta_value.is_prorate","0"),preSelectedDiscountAmount:A(dt).get(Q,"meta_value.discount_amount","0"),pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value,fromName:A(dt).get(g.value,Q.object_id,""),preSelectedFromVariant:Q.object_id,onPathGenerated:f},null,8,["pathId","preSelectedToVariants","preSelectedIsProrate","preSelectedDiscountAmount","pathOptions","all-variants","existingUpgradePathMap","fromName","preSelectedFromVariant"]),n(at,{size:"x-small",tag:"button",outline:"",onClick:()=>b(Q.id)},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])])])]))),128)),c.value.length==0?(r(),h("div",Pq,m(A(u)("No upgrade paths found.")),1)):x("",!0)]))]),_:1}),l.value?x("",!0):(r(),E(A(Ad),{key:0},{default:d(()=>[p.value.length?(r(),E(U,{key:0,text:"",onClick:$[0]||($[0]=()=>{var Q;return(Q=s.value)==null?void 0:Q.openModal()})},{default:d(()=>[n(Y,{name:"Plus"}),R(" "+m(A(u)("Add Path")),1)]),_:1})):(r(),h("span",Hq,m(A(u)("No more upgrade paths available")),1))]),_:1}))],64)):A(i)?a.value?(r(),h("div",Kq,[n(Ct,{icon:"Empty/WebPage",title:A(u)("Upgrade Paths Temporarily Unavailable for Bundle Products"),text:A(u)("Upgrade paths feature is temporarily disabled for bundle products. This feature will be enabled in a future update.")},null,8,["title","text"])])):x("",!0):(r(),h("div",Nq,[n(dn,{class:"py-7.5",placement:"feature_lock_upgrade_paths",title:A(u)("Get access to this feature by Upgrading to FluentCart Pro"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))]),_:1})]),a.value?x("",!0):(r(),E(dq,{key:0,productId:e.product.ID,onPathGenerated:f,ref_key:"addModalRef",ref:s,pathOptions:p.value,"all-variants":e.product.variants,existingUpgradePathMap:w.value},null,8,["productId","pathOptions","all-variants","existingUpgradePathMap"]))],64)}}},zq={name:"ProductIntegrations",components:{IconButton:at,Empty:Ct,DynamicIcon:Y,CardFooter:Ad,CardBody:ke,CardHeader:Ve,CardContainer:Se},props:["product","product_id"],data(){return{product_id:this.product_id,selectedIntegrationType:"",integrationLists:[],showIntegrationDialog:!1,feeds:[],available_integrations:{},all_module_config_url:{},totalActiveModules:0,loading:!1}},computed:{Str(){return da},hasActiveModules(){return Object.values(this.available_integrations).some(e=>e.enabled)}},mounted(){this.fetchIntegrations();const e=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");e&&document.querySelector("#fluent_cart_plugin_app").prepend(e)},methods:{isEmpty:ud,fetchIntegrations(){this.loading=!0,this.$get(`products/${this.product_id}/integrations`).then(e=>{this.available_integrations=e.available_integrations,this.feeds=e.feeds,this.all_module_config_url=e.all_module_config_url}).catch(e=>{this.handleError(e.message||"Failed to load integrations")}).finally(()=>{this.loading=!1})},add(e){let t=this.available_integrations[e];if(!t.enabled){this.$confirm(t.configure_message,t.configure_title,{confirmButtonText:t.configure_button_text,cancelButtonText:"Cancel",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{window.location.href=t.global_configure_url});return}this.$router.push({name:"product_integration_feed_editor",params:{integration_id:0,integration_name:e}})},edit(e){this.$router.push({name:"product_integration_feed_editor",params:{integration_id:e.id,integration_name:e.provider}})},handleActive(e){let t={status:e.enabled,notification_id:e.id};this.$post(`products/${this.product_id}/integrations/feed/change-status`,t).then(a=>{this.handleSuccess(a.message)}).catch(a=>{this.handleError(a.responseJSON.data.message)})},remove(e,t){let a=t.$index,l={integration_id:e};this.$confirm("Are you sure you want to delete this integration?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.$del(`products/${this.product_id}/integrations/${e}`,l).then(s=>{this.handleSuccess(s.message),this.feeds.splice(a,1)}).catch(()=>{})}).catch(()=>{})},handleSuccess(e){this.$notify({type:"success",message:e,offset:40})},handleError(e){this.$notify({type:"error",message:e,offset:40})}}},jq={class:"fct-integration-settings fct-layout-width"},qq={key:0,class:"integration-actions"},Yq={key:0,class:"fct-empty-integration-wrap px-4 text-center mx-auto mb-5 md:max-w-[600px]"},Wq={class:"text-sm"},Jq={key:1,class:"fct-integrations-table-wrap"},Xq={class:"fct-integration-logo-wrap"},Zq=["src","alt"],eY={class:"text-xs text-gray-700"},tY=["onClick"],aY={class:"fct-event-triggers"},lY={class:"fct-event-triggers"},sY={class:"fct-btn-group sm"},nY={class:"fct-integration-table-footer"},oY=["href"],iY={target:"_blank",rel:"noopener",href:"https://docs.fluentcart.com"};function rY(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown"),y=C("CardHeader"),v=C("el-skeleton"),w=C("el-switch"),k=C("el-table-column"),b=C("el-tag"),S=C("el-popover"),$=C("IconButton"),D=C("el-tooltip"),F=C("Empty"),B=C("el-table"),U=C("CardBody"),Q=C("CardContainer"),V=Va("loading");return r(),h("div",jq,[n(Q,null,{default:d(()=>[n(y,{title:e.$t("Product Integrations")},{action:d(()=>[i.hasActiveModules?(r(),h("div",qq,[n(g,{onCommand:i.add,trigger:"click","popper-class":"fct-dropdown"},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(!0),h(P,null,te(s.available_integrations,(I,M)=>(r(),E(f,{key:M,command:M},{default:d(()=>[R(m(I.title),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[n(p,{type:"info",plain:"",size:"small"},{default:d(()=>[R(m(e.$t("Add Integration"))+" ",1),n(c,{name:"ChevronDown"})]),_:1})]),_:1},8,["onCommand"])])):x("",!0)]),_:1},8,["title"]),n(U,{class:"px-0 pb-0 pt-4"},{default:d(()=>[n(v,{class:"px-5 pb-5",loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?x("",!0):(r(),h(P,{key:0},[i.hasActiveModules?(r(),h("div",Jq,[Wt((r(),E(B,{data:s.feeds},{empty:d(()=>[n(F,{icon:"Folder",text:e.$t("No Integrations Available.")},null,8,["text"])]),default:d(()=>[n(k,{label:e.$t("Status"),width:90},{default:d(I=>[n(w,{"active-value":"yes","inactive-value":"no",onChange:M=>i.handleActive(I.row),modelValue:I.row.enabled,"onUpdate:modelValue":M=>I.row.enabled=M},null,8,["onChange","modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(k,{width:160,label:e.$t("Integration")},{default:d(I=>{var M,O;return[o("div",Xq,[(M=s.available_integrations[I.row.provider])!=null&&M.logo?(r(),h("img",{key:0,style:{"min-width":"24px"},class:"fct-integration-logo",src:s.available_integrations[I.row.provider].logo,alt:I.row.provider},null,8,Zq)):x("",!0),o("span",eY,m(((O=s.available_integrations[I.row.provider])==null?void 0:O.title)||I.row.provider),1)])]}),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Title")},{default:d(I=>[o("a",{class:"fct-action-link-btn",onClick:Ge(M=>i.edit(I.row),["prevent"]),href:"#"},m(I.row.name),9,tY)]),_:1},8,["label"]),n(k,{"min-width":150,label:e.$t("Triggers")},{default:d(I=>[o("div",aY,[(r(!0),h(P,null,te((I.row.feed.event_trigger||[]).slice(0,2),(M,O)=>(r(),E(b,{key:M},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+m(i.Str.headline(M)),1)]),_:2},1024))),128)),(I.row.feed.event_trigger||[]).length>2?(r(),E(S,{key:0,placement:"bottom",width:"300",trigger:"hover"},{reference:d(()=>[n(b,{type:"info"},{default:d(()=>[R(" +"+m((I.row.feed.event_trigger||[]).length-2),1)]),_:2},1024)]),default:d(()=>[o("div",lY,[(r(!0),h(P,null,te((I.row.feed.event_trigger||[]).slice(2),(M,O)=>(r(),E(b,{key:M+O},{default:d(()=>[n(c,{name:"Trigger"}),R(" "+m(i.Str.headline(M)),1)]),_:2},1024))),128))])]),_:2},1024)):x("",!0)])]),_:1},8,["label"]),n(k,{width:90},{default:d(I=>[o("div",sY,[n(D,{effect:"dark",content:e.$t("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",onClick:M=>i.edit(I.row),size:"x-small",hover:"primary"},{default:d(()=>[n(c,{name:"Edit"})]),_:2},1032,["onClick"])]),_:2},1032,["content"]),n(D,{effect:"dark",content:e.$t("Delete"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n($,{tag:"button",size:"x-small",onClick:M=>i.remove(I.row.id,I),hover:"danger"},{default:d(()=>[n(c,{name:"Delete"})]),_:2},1032,["onClick"])]),_:2},1032,["content"])])]),_:1})]),_:1},8,["data"])),[[V,s.loading]])])):(r(),h("div",Yq,[o("p",Wq,m(e.$t("You don't have any integration module enabled. Please go to integration modules and enable and configured from available modules")),1),n(p,{tag:"a",type:"primary",href:s.all_module_config_url},{default:d(()=>[R(m(e.$t("Configure Modules")),1)]),_:1},8,["href"])])),o("div",nY,[o("a",{href:s.all_module_config_url},m(e.$t("Check Global Integration Settings")),9,oY),o("a",iY,m(e.$t("View Documentations")),1)])],64))]),_:1})]),_:1})])}const gc=nt(zq,[["render",rY]]),dY={name:"SingleIntegration",components:{CardFooter:Ad,CardBody:ke,CardHeader:Ve,CardContainer:Se},props:["product","product_id","integration_id","integration_type"],data(){return{integration_id:this.integration_id,product_id:this.product_id,integration_type:this.integration_type||"",saving:!1,formData:{values:{name:"",integrationName:this.integration_type||"",description:""},fields:{integrationName:{type:"select",label:"Integration Type",placeholder:"Select Integration",options:[]}}}}},mounted(){this.fetchIntegrationData()},methods:{saveIntegration(){if(!this.formData.values.name){this.$notify({type:"error",message:"Integration name is required",offset:40});return}this.saving=!0;const e=this.integration_id?`products/${this.product_id}/integrations/${this.integration_id}`:`products/${this.product_id}/integrations`,t=this.integration_id?"put":"post";this[`$${t}`](e,{integration:this.formData.values}).then(a=>{this.saving=!1,this.$notify({type:"success",message:a.message||"Integration saved successfully",offset:40}),this.$router.push({name:"ProductIntegrations",params:{product_id:this.product_id}})}).catch(a=>{this.saving=!1,this.$notify({type:"error",message:(a==null?void 0:a.message)||"Failed to save integration",offset:40})})},fetchIntegrationData(){if(!this.integration_id){this.fetchIntegrationType();return}this.$get(`products/${this.product_id}/integrations/${this.integration_id}`).then(e=>{e.integration&&(this.formData.values={...e.integration},this.integration_type=e.integration.integrationName,this.fetchIntegrationType())}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration data",offset:40})})},fetchIntegrationType(){this.integration_type&&this.$get(`integration/settings?integration_name=${this.integration_type}`).then(e=>{e.settings_fields&&(this.formData.fields=e.settings_fields),Object.keys(this.formData.fields).forEach(t=>{this.formData.values[t]===void 0&&(this.formData.values[t]="")})}).catch(e=>{this.$notify({type:"error",message:e.message||"Failed to load integration fields",offset:40})})},compare(e,t,a){switch(t){case"=":return e===a;case"!=":return e!==a;default:return!0}},dependancyPass(e){if(e.dependency){const a=e.dependency.depends_on.split("/").reduce((l,s)=>l[s],this.formData.values);return this.compare(a,e.dependency.operator,e.dependency.value)}return!0}}},uY={class:"fct-integration-settings fct-layout-width"};function cY(e,t,a,l,s,i){const c=C("el-button"),p=C("CardHeader"),f=C("el-input"),_=C("el-form-item"),g=C("el-option"),y=C("el-select"),v=C("el-form"),w=C("CardBody"),k=C("CardContainer");return r(),h("div",uY,[n(k,null,{default:d(()=>[n(p,{border_bottom:"",title:s.integration_id?e.$t("Edit Integration"):e.$t("Add Integration")},{action:d(()=>[n(c,{onClick:i.saveIntegration,type:"primary",loading:s.saving},{default:d(()=>[R(m(e.$t("Save")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["title"]),n(w,null,{default:d(()=>[n(v,{"label-position":"top",model:s.formData.values,class:"integration-form"},{default:d(()=>[n(_,{label:e.$t("Integration Name"),required:""},{default:d(()=>[n(f,{modelValue:s.formData.values.name,"onUpdate:modelValue":t[0]||(t[0]=b=>s.formData.values.name=b),placeholder:e.$t("Enter a name for this integration")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),s.integration_id?x("",!0):(r(),E(_,{key:0,label:e.$t("Integration Type")},{default:d(()=>[n(y,{modelValue:s.formData.values.integrationName,"onUpdate:modelValue":t[1]||(t[1]=b=>s.formData.values.integrationName=b),disabled:"",class:"fct-select"},{default:d(()=>[(r(!0),h(P,null,te(s.formData.fields.integrationName.options,b=>(r(),E(g,{key:b.value,label:b.label,value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])),(r(!0),h(P,null,te(s.formData.fields,(b,S)=>(r(),h(P,{key:S},[S!=="integrationName"&&i.dependancyPass(b)?(r(),E(_,{key:0,label:b.label},{default:d(()=>[b.type==="text"?(r(),E(f,{key:0,modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="select"?(r(),E(y,{key:1,modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:b.placeholder,class:"fct-select"},{default:d(()=>[(r(!0),h(P,null,te(b.options,$=>(r(),E(g,{key:$.value,label:$.label,value:$.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):b.type==="textarea"?(r(),E(f,{key:2,type:"textarea",modelValue:s.formData.values[S],"onUpdate:modelValue":$=>s.formData.values[S]=$,placeholder:b.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:2},1032,["label"])):x("",!0)],64))),128))]),_:1},8,["model"])]),_:1})]),_:1})])}const AY=nt(dY,[["render",cY],["__scopeId","data-v-486bb338"]]),pY={class:"fct-reason-dropdown-wrap"},fY={class:"fct-reason-label"},hf=Object.assign({name:"ReasonDropdown"},{__name:"ReasonDropdown",props:{modelValue:{type:String,default:""}},emits:["update:modelValue","update:customReason"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=T(l.modelValue),c=T("");be(()=>l.modelValue,_=>{i.value=_});const p=()=>{s("update:modelValue",i.value),i.value==="other"&&s("update:customReason",c.value)},f=_=>{i.value=_,p()};return t({getValue:()=>i.value,getCustomReason:()=>c.value,setValue:_=>f(_),setCustomReason:_=>{c.value=_}}),(_,g)=>{const y=C("el-option"),v=C("el-select"),w=C("el-input");return r(),h("div",pY,[o("label",fY,m(A(u)("Reason")),1),n(v,{modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=k=>i.value=k),placeholder:A(u)("Select reason"),class:"w-full",onChange:p},{default:d(()=>[n(y,{label:A(u)("Received Stock"),value:"received"},null,8,["label"]),n(y,{label:A(u)("Damage/Loss"),value:"damage"},null,8,["label"]),n(y,{label:A(u)("Return/Refund"),value:"return"},null,8,["label"]),n(y,{label:A(u)("Count Correction"),value:"correction"},null,8,["label"]),n(y,{label:A(u)("Inventory Transfer"),value:"transfer"},null,8,["label"]),n(y,{label:A(u)("Other"),value:"other"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),n(ya,{visible:i.value==="other",accordion:"",duration:300},{default:d(()=>[n(w,{modelValue:c.value,"onUpdate:modelValue":g[1]||(g[1]=k=>c.value=k),type:"textarea",rows:3,placeholder:A(u)("Please describe the reason"),class:"fct-custom-reason-textarea",onInput:p},null,8,["modelValue","placeholder"])]),_:1},8,["visible"])])}}}),mY={class:"fct-adjust-by-wrap"},hY={class:"fct-adjust-by-row"},_Y={class:"fct-adjust-by-col"},vY={class:"title"},gY={class:"fct-adjust-by-col"},yY={class:"title"},bY={class:"fct-stock-info"},wY={class:"fct-adjust-reason-wrap"},CY={class:"fct-adjust-by-action"},_f=Object.assign({name:"InventoryStockAdjuster"},{__name:"InventoryStockAdjuster",props:{variant:{type:Object,required:!0}},emits:["save"],setup(e,{emit:t}){const a=e,l=t,s=oi("fctPendingStockSaves",null),i=K(()=>!!a.variant.stock_save_pending||!!(s!=null&&s.has(a.variant.id))),c=T(!1),p=T(0),f=T(a.variant.total_stock),_=T(""),g=T(""),y=T(null),v=T(null);be(i,($,D)=>{D&&!$&&c.value&&w()}),be(c,$=>{$&&(f.value=a.variant.total_stock,p.value=0,xe(()=>{var D,F,B;(D=y.value)==null||D.focus(),(B=(F=y.value)==null?void 0:F.select)==null||B.call(F)}))});const w=()=>{const $=p.value||0;let F=(parseInt(a.variant.total_stock)||0)+parseInt($);f.value=F<0?0:F},k=()=>{const $=f.value||0,D=parseInt(a.variant.total_stock)||0;p.value=parseInt($)-D},b=()=>{p.value=0,f.value=a.variant.total_stock,_.value="",g.value="",c.value=!1},S=()=>{i.value||(l("save",{variant:a.variant,newStock:f.value,adjustedQuantity:p.value,reason:_.value,customReason:_.value==="other"?g.value:""}),c.value=!1,b())};return($,D)=>{const F=C("el-input"),B=C("el-button"),U=C("el-popover");return r(),E(U,{visible:c.value,"popper-class":"fct-stock-dropdown fct-inventory-stock-dropdown",trigger:"click",placement:"bottom-end"},{reference:d(()=>[o("div",{class:"fct-stock-adjuster-trigger",onClick:D[4]||(D[4]=Q=>c.value=!c.value)},[n(Y,{name:"Configuration"})])]),default:d(()=>[o("div",mY,[o("div",hY,[o("div",_Y,[o("span",vY,m(A(u)("Adjust by")),1),n(F,{ref_key:"adjustByInput",ref:y,size:"small",placeholder:A(u)("Quantity"),type:"number",modelValue:p.value,"onUpdate:modelValue":D[0]||(D[0]=Q=>p.value=Q),modelModifiers:{number:!0},onInput:w},null,8,["placeholder","modelValue"])]),o("div",gY,[o("span",yY,m(A(u)("New Stock")),1),n(F,{size:"small",placeholder:A(u)("New Stock"),type:"number",modelValue:f.value,"onUpdate:modelValue":D[1]||(D[1]=Q=>f.value=Q),modelModifiers:{number:!0},onInput:k},null,8,["placeholder","modelValue"])])]),n(ya,{visible:!!p.value,accordion:""},{default:d(()=>[o("div",bY,[D[5]||(D[5]=R(" (Original quantity: ",-1)),o("strong",null,m(e.variant.total_stock),1),D[6]||(D[6]=R(") ",-1))])]),_:1},8,["visible"]),o("div",wY,[n(hf,{ref_key:"reasonDropdownRef",ref:v,modelValue:_.value,"onUpdate:modelValue":D[2]||(D[2]=Q=>_.value=Q),"onUpdate:customReason":D[3]||(D[3]=Q=>g.value=Q)},null,8,["modelValue"])]),o("div",CY,[n(B,{size:"small",type:"info",soft:"",onClick:b},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(B,{size:"small",type:"primary",onClick:S,disabled:!_.value||i.value,loading:i.value},{default:d(()=>[R(m(A(u)("Apply")),1)]),_:1},8,["disabled","loading"])])])]),_:1},8,["visible"])}}}),kY={class:"fct-inventory-row"},BY={width:"50"},xY={class:"flex items-center gap-1"},SY=["src","alt"],FY=["src","alt"],$Y={class:"fct-inventory-product-content"},EY={class:"fct-inventory-product-title"},UY={key:0},IY={key:0},QY={key:1,class:"text-system-mid dark:text-gray-300"},DY={key:1},VY={key:2},TY={key:3},MY=Object.assign({name:"InventoryTableRow"},{__name:"InventoryTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0}},emits:["stock-save","open-history"],setup(e){return(t,a)=>{var i,c,p,f;const l=C("el-checkbox"),s=C("el-input");return r(),h("tr",kY,[o("td",BY,[o("div",xY,[n(l,{"model-value":e.isRowSelected(e.row.variants[0]),onChange:a[0]||(a[0]=_=>e.toggleRowSelection(e.row.variants[0]))},null,8,["model-value"])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:a[1]||(a[1]=_=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,SY)):(r(),h("img",{key:1,src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,FY)),o("div",$Y,[o("span",EY,m(e.row.post_title),1)])])]),(i=e.inventoryTable)!=null&&i.isColumnVisible("sku")?(r(),h("td",UY,[e.row.variants[0].sku?(r(),h("span",IY,m(e.row.variants[0].sku),1)):(r(),h("span",QY,m(A(u)("No SKU")),1))])):x("",!0),o("td",null,[n(s,{modelValue:e.row.variants[0].total_stock,"onUpdate:modelValue":a[3]||(a[3]=_=>e.row.variants[0].total_stock=_),class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(_f,{variant:e.row.variants[0],onSave:a[2]||(a[2]=_=>t.$emit("stock-save",_))},null,8,["variant"])]),_:1},8,["modelValue"])]),(c=e.inventoryTable)!=null&&c.isColumnVisible("available")?(r(),h("td",DY,[o("span",null,m(e.row.variants[0].available),1)])):x("",!0),(p=e.inventoryTable)!=null&&p.isColumnVisible("on_hand")?(r(),h("td",VY,[o("span",null,m(e.row.variants[0].on_hold),1)])):x("",!0),(f=e.inventoryTable)!=null&&f.isColumnVisible("committed")?(r(),h("td",TY,[o("span",null,m(e.row.variants[0].committed),1)])):x("",!0),o("td",null,[n(at,{tag:"button",size:"small",onClick:a[4]||(a[4]=_=>t.$emit("open-history",e.row.variants[0]))},{default:d(()=>a[5]||(a[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:1,__:[5]})])])}}}),LY={class:"fct-inventory-row fct-inventory-parent-row"},RY={width:"50"},OY={class:"fct-inventory-row-selection"},PY=["src","alt"],HY=["src","alt"],NY={class:"fct-inventory-product-content"},KY={class:"fct-inventory-product-title"},GY={key:0},zY={class:"!pl-5"},jY={key:1},qY={key:2},YY={key:3},WY={class:"fct-inventory-variant-item"},JY={class:"fct-inventory-product-info"},XY=["src","alt"],ZY=["src","alt"],eW={class:"fct-inventory-product-content"},tW={key:0},aW={key:1},lW={key:2},sW={key:3},nW={key:0,class:"fct-inventory-child-row fct-inventory-load-more-row"},oW=["colspan"],iW=["disabled"],rW={class:"fct-inventory-load-more-count"},yc=10,dW=Object.assign({name:"InventoryParentTableRow"},{__name:"InventoryParentTableRow",props:{row:{type:Object,required:!0},inventoryTable:Object,navigateToProduct:{type:Function,required:!0},getPlaceholderImage:{type:Function,required:!0},isRowSelected:{type:Function,required:!0},toggleRowSelection:{type:Function,required:!0},expanded:{type:Boolean,default:!0}},emits:["stock-save","open-history","variants-loaded"],setup(e,{emit:t}){sl();const a=e,l=t,s=T(!0),i=K(()=>s.value);be(()=>a.expanded,Q=>{s.value=Q});const c=()=>{s.value=!s.value},p=()=>i.value,f=Q=>{var I,M;const V=(I=a.row.stock_totals)==null?void 0:I[Q];return V??(((M=a.row.variants)==null?void 0:M.reduce((O,L)=>O+(L[Q]||0),0))||0)},_=K(()=>f("total_stock")),g=K(()=>f("available")),y=K(()=>f("on_hold")),v=K(()=>f("committed")),w=T(!1),k=K(()=>{var Q;return((Q=a.row.variants)==null?void 0:Q.length)||0}),b=K(()=>a.row.variants_total??k.value),S=K(()=>k.value<b.value),$=K(()=>{var I,M;return 3+(((M=(I=a.inventoryTable)==null?void 0:I.getToggleableColumns)==null?void 0:M.call(I))||[]).filter(O=>{var L;return(L=a.inventoryTable)==null?void 0:L.isColumnVisible(O.value)}).length}),D=()=>{if(w.value)return;w.value=!0;const Q=a.row.variants||[],V=Q.length?Q[Q.length-1].id:0;Ae.get("inventory/variants",{post_id:a.row.ID,after_id:V,page:Math.floor(Q.length/yc)+1,per_page:yc}).then(I=>{var L,H;const M=((L=I==null?void 0:I.variants)==null?void 0:L.data)||[],O=new Set((a.row.variants||[]).map(j=>j.id));M.forEach(j=>{O.has(j.id)||a.row.variants.push(j)}),((H=I==null?void 0:I.variants)==null?void 0:H.total)!==void 0&&(a.row.variants_total=I.variants.total),l("variants-loaded")}).catch(I=>{var M;I.status_code=="422"?q.validationErrors(I):q.error(((M=I.data)==null?void 0:M.message)||u("Failed to load more variants"))}).finally(()=>{w.value=!1})},F=()=>{const Q=a.row.variants||[];return Q.length>0&&Q.every(V=>a.isRowSelected(V))},B=()=>{const Q=a.row.variants||[],V=Q.filter(I=>a.isRowSelected(I)).length;return V>0&&V<Q.length},U=Q=>{var V;(V=a.row.variants)==null||V.forEach(I=>{Q!==a.isRowSelected(I)&&a.toggleRowSelection(I)})};return(Q,V)=>{var L,H,j,W;const I=C("el-checkbox"),M=C("router-link"),O=C("el-input");return r(),h(P,null,[o("tr",LY,[o("td",RY,[o("div",OY,[n(I,{"model-value":F(),indeterminate:B(),onChange:U,onClick:V[0]||(V[0]=Ge(()=>{},["stop"]))},null,8,["model-value","indeterminate"]),o("div",{onClick:V[1]||(V[1]=G=>c()),class:"fct-inventory-row-toggle"},[n(Y,{name:p()?"ChevronDown":"ChevronRight"},null,8,["name"])])])]),o("td",null,[o("div",{class:"fct-inventory-product-info cursor-pointer",onClick:V[2]||(V[2]=G=>e.navigateToProduct(e.row.ID))},[e.row.thumbnail!==null?(r(),h("img",{key:0,src:e.row.thumbnail,alt:e.row.post_title,class:"inventory-thumbnail"},null,8,PY)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:e.row.post_title},null,8,HY)),o("div",NY,[o("span",KY,m(e.row.post_title),1)])])]),(L=e.inventoryTable)!=null&&L.isColumnVisible("sku")?(r(),h("td",GY,[Wt(o("span",null,"--",512),[[Tl,!p()]])])):x("",!0),o("td",zY,[Wt(o("span",null,m(_.value),513),[[Tl,!p()]])]),(H=e.inventoryTable)!=null&&H.isColumnVisible("available")?(r(),h("td",jY,[Wt(o("span",null,m(g.value),513),[[Tl,!p()]])])):x("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("on_hand")?(r(),h("td",qY,[Wt(o("span",null,m(y.value),513),[[Tl,!p()]])])):x("",!0),(W=e.inventoryTable)!=null&&W.isColumnVisible("committed")?(r(),h("td",YY,[Wt(o("span",null,m(v.value),513),[[Tl,!p()]])])):x("",!0),V[4]||(V[4]=o("td",null,null,-1))]),(r(!0),h(P,null,te(e.row.variants,G=>{var Z,ne,ce,z,ue;return Wt((r(),h("tr",{key:`child-${G.id}`,class:"fct-inventory-child-row"},[V[6]||(V[6]=o("td",null,null,-1)),o("td",null,[o("div",WY,[n(I,{"model-value":e.isRowSelected(G),onChange:ie=>e.toggleRowSelection(G)},null,8,["model-value","onChange"]),o("div",JY,[G.thumbnail!==null?(r(),h("img",{key:0,src:G.thumbnail,alt:G.variation_title,class:"inventory-thumbnail"},null,8,XY)):(r(),h("img",{key:1,class:"inventory-thumbnail",src:e.getPlaceholderImage(),alt:G.variation_title},null,8,ZY)),o("div",eW,[n(M,{to:`/products/${G.post_id}`,class:"fct-inventory-product-title"},{default:d(()=>[R(m(G.variation_title),1)]),_:2},1032,["to"])])])])]),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("sku")?(r(),h("td",tW,m(G.sku),1)):x("",!0),o("td",null,[n(O,{modelValue:G.total_stock,"onUpdate:modelValue":ie=>G.total_stock=ie,class:"el-input--x-small input-with-total-stock fct-input-group",readonly:"",size:"small"},{append:d(()=>[n(_f,{variant:G,onSave:V[3]||(V[3]=ie=>Q.$emit("stock-save",ie))},null,8,["variant"])]),_:2},1032,["modelValue","onUpdate:modelValue"])]),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("available")?(r(),h("td",aW,m(G.available),1)):x("",!0),(ce=e.inventoryTable)!=null&&ce.isColumnVisible("on_hand")?(r(),h("td",lW,m(G.on_hold),1)):x("",!0),(z=e.inventoryTable)!=null&&z.isColumnVisible("committed")?(r(),h("td",sW,m(G.committed),1)):x("",!0),o("td",null,[n(at,{tag:"button",size:"small",onClick:ie=>Q.$emit("open-history",G)},{default:d(()=>V[5]||(V[5]=[o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[o("path",{d:"M10 2.5C14.1422 2.5 17.5 5.85775 17.5 10C17.5 14.1422 14.1422 17.5 10 17.5C5.85775 17.5 2.5 14.1422 2.5 10H4C4 13.3135 6.6865 16 10 16C13.3135 16 16 13.3135 16 10C16 6.6865 13.3135 4 10 4C7.9375 4 6.118 5.04025 5.03875 6.625H7V8.125H2.5V3.625H4V5.5C5.368 3.6775 7.54675 2.5 10 2.5ZM10.75 6.25V9.68875L13.1823 12.121L12.121 13.1823L9.25 10.3098V6.25H10.75Z",fill:"currentColor"})],-1)])),_:2,__:[5]},1032,["onClick"])])])),[[Tl,((ue=e.row.variants)==null?void 0:ue.length)>0&&p()]])}),128)),S.value?Wt((r(),h("tr",nW,[V[7]||(V[7]=o("td",null,null,-1)),o("td",{colspan:$.value},[o("button",{class:"fct-inventory-load-more-btn",disabled:w.value,onClick:D},[n(Y,{name:"Reload",class:de({"fct-spin":w.value})},null,8,["class"]),w.value?(r(),h(P,{key:0},[R(m(A(u)("Loading...")),1)],64)):(r(),h(P,{key:1},[R(m(A(u)("Load More"))+" ",1),o("span",rW,"("+m(k.value)+"/"+m(b.value)+")",1)],64))],8,iW)],8,oW)],512)),[[Tl,i.value]]):x("",!0)],64)}}}),uW={class:"fct-adjustment-header"},cW={class:"fct-adjustment-product-name"},AW={key:0,class:"fct-adjustment-timeline-wrap"},pW={key:0,class:"fct-adjustment-timeline"},fW={class:"fct-timeline-node"},mW={class:"fct-timeline-content"},hW={class:"fct-timeline-header"},_W={class:"fct-timeline-time"},vW={class:"fct-stock-flow"},gW={class:"fct-stock-flow-item"},yW={class:"fct-stock-entry"},bW={class:"fct-stock-label"},wW={class:"fct-stock-value"},CW={class:"fct-stock-entry new-stock-entry"},kW={class:"fct-stock-label"},BW={class:"fct-stock-value"},xW={class:"fct-stock-flow-item"},SW={class:"fct-stock-label"},FW={key:0,class:"fct-custom-reason-section"},$W={class:"fct-stock-label"},EW={class:"fct-custom-reason-text"},UW={key:1,class:"fct-timeline-empty"},IW={key:1,class:"fct-timeline-loading"},QW=Object.assign({name:"InventoryAdjustmentHistory"},{__name:"InventoryAdjustmentHistory",setup(e,{expose:t}){const a=T(!1),l=T(!1),s=T({id:null,name:""}),i=T([]),c=()=>{a.value=!1,i.value=[]},p=y=>{s.value=y,a.value=!0,f(y.id)},f=y=>{y&&(l.value=!0,Ae.get("inventory/adjustment-history",{variant_id:y}).then(v=>{i.value=(v==null?void 0:v.adjustments)||[]}).catch(()=>{q.error(u("Failed to load adjustment history"))}).finally(()=>{l.value=!1}))},_=y=>y>0?"positive":y<0?"negative":"",g=y=>y>0?`+${y}`:`${y}`;return t({openHistory:p}),(y,v)=>{const w=C("el-drawer");return r(),E(w,{modelValue:a.value,"onUpdate:modelValue":v[0]||(v[0]=k=>a.value=k),title:A(u)("Stock Adjustment History"),onClose:c},{default:d(()=>[o("div",uW,[o("h3",cW,m(s.value.name),1)]),l.value?(r(),h("div",IW,[o("p",null,m(A(u)("Loading adjustment history...")),1)])):(r(),h("div",AW,[i.value.length>0?(r(),h("div",pW,[(r(!0),h(P,null,te(i.value,(k,b)=>(r(),h("div",{key:b,class:"fct-timeline-item"},[o("div",fW,[o("span",{class:de(["fct-node-dot",`node-${k.reason}`])},null,2)]),o("div",mW,[o("div",hW,[o("span",_W,[n(Pa,{"date-time":k.created_at},null,8,["date-time"]),R(" (by "+m(k.user_name)+") ",1)]),o("span",{class:de(["fct-timeline-reason-badge",`badge-${k.reason}`])},m(k.reason_label),3)]),o("div",vW,[o("div",gW,[o("div",yW,[o("span",bW,m(A(u)("Previous Stock:")),1),o("span",wW,m(k.old_stock),1)]),v[1]||(v[1]=o("span",{class:"fct-stock-arrow"},"→",-1)),o("div",CW,[o("span",kW,m(A(u)("New Stock:")),1),o("span",BW,m(k.new_stock),1)])]),o("div",xW,[o("span",SW,m(A(u)("Change:")),1),o("span",{class:de(["fct-stock-value fct-stock-change",_(k.change)])},m(g(k.change))+" "+m(A(u)("units")),3)]),k.reason==="other"&&k.custom_reason?(r(),h("div",FW,[o("span",$W,m(A(u)("Details:")),1),o("p",EW,m(k.custom_reason),1)])):x("",!0)])])]))),128))])):(r(),h("div",UW,[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("No changes recorded")},null,8,["text"])]))]))]),_:1},8,["modelValue","title"])}}}),DW={class:"fct-bulk-modal-content"},VW={class:"fct-inventory-mode-selection"},TW={class:"fct-inventory-input-section"},MW={key:0,class:"fct-inventory-mode-hint"},LW={class:"fct-inventory-selected-items"},RW={class:"fct-inventory-selected-items-count"},OW={key:0,class:"fct-inventory-selected-items-preview"},PW={class:"fct-inventory-selected-item-header"},HW={class:"variant-title"},NW={class:"total-stock"},KW={class:"fct-inventory-selected-item-list"},GW={class:"fct-inventory-selected-item-info"},zW={class:"fct-inventory-selected-item-title"},jW={class:"fct-inventory-selected-item-stock-action"},qW={class:"total-stock"},YW={class:"stock-arrow"},WW={class:"bulk-stock-value"},JW={class:"fct-inventory-adjustment-reason"},XW={class:"dialog-footer"},ZW=Object.assign({name:"InventoryBulkAdjustModal"},{__name:"InventoryBulkAdjustModal",props:{selectedItems:{type:Array,required:!0}},emits:["bulk-update-success","close"],setup(e,{expose:t,emit:a}){const l=e,s=a,i=T(!1),c=T("add"),p=T(null),f=T(""),_=T(""),g=S=>c.value==="add"?S.total_stock+p.value:p.value,y=S=>p.value!==null&&p.value!==""&&g(S)!==S.total_stock,v=()=>{k(),i.value=!1},w=()=>{const S={mode:c.value,value:p.value,reason:f.value,customReason:f.value==="other"?_.value:"",items:l.selectedItems.map($=>({id:$.id,post_id:$.post_id}))};Ae.post("inventory/bulk-update",S).then(()=>{q.success(u("Stock updated successfully")),k(),i.value=!1,s("bulk-update-success")}).catch($=>{var D;$.status_code===422?q.validationErrors($):q.error(((D=$.data)==null?void 0:D.message)||u("Failed to update stock"))})},k=()=>{p.value=null,c.value="add",f.value="",_.value=""};return t({openModal:()=>{k(),i.value=!0}}),(S,$)=>{const D=C("el-radio"),F=C("el-radio-group"),B=C("el-input"),U=C("el-button"),Q=C("el-dialog");return r(),E(Q,{modelValue:i.value,"onUpdate:modelValue":$[4]||($[4]=V=>i.value=V),title:A(u)("Update Stocks")},{default:d(()=>{var V;return[o("div",DW,[o("div",VW,[n(F,{modelValue:c.value,"onUpdate:modelValue":$[0]||($[0]=I=>c.value=I),class:"fct-mode-radio-group"},{default:d(()=>[n(D,{value:"add"},{default:d(()=>[R(m(A(u)("Increase Stock")),1)]),_:1}),n(D,{value:"set"},{default:d(()=>[R(m(A(u)("Set Exact Stock")),1)]),_:1})]),_:1},8,["modelValue"])]),o("div",TW,[n(pa,{title:c.value==="add"?A(u)("Increase Stock by"):A(u)("Exact new stock"),content:c.value==="add"?A(u)("Increase stock by value (e.g. 10 + 5 = 15)"):A(u)("Set stock to exact value (e.g. 10 → 20)")},null,8,["title","content"]),n(B,{modelValue:p.value,"onUpdate:modelValue":$[1]||($[1]=I=>p.value=I),modelModifiers:{number:!0},type:"number",placeholder:c.value==="add"?A(u)("Enter amount to add"):A(u)("Enter exact stock value")},null,8,["modelValue","placeholder"]),c.value==="set"?(r(),h("div",MW,[n(Y,{name:"Warning"}),R(" "+m(A(u)("Replaces current inventory")),1)])):x("",!0)]),o("div",LW,[o("div",RW,m(e.selectedItems.length)+" "+m(A(u)("variants will be changed:")),1),(V=e.selectedItems)!=null&&V.length?(r(),h("div",OW,[o("div",PW,[o("span",HW,m(A(u)("Variant")),1),o("span",NW,m(A(u)("Stock Change")),1)]),o("ul",KW,[(r(!0),h(P,null,te(e.selectedItems,I=>(r(),h("li",{key:I.id},[o("div",GW,[o("span",zW,m(I.variation_title),1)]),o("div",jW,[o("span",qW,m(I.total_stock),1),y(I)?(r(),h(P,{key:0},[o("span",YW,[n(Y,{name:"ArrowRight"})]),o("span",WW,m(g(I)),1)],64)):x("",!0)])]))),128))])])):x("",!0)]),o("div",JW,[n(hf,{modelValue:f.value,"onUpdate:modelValue":$[2]||($[2]=I=>f.value=I),"onUpdate:customReason":$[3]||($[3]=I=>_.value=I)},null,8,["modelValue"])]),o("div",XW,[n(U,{onClick:v},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(U,{type:"primary",onClick:w,disabled:!f.value},{default:d(()=>[R(m(A(u)("Update Stocks")),1)]),_:1},8,["disabled"])])])]}),_:1},8,["modelValue","title"])}}}),eJ={class:"fct-advanced-inventory-table"},tJ={class:"fct-inventory-toolbar-wrap"},aJ={key:0,class:"fct-inventory-toolbar-selected"},lJ={class:"fct-inventory-toolbar-actions ml-auto"},sJ={key:0,class:"fct-advanced-inventory-table-wrap"},nJ={class:"fct-advanced-inventory-table"},oJ={key:0,width:"150"},iJ={key:1,width:"100"},rJ={key:2,width:"100"},dJ={key:3,width:"100"},uJ={width:"50"},cJ={key:0},AJ={key:1},pJ={key:2},fJ={key:3},bc=Object.assign({name:"InventoryTable"},{__name:"InventoryTable",props:{data:{type:Array,default:()=>[]},inventoryTable:Object},emits:["stock-save","bulk-update-success","selection-changed"],setup(e,{emit:t}){const a=sl(),l=e,s=t,i=T([]),c=T(!1),p=T(!1),f=T(null),_=T(null),g=T(!0);be(i,Q=>{s("selection-changed",{selectedItems:Q,count:Q.length})},{deep:!0});const y=Q=>Q.post_id?`variant-${Q.id}`:`product-${Q.id}`,v=Q=>{a.push({name:"product_edit",params:{product_id:Q}})},w=()=>{_.value&&_.value.openModal()},k=()=>{i.value=[],F(),s("bulk-update-success")},b=()=>l.data.flatMap(Q=>Q.variants&&Q.variants.length>0?Q.variants:[Q]),S=Q=>{Q?i.value=b():i.value=[],F()},$=Q=>{const V=i.value.findIndex(I=>I.id===Q.id);V>-1?i.value.splice(V,1):i.value.push(Q),F()},D=Q=>i.value.some(V=>V.id===Q.id),F=()=>{const Q=b(),V=i.value.length;V===0?(c.value=!1,p.value=!1):V===Q.length?(c.value=!0,p.value=!1):(c.value=!1,p.value=!0)},B=Q=>{f.value&&f.value.openHistory({id:Q.id,name:Q.variation_title||Q.post_title})},U=()=>{g.value=!g.value};return(Q,V)=>{var O,L,H,j,W,G,Z,ne;const I=C("el-button"),M=C("el-checkbox");return r(),h("div",eJ,[o("div",tJ,[i.value.length>0?(r(),h("div",aJ,m(i.value.length)+" "+m(A(u)("selected")),1)):x("",!0),o("div",lJ,[i.value.length>0?(r(),E(I,{key:0,type:"primary",size:"small",onClick:w},{default:d(()=>[R(m(A(u)("Update Stocks")),1)]),_:1})):x("",!0),n(I,{class:"fct-expand-row-button",size:"small",onClick:U},{default:d(()=>[n(Y,{name:g.value?"Expand":"Collapse"},null,8,["name"]),R(" "+m(g.value?A(u)("Collapse All"):A(u)("Expand All")),1)]),_:1})])]),e.data.length>0?(r(),h("div",sJ,[o("table",nJ,[o("colgroup",null,[V[3]||(V[3]=o("col",{width:"50"},null,-1)),V[4]||(V[4]=o("col",null,null,-1)),(O=e.inventoryTable)!=null&&O.isColumnVisible("sku")?(r(),h("col",oJ)):x("",!0),V[5]||(V[5]=o("col",{width:"160"},null,-1)),(L=e.inventoryTable)!=null&&L.isColumnVisible("available")?(r(),h("col",iJ)):x("",!0),(H=e.inventoryTable)!=null&&H.isColumnVisible("on_hand")?(r(),h("col",rJ)):x("",!0),(j=e.inventoryTable)!=null&&j.isColumnVisible("committed")?(r(),h("col",dJ)):x("",!0),V[6]||(V[6]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",uJ,[n(M,{modelValue:c.value,"onUpdate:modelValue":V[0]||(V[0]=ce=>c.value=ce),indeterminate:p.value,onChange:S},null,8,["modelValue","indeterminate"])]),o("th",null,m(A(u)("Products")),1),(W=e.inventoryTable)!=null&&W.isColumnVisible("sku")?(r(),h("th",cJ,m(A(u)("SKU")),1)):x("",!0),o("th",null,m(A(u)("Total Stock")),1),(G=e.inventoryTable)!=null&&G.isColumnVisible("available")?(r(),h("th",AJ,m(A(u)("Available")),1)):x("",!0),(Z=e.inventoryTable)!=null&&Z.isColumnVisible("on_hand")?(r(),h("th",pJ,m(A(u)("On hold")),1)):x("",!0),(ne=e.inventoryTable)!=null&&ne.isColumnVisible("committed")?(r(),h("th",fJ,m(A(u)("Delivered")),1)):x("",!0),V[7]||(V[7]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,te(e.data,ce=>(r(),h(P,{key:y(ce)},[!ce.variants||ce.variants.length===1?(r(),E(MY,{key:0,row:ce,"inventory-table":e.inventoryTable,"is-row-selected":D,"toggle-row-selection":$,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,onStockSave:V[1]||(V[1]=z=>s("stock-save",z)),onOpenHistory:B},null,8,["row","inventory-table","get-placeholder-image"])):x("",!0),ce.variants&&ce.variants.length>1?(r(),E(dW,{key:1,row:ce,"inventory-table":e.inventoryTable,"navigate-to-product":v,"get-placeholder-image":Q.getPlaceholderImage,"is-row-selected":D,"toggle-row-selection":$,expanded:g.value,onStockSave:V[2]||(V[2]=z=>s("stock-save",z)),onOpenHistory:B,onVariantsLoaded:F},null,8,["row","inventory-table","get-placeholder-image","expanded"])):x("",!0)],64))),128))])])])):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No inventory data")},null,8,["text"])),n(ZW,{ref_key:"bulkAdjustModalRef",ref:_,"selected-items":i.value,onBulkUpdateSuccess:k},null,8,["selected-items"]),n(QW,{ref_key:"historyRef",ref:f},null,512)])}}}),mJ={class:"fct-advanced-inventory-table"},hJ={class:"fct-inventory-toolbar-wrap"},_J={class:"fct-inventory-toolbar-actions ml-auto"},vJ={class:"fct-advanced-inventory-table-wrap"},gJ={class:"fct-advanced-inventory-table"},yJ={key:0,width:"150"},bJ={key:1,width:"100"},wJ={key:2,width:"100"},CJ={key:3,width:"100"},kJ={width:"50"},BJ={key:0},xJ={key:1},SJ={key:2},FJ={key:3},$J={class:"fct-product-info-card"},EJ={class:"fct-product-info-media"},UJ={class:"fct-product-info-details"},IJ={key:0},QJ={key:1},DJ={key:2},VJ={key:3},TJ={__name:"InventoryLoader",props:{nextPageCount:{type:Number,default:10},inventoryTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=K(()=>Array.from({length:t.nextPageCount/2},(l,s)=>s+1));return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton");return r(),E(c,{animated:""},{template:d(()=>{var p,f,_,g,y,v,w,k;return[o("div",mJ,[o("div",hJ,[o("div",_J,[n(i,{variant:"button",class:"w-28 h-8 rounded"})])]),o("div",vJ,[o("table",gJ,[o("colgroup",null,[s[0]||(s[0]=o("col",{width:"50"},null,-1)),s[1]||(s[1]=o("col",null,null,-1)),(p=e.inventoryTable)!=null&&p.isColumnVisible("sku")?(r(),h("col",yJ)):x("",!0),s[2]||(s[2]=o("col",{width:"160"},null,-1)),(f=e.inventoryTable)!=null&&f.isColumnVisible("available")?(r(),h("col",bJ)):x("",!0),(_=e.inventoryTable)!=null&&_.isColumnVisible("on_hand")?(r(),h("col",wJ)):x("",!0),(g=e.inventoryTable)!=null&&g.isColumnVisible("committed")?(r(),h("col",CJ)):x("",!0),s[3]||(s[3]=o("col",{width:"40"},null,-1))]),o("thead",null,[o("tr",null,[o("th",kJ,[n(i,{variant:"p",class:"w-4 h-4"})]),o("th",null,[n(i,{variant:"p",class:"w-20"})]),(y=e.inventoryTable)!=null&&y.isColumnVisible("sku")?(r(),h("th",BJ,[n(i,{variant:"p",class:"w-10"})])):x("",!0),o("th",null,[n(i,{variant:"p",class:"w-24"})]),(v=e.inventoryTable)!=null&&v.isColumnVisible("available")?(r(),h("th",xJ,[n(i,{variant:"p",class:"w-20"})])):x("",!0),(w=e.inventoryTable)!=null&&w.isColumnVisible("on_hand")?(r(),h("th",SJ,[n(i,{variant:"p",class:"w-16"})])):x("",!0),(k=e.inventoryTable)!=null&&k.isColumnVisible("committed")?(r(),h("th",FJ,[n(i,{variant:"p",class:"w-20"})])):x("",!0),s[4]||(s[4]=o("th",null,null,-1))])]),o("tbody",null,[(r(!0),h(P,null,te(a.value,b=>{var S,$,D,F;return r(),h("tr",{key:b},[o("td",null,[n(i,{variant:"p",class:"w-4 h-4"})]),o("td",null,[o("div",$J,[o("div",EJ,[n(i,{variant:"image",class:"w-10 h-10 rounded flex-none"})]),o("div",UJ,[n(i,{variant:"p",class:"max-w-[180px]"})])])]),(S=e.inventoryTable)!=null&&S.isColumnVisible("sku")?(r(),h("td",IJ,[n(i,{variant:"p",class:"w-20"})])):x("",!0),o("td",null,[n(i,{variant:"p",class:"w-16"})]),($=e.inventoryTable)!=null&&$.isColumnVisible("available")?(r(),h("td",QJ,[n(i,{variant:"p",class:"w-10"})])):x("",!0),(D=e.inventoryTable)!=null&&D.isColumnVisible("on_hand")?(r(),h("td",DJ,[n(i,{variant:"p",class:"w-10"})])):x("",!0),(F=e.inventoryTable)!=null&&F.isColumnVisible("committed")?(r(),h("td",VJ,[n(i,{variant:"p",class:"w-10"})])):x("",!0),s[5]||(s[5]=o("td",null,null,-1))])}),128))])])])])]}),_:1})}}},MJ={class:"fct-module-disabled-notice"},LJ={class:"fct-disabled-notice-title"},RJ={class:"fct-disabled-notice-text"},OJ=Object.assign({name:"ModuleDisabledNotice"},{__name:"ModuleDisabledNotice",setup(e){return(t,a)=>{const l=C("el-icon"),s=C("router-link");return r(),h("div",MJ,[n(l,{class:"fct-disabled-notice-icon"},{default:d(()=>[n(A(im))]),_:1}),o("h3",LJ,m(A(u)("Stock Management Inactive")),1),o("p",RJ,[R(m(A(u)("Stock Management module is currently disabled. Please enable it in "))+" ",1),n(s,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(m(A(u)("module settings")),1)]),_:1}),R(" "+m(A(u)(" to use inventory features.")),1)])])}}});class PJ extends Vs{getTabs(){return{all:u("All"),low_stock:u("Low Stock"),out_of_stock:u("Out of Stock")}}getToggleableColumns(){return[{label:u("SKU"),value:"sku"},{label:u("Available"),value:"available"},{label:u("On hold"),value:"on_hand"},{label:u("Committed"),value:"committed"}]}getSortableColumns(){return[{label:u("Product ID"),value:"id"},{label:u("Product Title"),value:"post_title"}]}getSearchHint(){return u("Search by product name, variation name or SKU")}getFetchUrl(){return"inventory"}parseResponse(t){return t.products||[]}getTableName(){return"inventory_table"}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}getSearchGuideOptions(){return{}}getCustomColumns(){return{}}with(){return["admin_inventory_list_v2"]}}function HJ(e){return PJ.init(e)}const NJ={class:"fct-all-inventory-page fct-layout-width"},KJ={class:"fct-inventory-wrap"},GJ={key:2,class:"py-10"},zJ={class:"fct-pro-feature-text"},jJ=Object.assign({name:"AdvancedInventory"},{__name:"Inventory",setup(e){const t=ze.get("app_config"),a=K(()=>t==null?void 0:t.isProActive),l=ze.get("modules_settings"),s=K(()=>{var D;return((D=l==null?void 0:l.stock_management)==null?void 0:D.active)==="yes"}),i=K(()=>{var D;return((D=l==null?void 0:l.stock_management)==null?void 0:D.enable_advanced_inventory)==="yes"}),c=K(()=>a.value&&s.value&&i.value),p=HJ({instance:Jt(),fetch:!1}),f=T(0),_=T([]),g=D=>{f.value=D.count,_.value=D.selectedItems||[]},y=()=>{p.fetch()},v=new Map,w=Zs(new Set);ri("fctPendingStockSaves",w);const k=D=>{const{variant:F,newStock:B,reason:U,customReason:Q}=D,V=parseInt(B);if(isNaN(V)||V<0){q.error(u("Please enter a valid stock quantity"));return}const I={variantId:F.id,postId:F.post_id,newStock:V,reason:U,customReason:Q||""},M=v.get(I.postId)||{inFlight:!1,pending:new Map};if(v.set(I.postId,M),w.add(I.variantId),M.inFlight){M.pending.set(I.variantId,I);return}M.inFlight=!0,$(I,M)},b=D=>p.getTableData().find(F=>F.ID===D),S=(D,F,B)=>{var Q;const U=b(D);return((Q=U==null?void 0:U.variants)==null?void 0:Q.find(V=>V.id===F))||B},$=(D,F)=>{Ae.post("inventory/update-stock",{variant_id:D.variantId,post_id:D.postId,new_stock:D.newStock,reason:D.reason,customReason:D.customReason}).then(B=>{const U=S(D.postId,D.variantId,null);if(U){const Q=parseInt(B.new_stock);if(U.total_stock=isNaN(Q)?D.newStock:Q,B.available!==void 0)U.available=parseInt(B.available)||0;else{const V=U.total_stock-(parseInt(U.committed)||0)-(parseInt(U.on_hold)||0);U.available=V<0?0:V}}if(B.stock_totals){const Q=b(D.postId);Q&&Q.stock_totals&&(Q.stock_totals=B.stock_totals)}q.success(B.message?u(B.message):u("Stock updated successfully"))}).catch(B=>{var U;F.pending.has(D.variantId)||((B==null?void 0:B.status_code)=="422"?q.validationErrors(B):q.error(((U=B==null?void 0:B.data)==null?void 0:U.message)||u("Failed to update stock")))}).finally(()=>{if(!F.pending.has(D.variantId)){w.delete(D.variantId);const U=S(D.postId,D.variantId,null);U&&(U.stock_save_pending=!1)}const B=F.pending.entries().next().value;B?(F.pending.delete(B[0]),$(B[1],F)):(F.inFlight=!1,v.delete(D.postId))})};return Ie(()=>{c.value&&p.fetch()}),(D,F)=>{const B=C("router-link");return r(),h("div",NJ,[n(ol,{title:A(u)("Inventory")},{action:d(()=>[n(Ot,{permission:"products/view"})]),_:1},8,["title"]),c.value?(r(),E(Ot,{key:0,permission:"products/view"},{default:d(()=>[o("div",KJ,[n(Ts,{table:A(p),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[n(bc,{data:A(p).getTableData(),"inventory-table":A(p),onStockSave:k,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"])]),default:d(()=>[A(p).isLoading()?(r(),E(TJ,{key:0,"next-page-count":A(p).nextPageCount,"inventory-table":A(p)},null,8,["next-page-count","inventory-table"])):(r(),E(bc,{key:1,data:A(p).getTableData(),"inventory-table":A(p),onStockSave:k,onBulkUpdateSuccess:y,onSelectionChanged:g},null,8,["data","inventory-table"]))]),_:1},8,["table"])])]),_:1})):s.value?(r(),h("div",GJ,[n(dn,{placement:"feature_lock_advanced_inventory",title:A(u)("Advanced Inventory")},{default:d(()=>[o("p",zJ,[R(m(A(u)("This feature is only available in FluentCart Pro with "))+" ",1),n(B,{to:"/settings/addons",target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[R(m(A(u)("Advanced Inventory enabled")),1)]),_:1})])]),_:1},8,["title"])])):(r(),E(OJ,{key:1}))])}}}),qJ={class:"setting-wrap"},YJ={class:"setting-wrap-inner"},WJ={key:0,class:"fct-all-notification-table-wrap"},JJ={class:"fct-card-header"},XJ={class:"w-full pb-2"},ZJ={class:"flex items-center justify-between gap-2 pb-2"},eX={class:"flex-1"},tX={style:{width:"120px"}},aX={class:"flex items-center justify-between gap-3",style:{width:"220px"}},lX={key:1,class:"fct-all-notification-table-wrap"},sX=["id"],nX={class:"fct-card-header"},oX={class:"w-full pb-2"},iX={class:"flex items-center justify-between gap-2 pb-2"},rX={class:"fct-card-header-title"},dX={class:"text-xs text-system-mid dark:text-gray-300"},uX={key:0,class:"m-0 mt-0 leading-5 text-system-mid dark:text-gray-300"},cX={class:"fct-card-body px-0 pb-0 pt-0"},AX={class:"m-0 mb-1"},pX={class:"m-0 text-xs leading-5 text-system-mid dark:text-gray-300"},fX={class:"m-0 text-sm"},mX={class:"fct-all-notification-actions flex items-center justify-between gap-3"},hX={key:1,class:"text-system-mid text-xs leading-5 dark:text-gray-300"},_X={class:"fct-btn-group sm flex-shrink-0"},vX={__name:"EmailNotificationSettings",setup(e){const t=nl(),a=T(!0),l=T([]),s=K(()=>{if(!l.value.length)return[];const p={};return l.value.forEach(f=>{const _=(f==null?void 0:f.group)||"other";p[_]||(p[_]={key:_,label:(f==null?void 0:f.group_label)||u("Other Actions"),items:[]}),p[_].items.push(f)}),Object.values(p)}),i=()=>{a.value=!0,Ae.get("email-notification").then(p=>{l.value=Object.values(p.data)}).catch(p=>{}).finally(()=>{a.value=!1,xe(()=>{requestAnimationFrame(()=>nn.scrollToHashSection(t.hash))})})},c=(p,f)=>{Ae.post("email-notification/enable-notification/"+f,{active:p}).then(_=>{q.success(_.message)}).catch(_=>{var g;_.status_code=="422"?q.validationErrors(_):q.error((g=_.data)==null?void 0:g.message)}).finally(()=>{})};return Ie(()=>{i()}),(p,f)=>{const _=C("el-skeleton-item"),g=C("el-skeleton"),y=C("router-link"),v=C("el-table-column"),w=C("el-switch"),k=C("el-tooltip"),b=C("el-table");return r(),h("div",qJ,[n(Ua,{heading:A(u)("Email Notifications"),"show-save-button":!1},null,8,["heading"]),o("div",YJ,[n(Ia),a.value?(r(),h("div",WJ,[(r(),h(P,null,te(2,S=>o("div",{key:S,class:"fct-card fct-notification-group mb-4 rounded border border-solid border-gray-divider overflow-hidden dark:border-dark-400"},[n(g,{animated:""},{template:d(()=>[o("div",JJ,[o("div",XJ,[o("div",ZJ,[n(_,{variant:"text",style:{width:"140px",height:"16px"}}),n(_,{variant:"text",style:{width:"100px",height:"14px"}})])])]),(r(),h(P,null,te(4,$=>o("div",{key:$,class:"flex items-center gap-4 px-4 py-4 border-t border-solid border-x-0 border-b-0 border-gray-divider dark:border-dark-400"},[o("div",eX,[n(_,{variant:"text",style:{width:"50%",height:"14px",display:"block","margin-bottom":"8px"}}),n(_,{variant:"text",style:{width:"75%",height:"12px",display:"block"}})]),o("div",tX,[n(_,{variant:"text",style:{width:"70px",height:"14px",display:"block"}})]),o("div",aX,[n(_,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px",display:"block"}}),n(_,{variant:"text",style:{width:"28px",height:"28px","border-radius":"6px",display:"block"}})])])),64))]),_:1})])),64))])):(r(),h("div",lX,[s.value.length?(r(!0),h(P,{key:0},te(s.value,S=>(r(),h("div",{key:S.key,id:S.key,class:"fct-card fct-notification-group overflow-hidden"},[o("div",nX,[o("div",oX,[o("div",iX,[o("h4",rX,m(S.label),1),o("span",dX,m(S.items.length)+" "+m(A(u)("Notifications")),1)]),S.key==="scheduler"?(r(),h("p",uX,[R(m(A(u)("This notification trigger is controlled from the Reminders section. You can configure it from"))+" ",1),n(y,{to:{path:"/settings/email_mailing_settings/reminders"},class:"underline hover:no-underline font-medium text-inherit hover:text-inherit"},{default:d(()=>[R(m(A(u)("reminder settings")),1)]),_:1})])):x("",!0)])]),o("div",cX,[n(b,{data:S.items,"show-header":!0},{default:d(()=>[n(v,{prop:"title",label:A(u)("Notification Name"),"min-width":"320"},{default:d($=>[o("h4",AX,m($.row.title),1),o("p",pX,m($.row.description),1)]),_:1},8,["label"]),n(v,{prop:"recipient",label:A(u)("Recipient"),"min-width":"120"},{default:d($=>[o("p",fX,m(A(da).headline($.row.recipient)),1)]),_:1},8,["label"]),n(v,{label:A(u)("Enabled"),"min-width":"220"},{default:d($=>{var D,F,B;return[o("div",mX,[((D=$.row)==null?void 0:D.manage_toggle)!=="no"?(r(),E(w,{key:0,onChange:U=>c(U,$.row.name),modelValue:$.row.settings.active,"onUpdate:modelValue":U=>$.row.settings.active=U,"active-value":"yes","inactive-value":"no"},null,8,["onChange","modelValue","onUpdate:modelValue"])):x("",!0),((F=$.row)==null?void 0:F.manage_toggle)==="no"?(r(),h("span",hX,m(((B=$.row)==null?void 0:B.toggle_label)||A(u)("Auto-enabled")),1)):x("",!0),o("div",_X,[n(k,{effect:"dark",content:A(u)("Edit"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{to:{name:"email_notifications/edit",params:{name:$.row.name}},size:"x-small",hover:"primary"},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["to"])]),_:2},1032,["content"])])])]}),_:1},8,["label"])]),_:2},1032,["data"])])],8,sX))),128)):(r(),E(Ct,{key:1,icon:"Empty/EmailNotification","has-dark":!0,text:A(u)("No email notifications available! Please reactivate FluentCart!")},null,8,["text"]))]))])])}}},gX={__name:"ProVersionGuard",props:{minVersion:{type:String,required:!0},featureTitle:{type:String,default:""},featureText:{type:String,default:""},placement:{type:String,default:"upgrade_page"}},setup(e){const t=e,a=ze.get("app_config.isProActive"),l=ze.get("app_config.proVersion"),s=a&&l&&l.localeCompare(t.minVersion,void 0,{numeric:!0})<0,i=u("This feature requires FluentCart Pro v%s or later. Please update FluentCart Pro to use this feature.").replace("%s",t.minVersion);return(c,p)=>{const f=C("el-alert");return A(a)&&!A(s)?ga(c.$slots,"default",{key:0}):A(s)?(r(),E(f,{key:1,type:"warning","show-icon":"",closable:!1,title:A(u)("Update Required"),description:A(i)},null,8,["title","description"])):(r(),E(dn,{key:2,title:e.featureTitle,text:e.featureText,placement:e.placement},null,8,["title","text","placement"]))}}},yX={class:"setting-wrap fct-edit-email-notification-wrapper"},bX={class:"capitalize"},wX={class:"setting-wrap-inner"},CX={class:"mb-5"},kX={class:"setting-switcher flex items-center gap-3"},BX={class:"text-sm text-system-dark dark:text-gray-50"},xX={class:"fct-card p-6"},SX={class:"mb-5"},FX={class:"el-form-item__label block mb-2"},$X={class:"mb-5"},EX={class:"el-form-item__label block mb-2"},UX={class:"el-form-item__label block mb-2"},IX={class:"mb-5"},QX={key:0,class:"setting-switcher"},DX={key:1,class:"setting-switcher text-system-mid text-sm dark:text-gray-300"},VX={class:"fct-seg-wrap"},TX={key:0,class:"fct-default-template-preview"},MX={class:"el-form-item__label"},LX={key:1,class:"fct-default-template-frame"},RX=["srcdoc"],OX={key:0,class:"el-form-item__label"},PX={key:1,class:"text-system-mid mb-3"},HX={key:2,class:"mb-4"},NX={class:"setting-save-action"},KX={key:0,style:{height:"300px"}},GX={class:"fct-preview-toolbar"},zX={class:"fct-preview-device-toggle"},jX={__name:"EditEmailNotification",props:{name:{type:String,required:!0}},setup(e){const t=ze.get("app_config.isProActive"),a=e,l=T(!1),s=T(!1),i=T(a.name),c=T({title:"",description:"",event:"",name:"",recipient:"",smartcode_groups:[],template_path:"",is_async:!1,settings:{active:"",is_default_body:"yes",email_body:"",subject:"",attach_pdf_template:""}}),p=T(null),f=T({}),_=T([]),g=T(),y=(G,Z={})=>!G||typeof G!="object"?[]:(G.schema?[[G.form_name||"form",G]]:Object.entries(G)).filter(([,ce])=>(ce==null?void 0:ce.schema)&&Object.keys(ce.schema).length).map(([ce,z])=>({...z,form_key:ce,values:{...z.values||{},...Z[ce]||{}}})),v=()=>{const Z=[].concat(g.value||[]).reduce((ne,ce)=>typeof(ce==null?void 0:ce.getState)=="function"?{...ne,...ce.getState()}:ne,{});return Object.keys(Z).length?{[i.value]:Z}:null},w=T(!1),k=T(!1),b=T([]),S=T(!1),$=T(!1),D=T(""),F=T("desktop"),B=T(null),U=()=>{S.value=!0,$.value=!0,D.value="",Ae.post("email-notification/preview",{notification_name:i.value,block_content:c.value.settings.email_body||""}).then(G=>{D.value=G.html,$.value=!1,xe(()=>Q())}).catch(G=>{var Z;q.error(((Z=G.data)==null?void 0:Z.message)||"Failed to generate preview"),S.value=!1,$.value=!1})},Q=()=>{const G=B.value;if(!G||!D.value)return;const Z=G.contentDocument||G.contentWindow&&G.contentWindow.document;Z&&(Z.open(),Z.write(D.value),Z.close())},V=()=>{xe(()=>{D.value&&Q()})},I=()=>{S.value=!1,D.value="",F.value="desktop"},M=T(""),O=T(!1),L=()=>{var Z;const G=(Z=c.value)==null?void 0:Z.template_path;!G||M.value||(O.value=!0,Ae.post("email-notification/preview-default-template",{template:G}).then(ne=>{var ce;M.value=((ce=ne.data)==null?void 0:ce.content)||""}).catch(()=>{}).finally(()=>{O.value=!1}))};be(()=>c.value.settings.is_default_body,G=>{G==="yes"&&!M.value&&L()});const H=G=>{c.value.settings.subject+=G},j=()=>{l.value=!0,Ae.get("email-notification/"+i.value).then(G=>{var ne;c.value=G.data,f.value=G.shortcodes,k.value=G.has_fluent_pdf||!1,b.value=G.pdf_templates||[];const Z=((ne=c.value.settings.extra)==null?void 0:ne[i.value])||{};_.value=y(c.value.extra_fields,Z),c.value.settings.is_default_body==="yes"&&L()}).catch(G=>{var Z;G.status_code=="422"?q.validationErrors(G):q.error((Z=G.data)==null?void 0:Z.message)}).finally(()=>{l.value=!1})},W=()=>{s.value=!0;const G=JSON.parse(JSON.stringify(c.value)),Z=v();Z&&(G.settings.extra=Z),G.settings.is_default_body==="no"&&p.value&&p.value.forceAutosave(),Ae.put("email-notification/"+i.value,G).then(ne=>{q.success(ne.message)}).catch(ne=>{var ce;ne.status_code=="422"?q.validationErrors(ne):q.error((ce=ne.data)==null?void 0:ce.message)}).finally(()=>{s.value=!1})};return Ie(()=>{j()}),(G,Z)=>{var Ce;const ne=C("el-breadcrumb-item"),ce=C("el-breadcrumb"),z=C("el-skeleton-item"),ue=C("el-skeleton"),ie=C("el-switch"),J=C("el-input"),N=C("el-form-item"),ae=C("el-form"),oe=C("el-option"),fe=C("el-select"),re=C("el-button"),Ee=C("el-drawer"),ye=Va("loading");return r(),h("div",yX,[n(Ua,{loading:s.value,"loading-text":A(u)("Updating"),"save-button-text":A(u)("Update"),onOnSave:W},{heading:d(()=>[n(ce,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[n(ne,{to:{path:"/settings/email_notifications"}},{default:d(()=>[R(m(G.$t("Email Notifications")),1)]),_:1}),n(ne,null,{default:d(()=>[o("span",bX,m(c.value.title),1)]),_:1})]),_:1},8,["separator-icon"])]),_:1},8,["loading","loading-text","save-button-text"]),o("div",wX,[n(Ia),l.value?(r(),E(ue,{key:0,animated:""},{template:d(()=>[o("div",CX,[o("div",kX,[n(z,{variant:"text",style:{width:"40px",height:"20px","border-radius":"10px"}}),o("span",BX,m(A(u)("Enable this email notification!")),1)])]),o("div",xX,[o("div",SX,[o("label",FX,m(A(u)("Email Subject")),1),n(z,{variant:"text",style:{width:"100%",height:"36px","border-radius":"4px",display:"block"}})]),o("div",$X,[o("label",EX,m(A(u)("Email Body Type")),1),n(z,{variant:"text",style:{width:"260px",height:"34px","border-radius":"6px",display:"block"}})]),o("div",null,[o("label",UX,m(A(u)("Email Body")),1),n(hr)])])]),_:1})):x("",!0),l.value?x("",!0):(r(),h(P,{key:1},[o("div",IX,[((Ce=c.value)==null?void 0:Ce.manage_toggle)!=="no"?(r(),h("div",QX,[n(ie,{modelValue:c.value.settings.active,"onUpdate:modelValue":Z[0]||(Z[0]=ve=>c.value.settings.active=ve),"active-value":"yes","inactive-value":"no","active-text":A(u)("Enable this email notification!")},null,8,["modelValue","active-text"])])):(r(),h("div",DX,m(A(u)("Auto-enabled for offline payments")),1))]),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(ae,{"label-position":"top"},{default:d(()=>[n(N,{label:A(u)("Email Subject")},{default:d(()=>[n(J,{modelValue:c.value.settings.subject,"onUpdate:modelValue":Z[1]||(Z[1]=ve=>c.value.settings.subject=ve),autocomplete:"rutjfkde",class:de({"is-focus":w.value}),onFocus:Z[2]||(Z[2]=ve=>w.value=!0),onBlur:Z[3]||(Z[3]=ve=>w.value=!1),label:A(u)("Email Subject")},{append:d(()=>[n(AA,{data:f.value,onCommand:H,btnType:"info",btnSize:"small",plain:"",placement:"bottom"},{default:d(()=>[R(m(A(u)("Add ShortCodes")),1)]),_:1},8,["data"])]),_:1},8,["modelValue","class","label"])]),_:1},8,["label"]),n(N,{label:A(u)("Email Body Type")},{default:d(()=>[o("div",VX,[o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="yes"}]),onClick:Z[4]||(Z[4]=ve=>c.value.settings.is_default_body="yes")},[Z[13]||(Z[13]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o("path",{d:"M9 9h6M9 13h6M9 17h4"})],-1)),R(" "+m(A(u)("Default Body")),1)],2),o("button",{type:"button",class:de(["fct-seg-btn",{active:c.value.settings.is_default_body==="no"}]),onClick:Z[5]||(Z[5]=ve=>c.value.settings.is_default_body="no")},[Z[14]||(Z[14]=o("svg",{class:"fct-seg-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M12 20h9"}),o("path",{d:"M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"})],-1)),R(" "+m(A(u)("Customized Body"))+" ",1),A(t)?x("",!0):(r(),E(Y,{key:0,name:"Crown",class:"fct-pro-icon",style:{"margin-left":"4px",display:"inline-flex"}}))],2)])]),_:1},8,["label"]),c.value.settings.is_default_body==="yes"?(r(),h("div",TX,[o("label",MX,m(A(u)("Email Body")),1),O.value?(r(),E(hr,{key:0})):M.value?(r(),h("div",LX,[n(xo,{type:"warning",class:"mb-3","show-icon":"",description:A(u)("The preview shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("iframe",{srcdoc:M.value,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"600px",border:"1px solid #e4e7ed","border-radius":"6px",display:"block"}},null,8,RX)])):x("",!0)])):x("",!0),c.value.settings.is_default_body==="no"&&!l.value?(r(),E(gX,{key:1,"min-version":"1.3.15",placement:"feature_lock_email_templates","feature-title":A(u)("Custom Email Templates"),"feature-text":A(u)("Design beautiful email templates with a drag-and-drop block editor, shortcodes, and conditional content.")},{default:d(()=>[n(N,{label:A(u)("Email Body")},{default:d(()=>[n(xo,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("Shortcodes/Blocks shown here use sample data. Actual emails will be populated with real information.")},null,8,["description"]),n(gA,{ref_key:"editorFrameRef",ref:p,editorParams:{block_type:"template",campaign_title:c.value.settings.subject,bid:c.value.name},frameHeight:"calc(100vh - 60px)",documentTitle:c.value.settings.subject,onTitleUpdated:Z[6]||(Z[6]=ve=>{c.value.settings.subject=ve}),onPreviewRequest:U,modelValue:c.value.settings.email_body,"onUpdate:modelValue":Z[7]||(Z[7]=ve=>c.value.settings.email_body=ve)},null,8,["editorParams","documentTitle","modelValue"])]),_:1},8,["label"])]),_:1},8,["feature-title","feature-text"])):x("",!0)]),_:1})]),_:1})]),_:1}),(r(!0),h(P,null,te(_.value,ve=>(r(),E(Se,{key:ve.form_key,class:"mt-4"},{default:d(()=>[n(ke,null,{default:d(()=>[ve.title?(r(),h("h3",OX,m(ve.title),1)):x("",!0),ve.sub_title?(r(),h("p",PX,m(ve.sub_title),1)):x("",!0),n(Pp,{schema:ve.schema,values:ve.values,form_name:ve.form_key,ref_for:!0,ref_key:"extraFormRefs",ref:g},null,8,["schema","values","form_name"])]),_:2},1024)]),_:2},1024))),128))],64)),k.value&&b.value.length?(r(),h("div",HX,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(ae,{"label-position":"top"},{default:d(()=>[n(N,{label:A(u)("Attach PDF Template")},{default:d(()=>[n(fe,{modelValue:c.value.settings.attach_pdf_template,"onUpdate:modelValue":Z[8]||(Z[8]=ve=>c.value.settings.attach_pdf_template=ve),placeholder:A(u)("No PDF attachment"),clearable:"",style:{width:"100%","max-width":"360px"}},{default:d(()=>[(r(!0),h(P,null,te(b.value,ve=>(r(),E(oe,{key:ve.id,label:ve.title,value:ve.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})])):x("",!0),o("div",NX,[n(re,{onClick:W,type:"primary",disabled:s.value,loading:s.value},{default:d(()=>[R(m(A(u)("Update")),1)]),_:1},8,["disabled","loading"])])]),n(Ee,{modelValue:S.value,"onUpdate:modelValue":Z[12]||(Z[12]=ve=>S.value=ve),direction:"rtl",size:"70%",title:A(u)("Email Preview"),"append-to-body":!0,"close-on-click-modal":!0,onOpen:V},{footer:d(()=>[n(re,{onClick:I},{default:d(()=>[R(m(A(u)("Close")),1)]),_:1})]),default:d(()=>[$.value?Wt((r(),h("div",KX,null,512)),[[ye,!0]]):x("",!0),!$.value&&D.value?(r(),h(P,{key:1},[o("div",GX,[o("div",zX,[o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="desktop"}]),onClick:Z[9]||(Z[9]=ve=>F.value="desktop")},[Z[15]||(Z[15]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),o("path",{d:"M8 21h8"}),o("path",{d:"M12 17v4"})],-1)),o("span",null,m(A(u)("Desktop")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="tablet"}]),onClick:Z[10]||(Z[10]=ve=>F.value="tablet")},[Z[16]||(Z[16]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,m(A(u)("Tablet")),1)],2),o("button",{type:"button",class:de(["fct-device-btn",{active:F.value==="mobile"}]),onClick:Z[11]||(Z[11]=ve=>F.value="mobile")},[Z[17]||(Z[17]=o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),o("path",{d:"M12 18h.01"})],-1)),o("span",null,m(A(u)("Mobile")),1)],2)])]),n(xo,{class:"mb-3",type:"warning","show-icon":"",description:A(u)("The preview shown here uses sample data. Actual emails will be populated with real information.")},null,8,["description"]),o("div",{class:de(["fct-preview-stage","fct-preview-stage--"+F.value])},[o("div",{class:de(["fct-device-frame","fct-device-frame--"+F.value])},[o("iframe",{ref_key:"previewIframe",ref:B,frameborder:"0",scrolling:"auto",style:{width:"100%",height:"80vh",border:"none",display:"block"}},null,512)],2)],2)],64)):x("",!0)]),_:1},8,["modelValue","title"])])}}},qX={name:"StorageSettings",components:{Badge:fa,CardBody:ke,CardContainer:Se,SettingsHeader:Ua,AdminNotice:Ia,DynamicIcon:Y},props:["settings"],data(){return{loading:!1,availableDrivers:[]}},mounted(){this.getStorageDrivers()},methods:{translate:u,getLogo(e){return e},getDarkLogo(e){return e||null},getRowLabel(e){return this.isProLocked(e)?this.translate("Upgrade to Pro to use storage provider: %1$s",e.title):`${this.translate("Manage storage provider")}: ${e.title}`},getToggleLabel(e){return`${this.translate("Toggle storage driver status")}: ${e.title}`},canToggle(e){return!e.has_bucket&&!e.requires_pro},canManage(e){return!!e.route||!!e.upgrade_url},isProLocked(e){return!e.route&&!!e.upgrade_url},handleDriverAction(e){if(e.upgrade_url&&!e.route){window.open(e.upgrade_url,"_blank","noopener,noreferrer");return}e.route&&this.$router.push({name:e.route})},toggleStatus(e){const t=e.is_active_input,a=t==="yes"?"no":"yes";e.saving=!0,this.$post("settings/storage-drivers/change-status",{driver:e.route,status:t}).then(l=>{e.status=t==="yes",this.$notify({type:"success",title:this.translate("Success"),message:l.message})}).catch(l=>{e.is_active_input=a,this.handleError(l)}).finally(()=>{e.saving=!1})},getStorageDrivers(){this.loading=!0,this.$get("settings/storage-drivers").then(e=>{this.availableDrivers=Object.values(e.drivers||{}).map(t=>({...t,is_active_input:t.status?"yes":"no",saving:!1}))}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})}}},YX={class:"setting-wrap"},WX={class:"setting-wrap-inner"},JX={key:0,class:"storage-setting-list fct-content-card-list"},XX=["role","tabindex","aria-label","onClick","onKeydown"],ZX={class:"flex items-start gap-3"},eZ=["src","alt"],tZ=["src","alt"],aZ={class:"flex-1 min-w-0 pl-15"},lZ={class:"fct-content-card-list-head"},sZ={class:"title-wrap"},nZ={class:"fct-content-card-list-content"};function oZ(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("Badge"),g=C("el-switch"),y=C("DynamicIcon"),v=C("el-button"),w=C("CardBody"),k=C("CardContainer");return r(),h("div",YX,[n(c,{heading:i.translate("Storage Providers"),"show-save-button":!1},null,8,["heading"]),o("div",WX,[n(p),n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(f,{loading:s.loading,animated:"",rows:6},null,8,["loading"]),s.loading?x("",!0):(r(),h("div",JX,[(r(!0),h(P,null,te(s.availableDrivers,(b,S)=>(r(),h("div",{key:b.route||S,class:de(["fct-content-card-list-item",i.canManage(b)?"cursor-pointer":""]),role:i.canManage(b)?"button":void 0,tabindex:i.canManage(b)?0:-1,"aria-label":i.getRowLabel(b),onClick:$=>i.handleDriverAction(b),onKeydown:[xa(Ge($=>i.handleDriverAction(b),["prevent"]),["enter"]),xa(Ge($=>i.handleDriverAction(b),["prevent"]),["space"])]},[o("div",ZX,[o("div",{class:de(`fct-content-card-list-icon ${b.title.toLowerCase()}`)},[o("img",{class:de({"dark:hidden":i.getDarkLogo(b.dark_logo)}),src:i.getLogo(b.logo),alt:b.title},null,10,eZ),i.getDarkLogo(b.dark_logo)?(r(),h("img",{key:0,src:i.getDarkLogo(b.dark_logo),alt:b.title,class:"hidden dark:block"},null,8,tZ)):x("",!0)],2),o("div",aZ,[o("div",lZ,[o("div",sZ,[o("h6",null,m(b.title),1)]),n(_,{size:"small",status:b.status?"active":"inactive","hide-icon":!0},null,8,["status"])]),o("div",nZ,[o("p",null,m(b.description),1)])]),i.canToggle(b)?(r(),h("div",{key:0,class:"fct-content-card-list-action",onClick:t[0]||(t[0]=Ge(()=>{},["stop"])),onKeydown:t[1]||(t[1]=Ge(()=>{},["stop"]))},[n(g,{modelValue:b.is_active_input,"onUpdate:modelValue":$=>b.is_active_input=$,"active-value":"yes","inactive-value":"no",loading:b.saving,"aria-label":i.getToggleLabel(b),onChange:$=>i.toggleStatus(b)},null,8,["modelValue","onUpdate:modelValue","loading","aria-label","onChange"])],32)):i.isProLocked(b)?(r(),h("div",{key:1,class:"fct-content-card-list-action",onClick:t[2]||(t[2]=Ge(()=>{},["stop"])),onKeydown:t[3]||(t[3]=Ge(()=>{},["stop"]))},[n(v,{type:"primary",class:"el-button--x-small",tag:"a",href:b.upgrade_url,target:"_blank",rel:"noopener noreferrer"},{default:d(()=>[n(y,{name:"Crown"}),R(" "+m(i.translate("Upgrade to Pro")),1)]),_:2},1032,["href"])],32)):i.canManage(b)?(r(),h("div",{key:2,class:"fct-content-card-list-action",onClick:t[4]||(t[4]=Ge(()=>{},["stop"])),onKeydown:t[5]||(t[5]=Ge(()=>{},["stop"]))},[n(v,{class:"el-button--x-small",onClick:$=>i.handleDriverAction(b)},{default:d(()=>[R(m(i.translate("Manage")),1)]),_:2},1032,["onClick"])],32)):x("",!0)])],42,XX))),128))]))]),_:1})]),_:1})])])}const iZ=nt(qX,[["render",oZ]]),rZ={class:"fct-setting-header"},dZ={key:0,class:"fct-setting-header-action"},uZ={class:"setting-wrap-inner"},wc={__name:"GlobalStorageComponents",setup(e){const t=T({}),a=T(""),l=T({}),s=T(!1),i=T(!1),c=T(""),p=bd(),f=T({}),_=K(()=>!!a.value),g=nl(),y=ws(),v=()=>{i.value=!0,Ae.get("settings/storage-drivers/"+c.value).then(b=>{t.value=b.settings||{},a.value=b.template||"",l.value=b.template_payload||{},f.value={},b.template||p.setSchema(b.fields).setDefaults(b.settings).initForm()}).catch(b=>{var S;t.value={},a.value="",l.value={},f.value={},p.setSchema({}).setDefaults({}),q.error(((S=b==null?void 0:b.data)==null?void 0:S.message)||u("Failed to load storage settings."))}).finally(()=>{i.value=!1})},w=()=>{if(_.value)return;let b=p.values;s.value=!0,Ae.post("settings/storage-drivers",{settings:{...b},driver:c.value}).then(S=>{var $;t.value.is_active=($=S.data)==null?void 0:$.is_active,q.success(S.message||u("Storage Settings updated!")),p.values=S.data,S.data.shouldReload&&v()}).catch(S=>{var $;S.status_code=="422"?q.validationErrors(S):q.error(($=S.data)==null?void 0:$.message)}).finally(()=>{s.value=!1})},k=()=>{c.value=g.name};return be(g,(b,S)=>{k(),v()}),y.onSave(()=>{_.value||w()}),Ie(()=>{k(),v()}),(b,S)=>{const $=C("el-breadcrumb-item"),D=C("el-breadcrumb"),F=C("el-button"),B=C("el-skeleton");return r(),h("div",{class:de(["setting-wrap",c.value])},[o("div",rZ,[n(D,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[n($,{to:{name:"storage"}},{default:d(()=>[R(m(A(u)("Storage Providers")),1)]),_:1}),A(da).headline(c.value)?(r(),E($,{key:0},{default:d(()=>[R(m(A(da).headline(c.value)),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"]),_.value?x("",!0):(r(),h("div",dZ,[n(F,{type:"primary",onClick:w,loading:s.value,disabled:s.value||i.value,size:"small"},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading","disabled"])]))]),o("div",uZ,[n(Ia),i.value?(r(),E(Se,{key:0},{default:d(()=>[n(ke,null,{default:d(()=>[n(B,{loading:i.value,animated:"",rows:5},null,8,["loading"])]),_:1})]),_:1})):(r(),h(P,{key:1},[_.value?(r(),E(Hp,{key:0,widget:{type:"vue-template",component:a.value,payload:l.value},data:{route_name:c.value}},null,8,["widget","data"])):(r(),E(Si,{key:1,form:A(p),showSubmitButton:!1,loading:s.value,onOnChange:S[0]||(S[0]=U=>{}),"validation-errors":f.value},null,8,["form","loading","validation-errors"]))],64))])],2)}}},cZ=["innerHTML"],AZ={class:"fct-select-template-wrap"},pZ={class:"fct-select-template-wrap flex gap-2 flex-row"},fZ={class:"setting-save-action"},mZ={__name:"AddEmailNotification",setup(e){const t=Jt().ctx,a=T(),l=T(!0),s=T(!1),i=T({}),c=T(),p=T([{label:u("After Order Created"),value:"fluent_cart/order_created"},{label:u("After Order Updated"),value:"fluent_cart/order_updated"},{label:u("After Payment Paid"),value:"fluent_cart/order_paid"},{label:u("After User Created"),value:"fluent_cart/user_created"},{label:u("After Refund made"),value:"fluent_cart/order_refunded"}]),f=T({}),_=T([{label:"Admin Email",value:"{wp.admin_email}"},{label:"Customer Email",value:"{order.customer.email}"},{label:"User Email",value:"{user.user_email}"}]),g=T({}),y=T({});sl(),nl();let v=null;const w=T([]),k=T([]),b=T({});ws().onSave(()=>{B()});const $=O=>{const L=O;t.$post("email-notification/getTemplate/",{template:L}).then(H=>{var j;i.value.content=H.data.content,(j=a.value)==null||j.setContent(i.value.content)}).catch(H=>{}).finally(()=>{l.value=!1})},D=()=>{var O;(O=a.value)==null||O.setContent("")},F=()=>{l.value=!0,t.$get("email-notification/get-short-codes").then(O=>{f.value=O.data.shortcodes,g.value=O.data.email_templates,y.value=Object.keys(O.data.buttons).map(L=>({[L]:O.data.buttons[L]}))}).catch(O=>{}).finally(()=>{l.value=!1})},B=O=>{O&&O.preventDefault(),b.value={},l.value=!0,t.$post("email-notification/create",i.value).then(L=>{t.handleSuccess(L)}).catch(L=>{var H;L.status_code=="422"?(q.validationErrors(L),b.value=L.data):q.error((H=L.data)==null?void 0:H.message)}).finally(()=>{l.value=!1})},U=()=>{s.value=!0,c.value=i.value.content};Ie(()=>{F()});const Q=O=>{v=O},V=O=>{b.value&&b.value.hasOwnProperty(O)&&delete b.value[O]},I=()=>{i.value.to=w.value},M=()=>{i.value.from=k.value};return(O,L)=>{const H=C("el-dialog"),j=C("el-input"),W=C("el-form-item"),G=C("el-option"),Z=C("el-select"),ne=C("el-col"),ce=C("el-row"),z=C("el-tooltip"),ue=C("el-button"),ie=C("el-form");return r(),E(Se,null,{default:d(()=>[n(Ve,{title:i.value.title?i.value.title:A(u)("Add Notification"),title_size:"small",border_bottom:"",icon:"Message"},{action:d(()=>L[20]||(L[20]=[])),_:1},8,["title"]),n(ke,null,{default:d(()=>[n(H,{modelValue:s.value,"onUpdate:modelValue":L[0]||(L[0]=J=>s.value=J),title:O.$t("Preview")},{default:d(()=>[o("div",{innerHTML:c.value},null,8,cZ)]),_:1},8,["modelValue","title"]),n(ie,{"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(W,{label:O.$t("Notification Name"),required:""},{default:d(()=>{var J,N;return[n(j,{modelValue:i.value.title,"onUpdate:modelValue":L[1]||(L[1]=ae=>i.value.title=ae),onFocus:L[2]||(L[2]=ae=>V("title"))},null,8,["modelValue"]),n(_l,{"validation-errors":(N=(J=b.value)==null?void 0:J.title)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(W,{label:O.$t("Select notification event"),required:""},{default:d(()=>{var J,N;return[n(Z,{multiple:!0,modelValue:i.value.events,"onUpdate:modelValue":L[3]||(L[3]=ae=>i.value.events=ae),placeholder:O.$t("Select Events"),onFocus:L[4]||(L[4]=ae=>V("events")),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(p.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(_l,{"validation-errors":(N=(J=b.value)==null?void 0:J.events)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),n(ce,{gutter:15},{default:d(()=>[n(ne,{lg:12},{default:d(()=>[n(W,{label:O.$t("Mail From:"),required:""},{default:d(()=>{var J,N;return[n(j,{modelValue:i.value.from,"onUpdate:modelValue":L[7]||(L[7]=ae=>i.value.from=ae),onFocus:L[8]||(L[8]=ae=>V("from")),placeholder:O.$t("Select a Field or Type Custom Value")},{append:d(()=>[n(Z,{modelValue:k.value,"onUpdate:modelValue":L[5]||(L[5]=ae=>k.value=ae),onChange:L[6]||(L[6]=ae=>M()),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(_.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"]),n(_l,{"validation-errors":(N=(J=b.value)==null?void 0:J.from)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(ne,{lg:12},{default:d(()=>[n(W,{label:O.$t("Send Mail To:"),required:""},{default:d(()=>{var J,N;return[n(j,{modelValue:i.value.to,"onUpdate:modelValue":L[11]||(L[11]=ae=>i.value.to=ae),onFocus:L[12]||(L[12]=ae=>V("to"))},{append:d(()=>[n(Z,{modelValue:w.value,"onUpdate:modelValue":L[9]||(L[9]=ae=>w.value=ae),onChange:L[10]||(L[10]=ae=>I()),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(_.value,ae=>(r(),E(G,{key:ae.value,label:ae.label,value:ae.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),n(_l,{"validation-errors":(N=(J=b.value)==null?void 0:J.to)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})]),_:1}),n(W,{label:O.$t("Cc:")},{default:d(()=>[n(j,{modelValue:i.value.cc,"onUpdate:modelValue":L[13]||(L[13]=J=>i.value.cc=J)},null,8,["modelValue"])]),_:1},8,["label"]),n(W,{label:O.$t("Mail Subject:"),required:""},{default:d(()=>{var J,N;return[n(j,{modelValue:i.value.subject,"onUpdate:modelValue":L[14]||(L[14]=ae=>i.value.subject=ae),onFocus:L[15]||(L[15]=ae=>V("subject"))},null,8,["modelValue"]),n(_l,{"validation-errors":(N=(J=b.value)==null?void 0:J.subject)==null?void 0:N.required},null,8,["validation-errors"])]}),_:1},8,["label"]),o("div",null,[n(ls,{ref_key:"wpEditor",ref:a,"short-codes":f.value,buttons:y.value,onOnEditorReady:Q,onUpdate:L[18]||(L[18]=J=>{i.value.content=J}),modelValue:i.value.content,"onUpdate:modelValue":L[19]||(L[19]=J=>i.value.content=J)},{action:d(()=>[o("div",AZ,[n(Z,{onChange:L[16]||(L[16]=J=>{var N;(N=a.value)==null||N.setContent(J)}),placeholder:O.$t("Select button"),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(y.value,(J,N)=>(r(),E(G,{key:N,label:Object.keys(J)[0],value:Object.values(J)[0]},null,8,["label","value"]))),128))]),_:1},8,["placeholder"])]),o("div",pZ,[n(Z,{onChange:L[17]||(L[17]=J=>{$(J)}),placeholder:O.$t("Select template"),clearable:""},{default:d(()=>[(r(!0),h(P,null,te(g.value,(J,N)=>(r(),E(G,{key:N,label:J.label,value:J.path},null,8,["label","value"]))),128))]),_:1},8,["placeholder"]),o("span",null,[n(z,{effect:"dark",content:O.$t("Reset Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{onClick:Ge(D,["prevent"]),tag:"button"},{default:d(()=>[n(Y,{name:"Refresh"})]),_:1})]),_:1},8,["content"])])])]),preview_button:d(()=>[A(v)!==null?(r(),E(z,{key:0,effect:"dark",content:O.$t("Preview Template"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{onClick:Ge(U,["prevent"]),tag:"button"},{default:d(()=>[n(Y,{name:"Eye"})]),_:1})]),_:1},8,["content"])):x("",!0)]),_:1},8,["short-codes","buttons","modelValue"])]),o("div",fZ,[n(ue,{onClick:B,type:"primary",disabled:l.value,loading:l.value},{default:d(()=>[R(m(O.$t("Save Notification")),1)]),_:1},8,["disabled","loading"])])]),_:1})]),_:1})]),_:1})}}};class hZ extends Vs{getTabs(){return{all:u("All"),success:u("Success"),warning:u("Warning"),error:u("Error"),failed:u("Failed"),info:u("Info"),api:u("API Only")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Content",value:"content"},{label:"Date",value:"date"},{label:"Actions",value:"actions"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"activity"}parseResponse(t){return t.activities}getTableName(){return"log_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}}function _Z(e){return hZ.init(e)}const vZ={class:"fct-table-mobile-wrap fct-logs-table-mobile-wrap"},gZ={class:"fct-table-mobile-header"},yZ={class:"fct-table-date-col"},bZ={class:"mark-read-unread-wrap"},wZ=["onClick","title"],CZ=["onClick","title"],kZ=["title"],BZ={class:"fct-table-mobile-body"},xZ={key:0,class:"fct-table-title-col"},SZ={key:1,class:"fct-table-content-col"},FZ={class:"fct-table-mobile-footer"},$Z={class:"fct-table-mobile-footer-row"},EZ={class:"fct-table-status-col"},UZ={class:"title"},IZ={class:"fct-table-module-col"},QZ={class:"title"},DZ={class:"value"},VZ={key:0,class:"fct-table-actions-col"},TZ={class:"title"},MZ={__name:"LogsTableMobile",props:{table:{type:Object}},emits:["changeStatus"],setup(e,{emit:t}){const a=t,l=(s,i)=>{a("changeStatus",s,i)};return(s,i)=>{const c=C("el-icon"),p=C("router-link");return r(),h("div",vZ,[(r(!0),h(P,null,te(e.table.getTableData(),(f,_)=>(r(),h("div",{key:f.id,class:"fct-table-mobile-row"},[o("div",gZ,[o("div",yZ,[o("div",bZ,[f.read_status!=="unread"?(r(),h("span",{key:0,onClick:g=>l(f,"unread"),title:A(u)("Mark as unread")},[n(c,null,{default:d(()=>[n(A(Do))]),_:1})],8,wZ)):(r(),h("span",{key:1,onClick:g=>l(f,"read"),title:A(u)("Mark as read")},[n(c,null,{default:d(()=>[n(A(sd))]),_:1})],8,CZ))]),o("div",{title:A(u)("Logs ID: %s",f.id),class:"invoice-no"}," #"+m(f.id),9,kZ),e.table.isColumnVisible("date")?(r(),h(P,{key:0},[i[0]||(i[0]=o("span",{class:"bullet"},"•",-1)),n(Pa,{class:"date","date-time":f.created_at,"with-time":!0},null,8,["date-time"])],64)):x("",!0)])]),o("div",BZ,[e.table.isColumnVisible("title")?(r(),h("div",xZ,m(f.title),1)):x("",!0),e.table.isColumnVisible("content")?(r(),h("div",SZ,m(f.content),1)):x("",!0)]),o("div",FZ,[o("div",$Z,[o("div",EZ,[o("div",UZ,m(A(u)("Status")),1),(r(),E(fa,{status:f.status,size:"small",key:f.id},null,8,["status"]))]),o("div",IZ,[o("div",QZ,m(A(u)("Module")),1),o("div",DZ,m(f.module_name),1)]),e.table.isColumnVisible("actions")?(r(),h("div",VZ,[o("div",TZ,m(A(u)("Actions")),1),f.module_id&&f.module_name.toLowerCase()==="order"?(r(),E(p,{key:0,class:"value",to:{name:"view_order",params:{order_id:f.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):x("",!0),f.module_id&&f.module_name.toLowerCase()==="subscription"?(r(),E(p,{key:1,class:"value",to:{name:"view_subscription",params:{subscription_id:f.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):x("",!0)])):x("",!0)])])]))),128))])}}},LZ={},RZ={class:"px-4 py-3"},OZ={class:"grid grid-cols-3 gap-5 mt-5"};function PZ(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",RZ,[(r(),h(P,null,te(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",OZ,[(r(),h(P,null,te(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const HZ=nt(LZ,[["render",PZ]]),NZ={class:"table-cell"},KZ={class:"table-cell"},GZ={class:"table-cell"},zZ={class:"table-cell"},jZ={class:"table-cell"},qZ={class:"table-cell"},YZ={class:"table-cell"},WZ={__name:"LogsLoader",props:{nextPageCount:{type:Number,default:0},logTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton"),p=C("el-table-column"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(p,{width:143,label:A(u)("ID")},{default:d(()=>[o("div",NZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("date")?(r(),E(p,{key:0,label:A(u)("Date"),width:172},{default:d(()=>[o("div",KZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("title")?(r(),E(p,{key:1,label:A(u)("Title"),width:287},{default:d(()=>[o("div",GZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.logTable.isColumnVisible("content")?(r(),E(p,{key:2,label:A(u)("Content"),width:287},{default:d(()=>[o("div",zZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(p,{label:A(u)("Status"),width:143},{default:d(()=>[o("div",jZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Module"),width:143},{default:d(()=>[o("div",qZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.logTable.isColumnVisible("actions")?(r(),E(p,{key:3,label:A(u)("Actions"),width:114},{default:d(()=>[o("div",YZ,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},JZ={class:"fct-all-logs-page fct-layout-width"},XZ={key:1},ZZ={class:"inline-flex items-center gap-1"},eee=["onClick","title"],tee=["onClick","title"],aee={__name:"Logs",setup(e){const t=Jt().ctx,a=_Z(),l=T([]),s=(i,c)=>{t.$put("activity/"+i.id+"/mark-read",{id:i.id,status:c}).then(p=>{l.value.find(f=>f.id===i.id).read_status=c,t.handleSuccess(p)}).catch(p=>{var f;p.status_code=="422"?q.validationErrors(p):q.error((f=p.data)==null?void 0:f.message)})};return a.onDataLoaded(function(){l.value=a.getTableData()}),(i,c)=>{const p=C("el-icon"),f=C("el-table-column"),_=C("el-button"),g=C("el-table");return r(),h("div",JZ,[n(ol,{title:A(u)("Logs")},null,8,["title"]),n(Ts,{table:A(a),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:d(()=>[A(a).isLoading()?(r(),E(HZ,{key:0})):x("",!0),A(a).isLoading()?x("",!0):(r(),E(MZ,{key:1,table:A(a),onChangeStatus:s},null,8,["table"]))]),default:d(()=>[A(a).isLoading()?(r(),E(WZ,{key:0,logTable:A(a),"next-page-count":A(a).nextPageCount},null,8,["logTable","next-page-count"])):(r(),h("div",XZ,[n(g,{class:"w-full",data:A(a).getTableData()},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any logs matching your filter.")},null,8,["text"])]),default:d(()=>[n(f,{label:A(u)("ID"),width:100},{default:d(y=>[o("div",ZZ,[y.row.read_status!=="unread"?(r(),h("span",{key:0,onClick:v=>s(y.row,"unread"),title:A(u)("Mark as unread"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(Do))]),_:1})],8,eee)):(r(),h("span",{key:1,onClick:v=>s(y.row,"read"),title:A(u)("Mark as read"),class:"cursor-pointer"},[n(p,null,{default:d(()=>[n(A(sd))]),_:1})],8,tee)),R(" #"+m(A(sa)(y.row.id)),1)])]),_:1},8,["label"]),A(a).isColumnVisible("date")?(r(),E(f,{key:0,label:A(u)("Date"),width:120},{default:d(y=>[n(Pa,{"date-time":y.row.created_at},null,8,["date-time"])]),_:1},8,["label"])):x("",!0),A(a).isColumnVisible("title")?(r(),E(f,{key:1,label:A(u)("Title"),width:200},{default:d(y=>[R(m(y.row.title),1)]),_:1},8,["label"])):x("",!0),A(a).isColumnVisible("content")?(r(),E(f,{key:2,label:A(u)("Content"),width:200},{default:d(y=>[R(m(y.row.content),1)]),_:1},8,["label"])):x("",!0),n(f,{label:A(u)("Status"),width:100},{default:d(y=>[(r(),E(fa,{status:y.row.status,size:"small",key:y.row.id},null,8,["status"]))]),_:1},8,["label"]),n(f,{label:A(u)("Module"),width:100},{default:d(y=>[R(m(y.row.module_name),1)]),_:1},8,["label"]),A(a).isColumnVisible("actions")?(r(),E(f,{key:3,label:A(u)("Actions"),width:80},{default:d(y=>[y.row.module_id&&y.row.module_name.toLowerCase()==="order"?(r(),E(_,{key:0,tag:"router-link",class:"el-button--x-small",to:{name:"view_order",params:{order_id:y.row.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):x("",!0),y.row.module_id&&y.row.module_name.toLowerCase()==="subscription"?(r(),E(_,{key:1,tag:"router-link",class:"el-button--x-small",to:{name:"view_subscription",params:{subscription_id:y.row.module_id}}},{default:d(()=>[R(m(A(u)("View")),1)]),_:2},1032,["to"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])}}},lee=["title"],see={__name:"RemoveButton",props:{filterKey:{type:String,required:!0},itemId:{type:[String,Number],default:null}},emits:["remove"],setup(e,{emit:t}){const a=e,l=t,s=()=>{l("remove",{filterKey:a.filterKey,itemId:a.itemId})};return(i,c)=>(r(),h("button",{class:"fct-applied-filter-remove",onClick:s,title:i.$t("Remove")},[n(Y,{name:"Close"})],8,lee))}},nee={__name:"StatusFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-option"),c=C("el-select");return r(),E(c,{modelValue:A(a).data.selectedFilters[e.filterItemKey].value,"onUpdate:modelValue":s[0]||(s[0]=p=>A(a).data.selectedFilters[e.filterItemKey].value=p),placeholder:l.$t("Select Status"),filterable:"",onChange:A(a).applyFilterChange,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(P,null,te(e.filterItem.options,p=>(r(),E(i,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","onChange"])}}},vf={__name:"DateRangeFilter",props:{modelValue:Array,type:{type:String,default:"daterange"},separator:{type:String,default:"-"},startPlaceholder:{type:String,default:""},endPlaceholder:{type:String,default:""},unlinkPanels:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placement:{type:String,default:"bottom-end"},showArrow:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},filterState:{type:[Object]}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=T(null),c=K({get:()=>a.modelValue,set:g=>l("update:modelValue",g)}),p=K(()=>ze.get("app_config.isProActive"));function f(g){l("change",g)}function _(){s.data.dateRange=[ca.withTimezone(lt().subtract(1,"month").format("YYYY-MM-DD 00:00:00")),ca.withTimezone(lt().format("YYYY-MM-DD 23:59:59"))],l("change",s.data.dateRange)}return cl(()=>{}),(g,y)=>{const v=C("el-date-picker"),w=Va("translate-numbers");return r(),h("div",{class:de(`fct-date-range-filter ${e.clearable?"is-clearable":""}`)},[Wt(n(v,{ref_key:"datePickerRef",ref:i,modelValue:c.value,"onUpdate:modelValue":y[0]||(y[0]=k=>c.value=k),type:e.type,"range-separator":e.separator,"start-placeholder":e.startPlaceholder||A(u)("Start date"),"end-placeholder":e.endPlaceholder||A(u)("End date"),"unlink-panels":e.unlinkPanels,clearable:e.clearable,shortcuts:A(cA),onChange:f,placement:e.placement,disabled:e.disabled||!p.value},null,8,["modelValue","type","range-separator","start-placeholder","end-placeholder","unlink-panels","clearable","shortcuts","placement","disabled"]),[[w,"translate-numbers"]]),e.showArrow?(r(),E(Y,{key:0,name:"ChevronDown",class:"fct-applied-filter-expand-icon"})):x("",!0),p.value&&e.clearable?(r(),E(Y,{key:1,onClick:_,name:"CircleClose",class:"fct-applied-filter-clear-all"})):x("",!0)],2)}}},gf={__name:"CurrencyFilter",props:{modelValue:String,currencies:{type:Array,required:!0}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=e,l=t,s=K({get:()=>a.modelValue,set:c=>l("update:modelValue",c)}),i=c=>{l("change",c)};return(c,p)=>{const f=C("el-option"),_=C("el-select");return r(),E(_,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=g=>s.value=g),placeholder:c.$t("Select Currency"),filterable:"",onChange:i,"popper-class":"fct-dropdown-compact",size:"small"},{default:d(()=>[(r(!0),h(P,null,te(e.currencies,(g,y)=>(r(),E(f,{key:y,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},oee={__name:"ResetFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("button",{onClick:s[0]||(s[0]=(...i)=>A(a).resetFilters&&A(a).resetFilters(...i)),class:"reset-filters-btn"},m(l.$t("Reset Filters")),1))}},iee={__name:"MultiselectFilter",props:{filterState:{type:[Object]},filterItem:{type:Object,required:!0},filterItemKey:{type:String,required:!0}},setup(e){const t=e,a=t.filterState,l=K({get:()=>{var s;return((s=a.data.selectedFilters[t.filterItemKey])==null?void 0:s.value)??[]},set:s=>{a.setMultiSelectChange(t.filterItemKey,s)}});return(s,i)=>{const c=C("el-option"),p=C("el-select");return r(),E(p,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=f=>l.value=f),placeholder:s.$t("Select Order Type"),multiple:"",filterable:"","popper-class":"fct-dropdown-compact fct-multi-select-filter",size:"small"},{default:d(()=>[(r(!0),h(P,null,te(e.filterItem.options,f=>(r(),E(c,{key:f.value,label:f.label,value:f},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])}}},ree={class:"fct-compare-to-filter"},dee={class:"fct-applied-filter-label"},uee={class:"fct-applied-filter-actions"},cee={class:"fct-compare-to-select"},Aee={class:"fct-compare-to-date"},pee={__name:"CompareToFilter",props:{filterState:{type:[Object]}},emits:["selectChange","dateChange"],setup(e,{emit:t}){const a=e,l=t,s=a.filterState,i=K({get:()=>{var f;return((f=s.data.selectedFilters.compareType)==null?void 0:f.value)??s.data.compareType},set:f=>{s.setCompareTypeChange(f),l("selectChange",f)}}),c=K({get:()=>{var f;return((f=s.data.selectedFilters.compareDate)==null?void 0:f.value)??s.data.compareDate},set:f=>{s.setCompareDateChange(f),l("dateChange",f)}}),p=K(()=>ze.get("app_config.isProActive"));return(f,_)=>{const g=C("el-option"),y=C("el-select"),v=C("el-date-picker");return r(),h("div",ree,[o("div",dee,m(A(u)("Compare to")),1),o("div",uee,[o("div",cee,[n(y,{modelValue:i.value,"onUpdate:modelValue":_[0]||(_[0]=w=>i.value=w),"popper-class":"fct-dropdown-compact",disabled:!p.value},{default:d(()=>[n(g,{label:A(u)("Previous Period"),value:"previous_period"},null,8,["label"]),n(g,{label:A(u)("Previous Month"),value:"previous_month"},null,8,["label"]),n(g,{label:A(u)("Previous Quarter"),value:"previous_quarter"},null,8,["label"]),n(g,{label:A(u)("Previous Year"),value:"previous_year"},null,8,["label"]),n(g,{label:A(u)("Custom"),value:"custom"},null,8,["label"]),n(g,{label:A(u)("No Comparison"),value:"no_comparison"},null,8,["label"])]),_:1},8,["modelValue","disabled"])]),o("div",Aee,[i.value==="custom"?(r(),E(v,{key:0,modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=w=>c.value=w),type:"date",size:"small",placeholder:A(u)("Select Date")},null,8,["modelValue","placeholder"])):x("",!0)])])])}}},fee={style:{"flex-wrap":"wrap","row-gap":"4px",display:"flex","align-items":"center"}},mee={key:0},yf={__name:"TreeSelectFilter",props:{filterState:{type:Object,required:!0}},setup(e){const a=e.filterState,l=T([]),s=T([]),i=T(!1),c=Jt().ctx;let p=0;const f=k=>{const b=Vt.get("product_variations");b&&(l.value=b);const S=++p;if(l.value.length&&!k){s.value=[...l.value],i.value=!1;return}i.value=!0,c.$get("products/searchVariantByName",{name:k}).then($=>{S===p&&(s.value=$,k||(l.value=$,Vt.set("product_variations",$)))}).catch(()=>{}).finally(()=>{S===p&&(i.value=!1)})},_=cd.debounce(f),g=(k,b)=>{const S=b.checkedNodes||[],$={};[...S,...b.halfCheckedNodes||[]].forEach(D=>{(D.children||[]).forEach(F=>{$[F.value]=D.label})}),a.setTreeSelectItem(S.map(D=>({...D,productName:$[D.value]})))},y=k=>{a.removeTreeSelectItem(k)},v=()=>{a.clearTreeSelect()},w=K(()=>{var S;const k=((S=a.data.selectedFilters.variation_ids)==null?void 0:S.value)||[];let b={};return k.forEach($=>{const D=$.productName||"Unknown";b[D]||(b[D]=[]),b[D].push($.label||$.id)}),b});return Ie(()=>{const k=a.retrieveSavedReportFilters();k&&k.variation_ids&&(a.data.variation_ids=k.variation_ids),f("")}),(k,b)=>{const S=C("el-tag"),$=C("el-tree-select");return r(),E($,{placeholder:k.$t("Select Products"),modelValue:A(a).data.variation_ids,"onUpdate:modelValue":b[0]||(b[0]=D=>A(a).data.variation_ids=D),data:s.value,"filter-method":A(_),filterable:"","show-checkbox":"",multiple:"",clearable:"",loading:i.value,onCheck:g,"popper-class":"fct-tooltip-long",onRemoveTag:y,onClear:v,size:"small"},{tag:d(()=>[o("div",fee,[(r(!0),h(P,null,te(w.value,(D,F)=>(r(),E(S,{style:{"margin-right":"4px"}},{default:d(()=>[R(m(F)+" ",1),D.length?(r(),h("span",mee," | "+m(D.join(", ")),1)):x("",!0)]),_:2},1024))),256))])]),_:1},8,["placeholder","modelValue","data","filter-method","loading"])}}},hee={class:"fct-applied-filters-wrap"},_ee={class:"fct-applied-filter-list"},vee={class:"fct-applied-filter fct-applied-filter-date"},gee={class:"fct-applied-filter-label"},yee={class:"fct-applied-filter-value"},bee={key:0,class:"fct-applied-filter fct-applied-filter-compare-to"},wee={class:"fct-applied-filter-label"},Cee={class:"fct-applied-filter-value"},kee={key:2,class:"fct-applied-filter-clear-wrap"},Bee={__name:"AppliedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState,l=nl(),s=({filterKey:f,itemId:_})=>{a.removeFilter(f,_)},i=f=>!(["dateRange","compareType","compareDate"].includes(f)||l.name==="reports_customer"||l.name==="reports_sources"),c=K(()=>["reports_revenue","reports_subscriptions","reports_products","reports_customer","reports_sales","reports_orders","reports_refunds","reports_sources"].includes(l.name)),p=K(()=>Object.keys(a.data.selectedFilters).filter(f=>!(f==="orderTypes"&&l.name==="reports_subscriptions")).reduce((f,_)=>(f[_]=a.data.selectedFilters[_],f),{}));return be(a.data.dateRange,f=>{}),(f,_)=>(r(),h("div",hee,[o("ul",_ee,[o("li",vee,[o("div",gee,m(f.$t("Date:")),1),o("div",yee,[n(vf,{modelValue:A(a).data.dateRange,"onUpdate:modelValue":_[0]||(_[0]=g=>A(a).data.dateRange=g),placement:"bottom-start",reRenderDate:A(a).data.reRenderDate,showArrow:!0,size:"small",onChange:A(a).setDateRange,clearable:"",filterState:A(a)},null,8,["modelValue","reRenderDate","onChange","filterState"])])]),c.value?(r(),h("li",bee,[n(pee,{filterState:A(a)},null,8,["filterState"])])):x("",!0),Object.keys(p.value).length?(r(!0),h(P,{key:1},te(p.value,(g,y)=>(r(),h(P,{key:y},[i(y)?(r(),h("li",{key:0,class:de(`fct-applied-filter ${y==="variation_ids"?"fct-applied-filter-variation":""} ${y==="orderTypes"?"fct-applied-filter-order-types":""}`)},[o("div",wee,m(g.label)+":",1),o("div",Cee,[g.type==="list"?(r(),E(nee,{key:0,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):x("",!0),g.type==="multi-list"?(r(),E(iee,{key:1,"filter-state":A(a),"filter-item":g,"filter-item-key":y},null,8,["filter-state","filter-item","filter-item-key"])):y==="variation_ids"?(r(),E(yf,{key:2,"filter-state":A(a)},null,8,["filter-state"])):y==="currency"?(r(),E(gf,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":_[1]||(_[1]=v=>A(a).data.currency=v),currencies:A(a).currencies,onChange:v=>{A(a).setSelectChange(v,{...g,value:y})}},null,8,["modelValue","currencies","onChange"])):x("",!0)]),y!=="variation_ids"?(r(),E(see,{key:0,filterKey:y,itemId:y==="variation_ids"?g.value[0].id:null,onRemove:s},null,8,["filterKey","itemId"])):x("",!0)],2)):x("",!0)],64))),128)):x("",!0),Object.keys(p.value).length?(r(),h("li",kee,[n(oee,{"filter-state":A(a)},null,8,["filter-state"])])):x("",!0)])]))}},xee={class:"fct-filter-dropdown-header"},See={key:0,class:"fct-filter-back-wrapper"},Fee={class:"fct-filter-active-label"},$ee={key:1,class:"fct-filter-dropdown-search-input"},Eee={__name:"FilterHeader",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>{const i=C("el-input");return r(),h("div",xee,[A(a).data.activeFilter!=null?(r(),h("div",See,[o("button",{class:"fct-filter-back-button",onClick:s[0]||(s[0]=c=>A(a).selectActiveFilter(null))},[n(Y,{name:"ArrowLeft"})]),o("span",Fee,m(A(a).activeFilterOptions.label),1)])):(r(),h("div",$ee,[n(i,{modelValue:A(a).data.searchQuery,"onUpdate:modelValue":s[1]||(s[1]=c=>A(a).data.searchQuery=c),placeholder:l.$t("Search Filter..."),clearable:""},null,8,["modelValue","placeholder"])]))])}}},Uee={class:"fct-filter-dropdown-active-filter-list"},Iee=["onClick"],Qee={__name:"StatusList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",Uee,[(r(!0),h(P,null,te(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelected(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOption(i)},m(i.label),9,Iee)],2))),128))]))}},Dee={class:"fct-filter-dropdown-active-filter-list is-multi-list"},Vee=["onClick"],Tee={__name:"MultiList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",Dee,[(r(!0),h(P,null,te(A(a).activeFilterOptions.options,(i,c)=>(r(),h("li",{key:c,class:de(["fct-filter-active-option-item",{"is-selected":A(a).isFilterOptionSelectedMulti(i)}])},[o("div",{class:"fct-filter-dropdown-active-button",onClick:p=>A(a).selectFilterOptionMulti(i)},m(i.label),9,Vee)],2))),128))]))}},Mee={class:"fct-filter-dropdown-active-filter"},Lee={__name:"SelectedFilters",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("div",Mee,[A(a).activeFilterOptions.type==="list"?(r(),E(Qee,{key:0,"filter-state":A(a)},null,8,["filter-state"])):x("",!0),A(a).activeFilterOptions.type==="multi-list"?(r(),E(Tee,{key:1,"filter-state":A(a)},null,8,["filter-state"])):x("",!0),A(a).activeFilterOptions.type==="date"?(r(),E(vf,{key:2,modelValue:A(a).data.dateRange,"onUpdate:modelValue":s[0]||(s[0]=i=>A(a).data.dateRange=i),onChange:A(a).setDateRange},null,8,["modelValue","onChange"])):x("",!0),A(a).activeFilterOptions.type==="currency"?(r(),E(gf,{key:3,modelValue:A(a).data.currency,"onUpdate:modelValue":s[1]||(s[1]=i=>A(a).data.currency=i),currencies:A(a).currencies,onChange:A(a).setSelectChange},null,8,["modelValue","currencies","onChange"])):x("",!0),A(a).activeFilterOptions.type==="tree-select"?(r(),E(yf,{key:4,"filter-state":A(a)},null,8,["filter-state"])):x("",!0)]))}},Ree={class:"fct-filter-dropdown-list"},Oee=["onClick"],Pee={key:1,class:"fct-filter-dropdown-list-item filter-not-found"},Hee={__name:"FilterOptionList",props:{filterState:{type:[Object]}},setup(e){const a=e.filterState;return(l,s)=>(r(),h("ul",Ree,[A(a).visibleFilters.length?(r(!0),h(P,{key:0},te(A(a).visibleFilters,(i,c)=>(r(),h("li",{class:"fct-filter-dropdown-list-item",key:c},[o("div",{class:"fct-filter-dropdown-button",onClick:p=>A(a).selectActiveFilter(i)},[n(Y,{name:i.icon},null,8,["name"]),R(" "+m(i.label),1)],8,Oee)]))),128)):(r(),h("li",Pee,m(A(a).data.searchQuery?A(u)("No filter found"):A(u)("All filters selected")),1))]))}},Nee={key:0,class:"fct-filter-dropdown"},Kee={class:"fct-filter-dropdown-body"},Gee={key:1},zee={__name:"FilterDropdown",props:{filterState:{type:[Object]}},setup(e){const t=e,a=T(null),l=t.filterState,s=ze.get("app_config.isProActive"),i=[{label:u("Order Type"),icon:"AppsLine",type:"multi-list",value:"orderTypes",disableRoutes:["reports_customer","reports_subscriptions"],options:[{label:u("All"),value:"all"},{label:u("One time"),value:"payment"},{label:u("Subscription"),value:"subscription"},{label:u("Renewal"),value:"renewal"}]},{label:u("Subscription Type"),icon:"Reload",type:"list",value:"subscriptionType",disableRoutes:["reports_revenue","reports_products","reports_customer","reports_sales","reports_refunds","reports_orders","reports_sales"],options:[{label:u("Active"),value:"subscription"},{label:u("Renewal"),value:"renewal"},{label:u("Expired"),value:"expired"},{label:u("Canceled"),value:"canceled"}]},{label:u("Currency"),icon:"Currency",type:"currency",value:"currency",disableRoutes:["reports_products","reports_customer","reports_subscriptions"]},{label:u("Products"),icon:"ListView",type:"tree-select",value:"variation_ids",disableRoutes:["reports_customer"]}];l.setFilterOption(i);const c=p=>{const f=a.value,_=p.target,g=document.querySelectorAll(".el-picker-panel"),y=Array.from(g).some(v=>v.contains(_));f!=null&&f.contains(_)||y||(l.data.searchQuery="",l.dropdownOpen&&l.toggleDropdown())};return Ie(()=>{document.addEventListener("click",c)}),cl(()=>{document.removeEventListener("click",c)}),(p,f)=>(r(),h("div",{ref_key:"dropdownRef",ref:a,class:"fct-filter-dropdown-container",onClick:f[0]||(f[0]=Ge(()=>{},["stop"]))},[n(at,{class:"fct-filter-dropdown-toggle-button",size:"small",tag:"button",onClick:A(l).toggleDropdown},{default:d(()=>[n(Y,{name:"Filter"})]),_:1},8,["onClick"]),n(Xl,{name:"fade-scale","enter-active-class":"transition ease-out duration-200","leave-active-class":"transition ease-in duration-150","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:d(()=>[A(l).dropdownOpen?(r(),h("div",Nee,[A(s)?(r(),h(P,{key:0},[n(Eee,{"filter-state":A(l)},null,8,["filter-state"]),o("div",Kee,[A(l).data.activeFilter!=null?(r(),E(Lee,{key:0,"filter-state":A(l)},null,8,["filter-state"])):(r(),E(Hee,{key:1,"filter-state":A(l)},null,8,["filter-state"]))])],64)):(r(),h("div",Gee,[n(dn,{class:"py-7.5",placement:"feature_lock_report_advanced_filtering",title:A(u)("Upgrade to Pro for filtering"),text:A(u)("This feature is only available in FluentCart Pro.")},null,8,["title","text"])]))])):x("",!0)]),_:1})],512))}},jee={class:"fct-report-nav-links-wrap"},qee={class:"fct-settings-nav-collapse-button-wrapper"},Yee={class:"fct-menu-collapse-button-text"},Wee=["onClick"],Jee=["src","alt"],Xee=["src","alt"],Zee={class:"fct-settings-nav-link-text"},ete={class:"fct-settings-nav-child-list"},tte=["onClick"],ate={__name:"ReportNavLinks",emits:["update:menuState"],setup(e,{emit:t}){const a=sl(),l=nl(),s=[{route:"reports_overview",label:u("Overview"),url:"/reports/overview",icon:"Overview"},{route:"reports_sales",label:u("Sales"),url:"/reports/sales",icon:"LineChart"},{route:"reports_orders",label:u("Orders"),url:"/reports/orders",icon:"Cart"},{route:"reports_revenue",label:u("Revenue"),url:"/reports/revenue",icon:"Revenue"},{route:"reports_refunds",label:u("Refunds"),url:"/reports/refunds",icon:"Refund"},{route:"reports_subscriptions",label:u("Subscriptions"),url:"/reports/subscriptions",icon:"Subscription",always_open:!0,child:[{route:"subscriptions-retention",label:u("Retention"),url:"/reports/subscriptions/subscriptions-retention"},{route:"subscriptions-cohorts",label:u("Cohorts"),url:"/reports/subscriptions/subscriptions-cohorts"},{route:"future_renewals",label:u("Future Renewals"),url:"/reports/subscriptions/future-renewals"}]},{route:"reports_products",label:u("Products"),url:"/reports/products",icon:"Product"},{route:"reports_customer",label:u("Customers"),url:"/reports/customer",icon:"Users"},{route:"reports_sources",label:u("Sources"),url:"/reports/sources",icon:"Source"}];ze.get("addon_report_sidebar",[]).forEach(U=>s.push(U));const i=T(!1),c=T(!1),p=T(window.innerWidth>=1024),f=t,_=T(null),g=T(null),y=U=>!U.child||!(!F.value||B.value)?!1:v(U)||U.always_open,v=U=>{const Q=l.path;return!!(U.child&&U.child.length&&U.child.some(I=>Q===I.url||Q.includes(I.url))||Q===U.url||Q.includes(U.url))},w=(U,Q,V)=>l.path===U.url,k=U=>{a.push({name:U.route}).catch(V=>{V.name});const Q=document.querySelector("#fct-report-body");Q&&(Q.scrollTop=0)},b=()=>{if(!p.value){_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open");return}i.value=!i.value,c.value=!1},S=()=>{p.value||(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open"))},$=()=>{const U=window.innerWidth,Q=p.value;p.value=U>=1024,!Q&&p.value&&(_.value&&_.value.classList.remove("is-nav-open"),g.value&&g.value.classList.remove("is-overlay-open")),Q&&!p.value&&(i.value=!1)};be([i,c,p],()=>{f("update:menuState",{isMenuCollapsed:i.value,isMenuExpanded:c.value,isDesktopView:p.value})},{immediate:!0});const F=K(()=>i.value),B=K(()=>p.value&&i.value&&c.value);return Ie(()=>{$(),window.addEventListener("resize",$)}),Bt(()=>{window.removeEventListener("resize",$)}),(U,Q)=>{const V=C("el-button"),I=C("el-tooltip");return r(),h("div",jee,[o("div",{ref_key:"overlayRef",ref:g,class:"fct-settings-menu-overlay",onClick:S},null,512),o("div",{ref_key:"sidebarRef",ref:_,class:de(["fct-settings-nav-container",{"is-collapsed":F.value,"is-expanded":B.value}])},[o("div",qee,[n(I,{content:A(u)("Toggle reports"),placement:"right"},{default:d(()=>[n(V,{onClick:b},{default:d(()=>[n(Y,{name:"Window"}),o("span",Yee,m(A(u)("Reports")),1)]),_:1})]),_:1},8,["content"])]),o("ul",{class:"fct-settings-nav",onMouseenter:Q[0]||(Q[0]=M=>p.value&&i.value&&(c.value=!0)),onMouseleave:Q[1]||(Q[1]=M=>c.value=!1)},[(r(),h(P,null,te(s,(M,O)=>o("li",{key:O,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":v(M)}])},[o("div",{onClick:L=>k(M),class:"fct-settings-nav-link"},[M.icon_img?(r(),h(P,{key:0},[o("img",{src:M.icon_img,alt:M.label,class:de(M.icon_img_dark?"w-5 h-5 dark:hidden":"w-5 h-5")},null,10,Jee),M.icon_img_dark?(r(),h("img",{key:0,src:M.icon_img_dark,alt:M.label,class:"w-5 h-5 hidden dark:block"},null,8,Xee)):x("",!0)],64)):M.icon?(r(),E(Y,{key:1,name:M.icon,class:"w-5 h-5"},null,8,["name"])):x("",!0),o("span",Zee,[R(m(M.label)+" ",1),n(Y,{name:"ChevronRight",class:"fct-settings-nav-link-icon"})])],8,Wee),n(ya,{accordion:"",visible:y(M),class:"fct-settings-nav-child-wrap"},{default:d(()=>[o("ul",ete,[(r(!0),h(P,null,te(M.child,(L,H)=>(r(),h("li",{key:H,class:de(["fct-settings-nav-item",{"fct-settings-nav-item-active":w(L,H,M)}])},[o("div",{onClick:j=>k(L),class:"fct-settings-nav-link"},m(L.label),9,tte)],2))),128))])]),_:2},1032,["visible"])],2)),64))],32)],2)])}}},lte={class:"fct-reports-view-inner"},ste={class:"fct-report-body",id:"fct-report-body"},nte={key:0,class:"fct-report-filter-wrap"},ote={key:1,class:"fct-report-filter-button"},ite={class:"fct-report-body-inner"},rte={__name:"ReportsView",setup(e){var v;const t=T({isMenuCollapsed:!0,isMenuExpanded:!1,isDesktopView:!0}),a=Np(),l=nl(),s=T((v=l.meta)==null?void 0:v.title),i=K(()=>Ka.data);a.onFilterChanged(w=>{_(w)});const c=K(()=>!["reports_overview","reports_customer","future_renewals","reports_sources"].includes(l.name)),p=K(()=>["reports_overview","reports","future_renewals"].includes(l.name));let f=null;const _=w=>{Object.entries(w).forEach(([k,b])=>{let S=b.value;switch(b.type==="multi-list"&&(S=b.value.map($=>$.value)),k){case"orderStatus":case"paymentStatus":case"currency":case"compareType":case"compareDate":case"subscriptionType":case"orderTypes":Ka.data[k]=S;break;case"dateRange":Ka.data.dateRange=b.value,Ka.data.rangeKey=b.rangeKey;break;case"variation_ids":Ka.data[k]=Array.isArray(b.value)?b.value.map($=>$.id):[];break}}),Ka.onFilterChange()},g=()=>{var k,b;const w=a.retrieveSavedFilters();w?(a.data.selectedFilters={...w},((b=(k=w.dateRange)==null?void 0:k.value)==null?void 0:b.length)===2&&(a.data.dateRange=[w.dateRange.value[0],w.dateRange.value[1]])):a.data.selectedFilters={}},y=w=>{t.value=w};return be(()=>l.name,(w,k)=>{var b;s.value=((b=l.meta)==null?void 0:b.title)||"Reports"}),Ie(()=>{Ka.fetchReportMeta(),g(),f=document.getElementById("fluent_cart_plugin_app"),f&&f.classList.add("fct_report_page_plugin_app_wrap")}),Bt(()=>{f&&f.classList.remove("fct_report_page_plugin_app_wrap")}),cl(()=>{Vt.remove("product_variations")}),(w,k)=>{const b=C("router-view");return r(),h("div",{class:de(["fct-reports-view",{"is-collapsed":t.value.isMenuCollapsed,"is-expanded":t.value.isMenuExpanded&&t.value.isDesktopView}])},[o("div",lte,[n(ate,{"onUpdate:menuState":y}),o("div",ste,[n(Ua,{heading:A(u)(s.value),"show-save-button":!1},null,8,["heading"]),!p.value||c.value?(r(),h("div",nte,[p.value?x("",!0):(r(),E(Bee,{key:0,"filter-state":A(a)},null,8,["filter-state"])),!p.value&&c.value?(r(),h("div",ote,[n(zee,{"filter-state":A(a)},null,8,["filter-state"])])):x("",!0)])):x("",!0),o("div",ite,[n(Ia),i.value.storeMode!==i.value.filterMode&&i.value.filterMode&&i.value.filterMode!==""?(r(),E(el,{key:0,class:"mb-5 alert-yellow",icon:"InformationFill",content:w.$t("Your store is in %1$s mode but you are watching data in %2$s mode.",i.value.storeMode,i.value.filterMode)},null,8,["content"])):x("",!0),n(b,null,{default:d(({Component:S})=>[(r(),E(gl(S),{reportFilter:A(Ka)},null,8,["reportFilter"]))]),_:1})])])])],2)}}},dte=nt(rte,[["__scopeId","data-v-081223ea"]]),ute={__name:"lineChart",props:{xAxis:{type:Array,default:()=>[],required:!0},yAxis:{type:Array,default:()=>[],required:!0},lineColor:{type:String,default:"#42b983"},backgroundGradient:{type:Array,required:!0},chartTitle:{type:String,default:""},hasCurrency:{type:Boolean,default:!1}},setup(e){const t=e,a=T(null),l=(y,v,w,k)=>({name:y,type:v,data:w,smooth:!0,color:k,showSymbol:!0,areaStyle:{color:new mr(0,0,0,1,t.backgroundGradient.map(b=>({offset:b.offset,color:b.color})))}}),s=()=>{const y=[];return y.push(l("","line",t.yAxis,t.lineColor)),y},i=y=>{const v=y.split("-");if(v.length===3){const[w,k,b]=v;return`${Oa[parseInt(k)-1]} ${b}, ${w}`}else if(v.length===2){const[w,k]=v;return`${Oa[parseInt(k)-1]} ${w}`}else if(v.length===1){const[w]=v;return`${w}`}},c=K(()=>t.xAxis.map(y=>i(y)));let p=null;const f=()=>{if(a.value&&p==null){p=na(a.value);const y={title:{show:!1},tooltip:{trigger:"axis",valueFormatter:v=>t.hasCurrency?za(v*100):v},grid:{show:!1,left:"10%",right:"10%",bottom:"80%"},xAxis:{type:"category",data:c.value,axisLabel:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{show:!1},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}},series:s()};p.setOption(y),window.addEventListener("resize",()=>{p.resize()})}},_=()=>{p&&p.setOption({xAxis:{data:t.xAxis},series:s()})};be(()=>[t.xAxis,t.yAxis],()=>{xe(()=>{_()})});const g=()=>{_()};return Ie(()=>{window.addEventListener("fluentCartCurrencyChange",g),xe(()=>{f()})}),Bt(()=>{window.removeEventListener("fluentCartCurrencyChange",g,!1)}),(y,v)=>(r(),h("div",{style:{height:"70px"},ref_key:"chartRef",ref:a},null,512))}},cte=nt(ute,[["__scopeId","data-v-b4cb951c"]]);function bf(e){return Number(e)>0}function fs(e){return bf(e)?"text-red-500":""}function Ul(e,t=null){return(t!==null?t:bf(e))?`(${ft.scaled(e)})`:ft.scaled(e)}const Ate=["innerHTML"],Rs={__name:"ReportSummary",props:{amount:{type:[Number,String],required:!0},placement:{type:String,default:"top"},title:{type:String,default:""}},setup(e){const t=e,a=K(()=>t.title?t.title+" "+t.amount:t.amount);return(l,s)=>{const i=C("el-tooltip");return r(),E(i,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,m(a.value),1)]),default:d(()=>[o("span",{class:"cursor-pointer",innerHTML:e.amount},null,8,Ate)]),_:1},8,["placement"])}}},vl={__name:"Fluctuation",props:{fluctuation:{type:[String,Number],required:!0},isLiability:{type:Boolean,default:!1},placement:{type:String,default:"top"},amount:{type:[String,Number],required:!1},title:{type:String,default:""},hasCurrency:{type:Boolean,default:!0},isPercentage:{type:Boolean,default:!1},fluctuationSuffix:{type:String,default:""}},setup(e){const t=e,a=K(()=>Ka.data.compareType!=="no_comparison"),l=K(()=>ua(t.fluctuation)),s=K(()=>(t.hasCurrency?ft.scaled:ua)(t.amount)),i=K(()=>(t.title?t.title:u("Previously"))+" "+s.value+(t.isPercentage?"%":"")),c=K(()=>{if(t.fluctuation===0)return"text-system-light";const f=t.fluctuation>0;return(t.isLiability?!f:f)?"text-success-500":"text-red-500"}),p=K(()=>t.fluctuation<0?"CaretDown":"CaretUp");return(f,_)=>{const g=C("el-tooltip");return a.value?(r(),h("div",{key:0,class:de(["percentage",c.value])},[e.fluctuation!==0?(r(),E(Y,{key:0,class:"w-2",name:p.value},null,8,["name"])):x("",!0),n(g,{effect:"dark",placement:e.placement,"popper-class":"fct-tooltip"},{content:d(()=>[o("span",null,m(i.value),1)]),default:d(()=>[o("span",{class:de(["cursor-pointer",c.value])},[R(m(l.value)+"% ",1),e.fluctuationSuffix?(r(),h(P,{key:0},[R(m(e.fluctuationSuffix),1)],64)):x("",!0)],2)]),_:1},8,["placement"])],2)):x("",!0)}}},pte={class:"fct-report-result"},fte={key:0,class:"fct-report-result-content"},mte={key:1,class:"fct-report-result-content"},hte={class:"title flex items-center gap-1"},_te={class:"value"},vte={class:"inline-flex"},gte={key:2,class:"fct-report-result-chart"},yte={key:3,class:"fct-report-result-chart"},bte={__name:"SummaryCards",props:{defaultReport:{type:Object,required:!0}},setup(e){const t=e;K(()=>reportFilter.currentCurrencySign),K(()=>defaultReport.data.isBusy.salesReport);const a=(f,_)=>{const g=parseInt(f.replace("#",""),16),y=g>>16&255,v=g>>8&255,w=g&255;return`rgba(${y}, ${v}, ${w}, ${_})`},l=Te.colors.report,s=T([{title:u("Gross Sales"),key:"gross_sale",graph:"grossSaleGraph",lineColor:l.sea_green,backgroundGradient:[{offset:0,color:a(l.sea_green,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",graph:"refundsGraph",lineColor:l.medium_slate_blue,backgroundGradient:[{offset:0,color:a(l.medium_slate_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue."),liability:!0},{title:u("Revenue"),key:"net_revenue",graph:"netRevenueGraph",lineColor:l.royal_blue,backgroundGradient:[{offset:0,color:a(l.royal_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Gross sales less refunds, taxes, shipping, fees.")},{title:u("Orders"),key:"order_count",graph:"orderGraph",lineColor:l.medium_turquoise,backgroundGradient:[{offset:0,color:a(l.medium_turquoise,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of orders placed in this period.")},{title:u("Items"),key:"total_item_count",graph:"itemsSoldGraph",lineColor:l.deep_sky_blue,backgroundGradient:[{offset:0,color:a(l.deep_sky_blue,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("The total number of items sold in this period.")},{title:u("Total Refunds"),key:"total_refunded",graph:"refundCountGraph",lineColor:l.golden_rod,backgroundGradient:[{offset:0,color:a(l.golden_rod,.5)},{offset:1,color:"rgba(255, 255, 255, 0)"}],info:u("Total refunds count including partially refunds.")}]),i=K(()=>s.value.map(f=>({...f,value:t.defaultReport.summaryData[f.key]||0,fluctuation:t.defaultReport.fluctuations[f.key]||0,graph:t.defaultReport.data.graphs[f.graph]||{},dataBusy:t.defaultReport.data.isBusy.salesReport||!1,graphBusy:t.defaultReport.data.isBusy.graphs[f.graph]||!1,liability:f.liability||!1}))),c=f=>["net_revenue","total_refunded_amount","gross_sale"].includes(f),p=f=>c(f.key)?Ul(f.value,f.liability):ua(f.value);return(f,_)=>{const g=C("el-skeleton"),y=C("el-tooltip"),v=C("el-skeleton-item"),w=C("el-col"),k=C("el-row");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[n(k,{gutter:16,class:"gap-y-4"},{default:d(()=>[(r(!0),h(P,null,te(i.value,(b,S)=>(r(),E(w,{lg:8,md:12,key:S},{default:d(()=>[n(Gn,{class:"fct-report-summary-card h-[100px]"},{default:d(()=>[o("div",pte,[b.dataBusy?(r(),h("div",fte,[n(g,{animated:"",rows:1})])):(r(),h("div",mte,[o("div",hte,[R(m(b.title)+" ",1),n(y,{"popper-class":"fct-tooltip",content:b.info,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 cursor-pointer",name:"InformationFill"})]),_:2},1032,["content"])]),o("div",_te,[o("div",vte,[n(Rs,{amount:p(b),title:b.title},null,8,["amount","title"])]),n(vl,{fluctuation:b.fluctuation,amount:e.defaultReport.data.previousSummary[b.key],"is-liability":b.liability,"has-currency":c(b.key)},null,8,["fluctuation","amount","is-liability","has-currency"])])])),b.dataBusy?(r(),h("div",gte,[n(g,{animated:"",class:"flex items-center justify-end"},{template:d(()=>[n(v,{variant:"circle",class:"w-12.5 h-12.5 flex-none"})]),_:1})])):x("",!0),!b.dataBusy&&Object.keys(b.graph).length>0?(r(),h("div",yte,[n(cte,{ref_for:!0,ref:"lineChart",xAxis:Object.keys(b.graph),yAxis:Object.values(b.graph),lineColor:b.lineColor,backgroundGradient:b.backgroundGradient,"has-currency":c(b.key)},null,8,["xAxis","yAxis","lineColor","backgroundGradient","has-currency"])])):x("",!0)])]),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1})}}};const wte={key:0,class:"fct-report-sold-product-list has-scroll"},Cte={class:"list-left-content"},kte={class:"list-image"},Bte=["src","alt"],xte=["src"],Ste={class:"list-title"},Fte={class:"list-title-inner"},$te={class:"list-id"},Ete={class:"list-right-content"},Ute={class:"list-value"},Ite={class:"list-price"},Qte={class:"inline-flex"},Dte={__name:"TopSoldVariants",props:{defaultReport:{type:[Array,Object],required:!0}},setup(e){const t=Vl.data,a=K(()=>Vl.data.isBusy.topSoldVariants);return(l,s)=>{const i=C("el-skeleton"),c=C("router-link");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[n(Gn,{class:"top-sold-variants","card-options":{heading:A(u)("Top Sold Variants")}},{default:d(()=>{var p,f;return[a.value?(r(),E(i,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[((f=(p=A(t))==null?void 0:p.topSoldVariants)==null?void 0:f.length)>0?(r(),h("ul",wte,[(r(!0),h(P,null,te(A(t).topSoldVariants,_=>(r(),h("li",{key:_.product_id},[n(c,{to:{name:"product_edit",params:{product_id:_.product_id}}},{default:d(()=>{var g;return[o("div",Cte,[o("div",kte,[_.media_url!==null?(r(),h("img",{key:0,src:_.media_url,alt:(g=_.media)==null?void 0:g.title},null,8,Bte)):(r(),h("img",{key:1,src:l.getPlaceholderImage(),alt:""},null,8,xte))]),o("div",Ste,[o("div",Fte,m(_.variation_name),1),o("div",$te,[o("strong",null,m(_.product_name),1)])])]),o("div",Ete,[o("div",Ute,m(_.quantity)+" "+m(A(u)(" Sold")),1),o("div",Ite,[o("div",Qte,m(A(ft).scaled(_.total_amount)),1)])])]}),_:2},1032,["to"])]))),128))])):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no item!")},null,8,["text"]))],64))]}),_:1},8,["card-options"])]),_:1})}}},Vte={key:0,class:"flex items-center gap-2 justify-between"},Tte={class:"fct-btn-group sm"},Mte={__name:"Sources",props:{data:{type:Object,required:!0}},setup(e){const t=e,a=Te.colors,l=T(null),s=T(Te.isDark()),i=T("revenue"),c=T({}),p=$=>{const D=["#F6B51E","#855EF8","#47C2FF"],F=["#E6A819","#693EE0","#35ADE9"];return(s.value?F:D)[$]},f=K(()=>{if(typeof t.data.onetime_count===void 0)return[];if((t.data.onetime_count||0)===0&&(t.data.renewal_count||0)===0&&(t.data.subscription_count||0)===0)return[];const $={onetime:u("Onetime Payments"),renewal:u("Renewals"),subscription:u("Subscriptions")},D=t.data.order_count,F=[];return Object.keys($).forEach((B,U)=>{F.push({name:$[B],value:t.data[B+"_count"]||0,count:t.data[B+"_count"]||0,gross:t.data[B+"_gross"]||0,net:t.data[B+"_net"]||0,percentage:D?(t.data[B+"_count"]/D*100).toFixed(2):0,color:p(U),visible:c.value[$[B]]!==!1})}),F}),_=K(()=>!f.value.length),g=K(()=>Vl.data.isBusy.salesReport),y=K(()=>f.value.filter($=>c.value[$.name]!==!1).map(($,D)=>({value:i.value==="revenue"?$.net:$.count,count:$.count,name:$.name,gross:$.gross,net:$.net,itemStyle:{color:p(f.value.findIndex(F=>F.name===$.name))}})));let v=null;const w=()=>{v&&(v.dispose(),v=null),xe(()=>{l.value&&(v=na(l.value),k())})},k=()=>{if(!v)return;const $={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",confine:!0,position:wl,formatterr:"{b}: {c} ({d}%)",formatter:function(D){const F=s.value?"#ffffff":"#565865";return` | |
| 154 | 153 | <div style="font-weight: bold; margin-bottom: 4px;"> |
| 155 | - ${L.marker} ${L.name} (${L.percent}%) | |
| 154 | + ${D.marker} ${D.name} (${D.percent}%) | |
| 156 | 155 | </div> |
| 157 | 156 | <div> |
| 158 | - <span style="color: ${U};">${u("Orders")}</span> | |
| 159 | - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${U};"> | |
| 160 | - ${ia(L.data.count)} | |
| 157 | + <span style="color: ${F};">${u("Orders")}</span> | |
| 158 | + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> | |
| 159 | + ${ua(D.data.count)} | |
| 161 | 160 | </span> |
| 162 | 161 | </div> |
| 163 | 162 | <div> |
| 164 | - <span style="color: ${U};">${u("Gross Sales")}</span> | |
| 165 | - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${U};"> | |
| 166 | - ${Je.scaled(L.data.gross)} | |
| 163 | + <span style="color: ${F};">${u("Gross Sales")}</span> | |
| 164 | + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> | |
| 165 | + ${za(D.data.gross*100)} | |
| 167 | 166 | </span> |
| 168 | 167 | </div> |
| 169 | 168 | <div> |
| 170 | - <span style="color: ${U};">${u("Revenue")}</span> | |
| 171 | - <span style="font-weight: bold; float: right; margin-left: 15px; color: ${U};"> | |
| 172 | - ${Je.scaled(L.data.net)} | |
| 169 | + <span style="color: ${F};">${u("Revenue")}</span> | |
| 170 | + <span style="font-weight: bold; float: right; margin-left: 15px; color: ${F};"> | |
| 171 | + ${za(D.data.net*100)} | |
| 173 | 172 | </span> |
| 174 | 173 | </div> |
| 175 | - `},borderRadius:8,backgroundColor:s.value?"#38485a":"#ffffff",textStyle:{color:s.value?a.gray[25]:a.system.mid},borderColor:s.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:s.value?a.gray[25]:a.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};v.setOption(F,{notMerge:!0,replaceMerge:["series"]})};Ce([()=>m.value],()=>{Se(b)},{deep:!0}),Ce(_,F=>{F||C()}),Ce(g,F=>{F||C()}),Ce(i,()=>{b()});const w=F=>{s.value=Te.isDark(),b()},x=()=>{b()};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",x),Se(C)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",w),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,L)=>{const U=B("el-button"),S=B("el-button-group"),M=B("el-skeleton");return r(),$(Ln,{class:"sales-sources","card-options":{heading:A(u)("Sources")}},{action:d(()=>[_.value?k("",!0):(r(),h("div",OZ,[n(S,{class:"left"},{default:d(()=>[n(U,{size:"small",onClick:L[0]||(L[0]=I=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:d(()=>[R(f(A(u)("Revenue")),1)]),_:1},8,["type"]),n(U,{size:"small",onClick:L[1]||(L[1]=I=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:d(()=>[R(f(A(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",HZ,[n(ka,{targetRef:l.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),$(M,{key:0,animated:"",rows:7})):(r(),h(O,{key:1},[_.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No relevant data to plot the chart")},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1},8,["card-options"])}}},NZ={class:"fct-default-report-page"},KZ={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V(t.reportFilter),l=async s=>{s&&(await El.getSalesReport(s),await El.getTopSoldProducts(s),await El.getTopSoldVariants(s))};return Qe(()=>{a.value&&a.value.addListener("default-report",l)}),Ct(()=>{a.value&&a.value.removeListener("default-report")}),Ce(()=>t.reportFilter,s=>{a.value&&a.value.removeListener("default-report"),a.value=s,a.value&&(a.value.addListener("default-report",l),l(a.value.applicableFilters))},{immediate:!0}),(s,i)=>{const c=B("el-col"),p=B("el-row");return r(),h("div",NZ,[n(xZ,{"default-report":A(El)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(hd,{data:A(El).data.topSoldProducts,loading:A(El).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(RZ,{"default-report":A(El)},null,8,["default-report"])]),_:1}),k("",!0)]),_:1}),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(PZ,{data:A(El).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class GZ extends sl{constructor(){super(...arguments);Oe(this,"data",{order:["net_revenue","gross_sale","order_count","total_item_count","average_net","average_gross","average_order_items_count"],revenue:["Revenue","Gross Sales","Refund","Taxes","Shipping","Discount"],refund:["Total Refunds","Total Refunded Amount","Avg. Refunded Amount","Refund Rate","Total Paid"],product:["average_selling_price","units_sold","gross_sale","customer_count"]});Oe(this,"storageKey","report-checkbox-filter");Oe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Lt.get(this.storageKey);this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund}addListener(a,l){this.listeners[a]=l}async onCheckBoxChange(a,l){const s=this.data[a];s.includes(l)?this.data[a]=s.filter(i=>i!==l):this.data[a].push(l),this.syncStorage();for(let i in this.listeners)this.listeners[i](this.applicableFilters)}syncStorage(){Lt.set(this.storageKey,this.applicableFilters.checkbox)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{checkbox:{order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,product:this.data.product}}}}const Ml=GZ.init(),jZ={class:"fct-revenue-line-chart-wrap"},zZ={class:"flex items-center gap-2"},qZ={class:"fct-card-header-title is-small"},YZ={class:"fct-chart-select"},WZ={class:"fct-btn-group sm"},XZ={key:2,class:"chart-action-wrap"},JZ={class:"chart-change-wrap"},ZZ={class:"chart-change"},eee={class:"text"},tee={class:"chart-change"},aee={class:"text"},lee={__name:"RevenueLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(va.getChartType("revenue","revenue_chart")||"line"),i=V(!1),c=Te.colors.report,p=V(Te.isDark()),m=(T,Q,E,D,H,P=!1)=>({name:T,type:Q,barMaxWidth:30,yAxisIndex:E,data:D,smooth:!1,color:H,hidden:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:H},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:H,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=V(a.appliedGroupKey);Ce(()=>a.appliedGroupKey,T=>{_.value=T});const g=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),b=K(()=>{let T=[{name:u("Current Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(Q=>Q.net_revenue)}];return C.value&&T.unshift({name:u("Compare Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(Q=>({value:Q.net_revenue,date:Q.group})),hidden:!1}),T.map(Q=>m(Q.name,Q.type,0,Q.data,Q.color,Q.hidden))});let w=null;const x=()=>{w&&(w.dispose(),w=null),Se(()=>{l.value&&(w=Jt(l.value),U())})},F=K(()=>{const T=Es(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+T}),L=K(()=>dl(a.chartData.length)),U=()=>{if(!w)return;const T=Ql(a.chartData),Q={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"},selected:Object.fromEntries(b.value.map(E=>[E.name,!E.hidden]))},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,valueFormatter:E=>`${Je.scaled(E)}`,formatter:E=>{let D="";const H=p.value?"#ffffff":"#565865";return E.forEach(function(P,G){const oe=typeof P.data=="object"&&P.data!==null?Us(P.data.date):P.name,Z=Je.scaled(P.value),W=E.length>1&&G===0;W&&(D+='<div style="margin-bottom: 10px">'),D+=`<div>${oe}</div>`,D+=`<div> | |
| 176 | - ${P.marker} | |
| 177 | - <span style="color: ${H}">${P.seriesName}</span> | |
| 178 | - <span style="float: right; margin-left: 20px; color: ${H}"> | |
| 179 | - ${ia(Z)} | |
| 174 | + `},borderRadius:8,backgroundColor:s.value?"#38485a":"#ffffff",textStyle:{color:s.value?a.gray[25]:a.system.mid},borderColor:s.value?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"70%",data:y.value,label:{show:!0,color:s.value?a.gray[25]:a.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};v.setOption($,{notMerge:!0,replaceMerge:["series"]})};be([()=>f.value],()=>{xe(k)},{deep:!0}),be(_,$=>{$||w()}),be(g,$=>{$||w()}),be(i,()=>{k()});const b=$=>{s.value=Te.isDark(),k()},S=()=>{k()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",S),xe(w)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),($,D)=>{const F=C("el-button"),B=C("el-button-group"),U=C("el-skeleton");return r(),E(Gn,{class:"sales-sources","card-options":{heading:A(u)("Sources")}},{action:d(()=>[_.value?x("",!0):(r(),h("div",Vte,[n(B,{class:"left"},{default:d(()=>[n(F,{size:"small",onClick:D[0]||(D[0]=Q=>i.value="revenue"),type:i.value==="revenue"?"primary":""},{default:d(()=>[R(m(A(u)("Revenue")),1)]),_:1},8,["type"]),n(F,{size:"small",onClick:D[1]||(D[1]=Q=>i.value="orders"),type:i.value==="orders"?"primary":""},{default:d(()=>[R(m(A(u)("Orders")),1)]),_:1},8,["type"])]),_:1}),o("div",Tte,[n(Sa,{targetRef:l.value},null,8,["targetRef"])])]))]),default:d(()=>[g.value?(r(),E(U,{key:0,animated:"",rows:7})):(r(),h(P,{key:1},[_.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No relevant data to plot the chart")},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:l},null,512))],64))]),_:1},8,["card-options"])}}},Lte={class:"fct-default-report-page"},Rte={__name:"DefaultReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T(t.reportFilter),l=async s=>{s&&(await Vl.getSalesReport(s),await Vl.getTopSoldProducts(s),await Vl.getTopSoldVariants(s))};return Ie(()=>{a.value&&a.value.addListener("default-report",l)}),Bt(()=>{a.value&&a.value.removeListener("default-report")}),be(()=>t.reportFilter,s=>{a.value&&a.value.removeListener("default-report"),a.value=s,a.value&&(a.value.addListener("default-report",l),l(a.value.applicableFilters))},{immediate:!0}),(s,i)=>{const c=C("el-col"),p=C("el-row");return r(),h("div",Lte,[n(bte,{"default-report":A(Vl)},null,8,["default-report"]),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(Sd,{data:A(Vl).data.topSoldProducts,loading:A(Vl).data.isBusy.topSoldProducts},null,8,["data","loading"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(Dte,{"default-report":A(Vl)},null,8,["default-report"])]),_:1}),x("",!0)]),_:1}),n(p,{gutter:30,class:"gap-y-4 my-5"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(Mte,{data:A(Vl).data.summaryData},null,8,["data"])]),_:1})]),_:1})])}}};class Ote extends tl{constructor(){super(...arguments);Pe(this,"data",{order:["net_revenue","gross_sale","order_count","total_item_count","average_net","average_gross","average_order_items_count"],revenue:["Revenue","Gross Sales","Refund","Taxes","Shipping","Discount"],refund:["Total Refunds","Total Refunded Amount","Avg. Refunded Amount","Refund Rate","Total Paid"],product:["average_selling_price","units_sold","gross_sale","customer_count"]});Pe(this,"storageKey","report-checkbox-filter");Pe(this,"listeners",{})}beforeInit(){this.mergeWithStorage()}mergeWithStorage(){const a=Vt.get(this.storageKey);this.data.order=a.order??this.data.order,this.data.revenue=a.revenue??this.data.revenue,this.data.refund=a.refund??this.data.refund}addListener(a,l){this.listeners[a]=l}async onCheckBoxChange(a,l){const s=this.data[a];s.includes(l)?this.data[a]=s.filter(i=>i!==l):this.data[a].push(l),this.syncStorage();for(let i in this.listeners)this.listeners[i](this.applicableFilters)}syncStorage(){Vt.set(this.storageKey,this.applicableFilters.checkbox)}removeListener(a){delete this.listeners[a]}get applicableFilters(){return{checkbox:{order:this.data.order,revenue:this.data.revenue,refund:this.data.refund,product:this.data.product}}}}const Nl=Ote.init();function fn(e,t){const a=K(()=>{if(t.value&&t.value!=="default")return u("Auto");const[s,i]=e.data.dateRange||[];if(!s||!i)return u("Auto");const c=Math.floor(Math.abs(new Date(i)-new Date(s))/(1e3*60*60*24));let p;return c<=91?p=u("Daily"):c<=365?p=u("Monthly"):p=u("Yearly"),u("Auto (%1$s)",p)});return{groupKeys:K(()=>[{value:"default",label:a.value},{value:"daily",label:u("Daily")},{value:"monthly",label:u("Monthly")},{value:"yearly",label:u("Yearly")}])}}const Pte={class:"fct-revenue-line-chart-wrap"},Hte={class:"flex items-center gap-2"},Nte={class:"fct-card-header-title is-small"},Kte={class:"fct-chart-select"},Gte={class:"fct-btn-group sm"},zte={key:2,class:"chart-action-wrap"},jte={class:"chart-change-wrap"},qte={class:"chart-change"},Yte={class:"text"},Wte={class:"chart-change"},Jte={class:"text"},Xte={__name:"RevenueLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(ba.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Te.colors.report,p=T(Te.isDark()),f=(V,I,M,O,L,H=!1)=>({name:V,type:I,barMaxWidth:30,yAxisIndex:M,data:O,smooth:!1,color:L,hidden:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,V=>{_.value=V});const{groupKeys:g}=fn(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let V=[{name:u("Current Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(I=>I.net_revenue)}];return w.value&&V.unshift({name:u("Compare Revenue"),key:"net_revenue",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(I=>({value:I.net_revenue,date:I.group})),hidden:!1}),V.map(I=>f(I.name,I.type,0,I.data,I.color,I.hidden))});let b=null;const S=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=na(l.value),F())})},$=K(()=>{const V=Ms(a.reportFilter.data.dateRange);return u("This report looks at the revenue you received ")+V}),D=K(()=>pl(a.chartData.length)),F=()=>{if(!b)return;const V=Ol(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"},selected:Object.fromEntries(k.value.map(M=>[M.name,!M.hidden]))},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,c.dark_cyan_blue_16,c.light_gray_blue,s.value),confine:!0,position:wl,alwaysShowContent:!1,valueFormatter:M=>za(M*100),formatter:M=>{let O="";const L=p.value?"#ffffff":"#565865";return M.forEach(function(H,j){const G=typeof H.data=="object"&&H.data!==null?Ls(H.data.date):H.name,Z=za(H.value*100),ne=M.length>1&&j===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div> | |
| 175 | + ${H.marker} | |
| 176 | + <span style="color: ${L}">${H.seriesName}</span> | |
| 177 | + <span style="float: right; margin-left: 20px; color: ${L}"> | |
| 178 | + ${ua(Z)} | |
| 180 | 179 | </span> |
| 181 | - </div>`,W&&(D+="</div>")}),D}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:L.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:E=>`${Je.scaled(E)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):U()},M=T=>{va.onChange("revenue","revenue_chart",T),s.value!==T&&(i.value=!1,s.value=T,U())};Ce([()=>a.chartData,_],()=>{Se(U)},{deep:!0}),Ce(()=>Ml.data.revenue,()=>{Se(()=>{U()})},{deep:!0}),Ce(()=>a.isEmpty,T=>{T||x()}),Ce(()=>a.loading,T=>{T||x()});const I=()=>{p.value=Te.isDark(),Se(()=>{U()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",I),window.addEventListener("fluentCartCurrencyChange",I),Se(()=>{x()})}),(T,Q)=>{const E=B("el-tooltip"),D=B("el-option"),H=B("el-select"),P=B("el-skeleton");return r(),h("div",jZ,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",zZ,[o("h5",qZ,f(A(u)("Revenue Chart")),1),n(E,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",YZ,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=G=>_.value=G),onChange:v},{default:d(()=>[(r(),h(O,null,ae(g,G=>n(D,{key:G.value,label:A(u)(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",WZ,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:M},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:de(i.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),$(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?k("",!0):(r(),h("div",XZ,[o("div",JZ,[o("div",ZZ,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",eee,f(A(u)("Data")),1)]),o("div",tee,[o("span",aee,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},see={components:{DynamicIcon:ee},props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},methods:{exportCSV(){const t=(s=>{const i=_=>_.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),c=Object.keys(s[0]),m=[c.map(i).join(",")];return s.forEach(_=>{const g=c.map(y=>{let v=_[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});m.push(g.join(","))}),m.join(` | |
| 182 | -`)})(this.data),a=new Blob([t],{type:"text/csv"}),l=document.createElement("a");l.href=URL.createObjectURL(a),l.download=this.filename,l.click(),URL.revokeObjectURL(l.href)}}};function nee(e,t,a,l,s,i){const c=B("DynamicIcon"),p=B("el-button");return r(),$(p,{onClick:i.exportCSV,size:"small"},{default:d(()=>[n(c,{name:"Download"}),R(" "+f(e.$t("Export")),1)]),_:1},8,["onClick"])}const On=lt(see,[["render",nee]]),oee=["innerHTML"],iee=["innerHTML"],ree=["innerHTML"],dee=["innerHTML"],uee=["innerHTML"],cee=["innerHTML"],Aee=["innerHTML"],pee=["innerHTML"],fee={name:"Revenue",props:{revenueReport:{type:Array,required:!0},appliedGroupKey:{type:String},loading:{type:Boolean,default:!0}},computed:{dateFormat(){if(!this.revenueReport.length)return"";const e=this.revenueReport[0].group.split("-");return e.length===3?"MMMM DD, YYYY":e.length===2?"MMMM YYYY":""},tableData(){const e=this.revenueReport.reduce((t,a)=>{const l=a.year;return t[l]||(t[l]={year:l,order_count:0,net_revenue:0,gross_sale:0,total_refunded_amount:0,tax_total:0,shipping_total:0,items:[]}),t[l].order_count+=Number(a.order_count),t[l].net_revenue+=Number(a.net_revenue),t[l].gross_sale+=Number(a.total_sales),t[l].total_refunded_amount+=Number(a.total_refunds),t[l].tax_total+=Number(a.total_tax),t[l].shipping_total+=Number(a.shipping_total),t[l].items.push(a),t},{});return Object.values(e)}},data(){return{}},methods:{formatDate(e){const t={year:"numeric",month:"long",day:"numeric"};return new Date(e).toLocaleDateString(void 0,t)},formatCurrency(e){return Je.scaled(e)},liabilityClass:is,maybeLiability:xl}},mee=Object.assign(fee,{setup(e){return(t,a)=>{const l=B("el-skeleton"),s=B("el-table-column"),i=B("el-table"),c=B("el-empty");return r(),$(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Revenue Breakdown"),title_size:"small"},ta({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[n(On,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),$(l,{key:0,animated:"",rows:2,class:"p-4"})):(r(),$(i,{key:1,data:t.tableData,"row-key":"year","default-expand-all":!1,class:"w-full"},{empty:d(()=>[n(c,{description:A(u)("No data available")},null,8,["description"])]),default:d(()=>[t.dateFormat?(r(),$(s,{key:0,type:"expand"},{default:d(p=>[n(i,{data:p.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:d(()=>[n(s,{prop:"group",label:A(u)("Date"),"min-width":"160"},{default:d(m=>[R(f(A(at)(m.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"140"},{default:d(m=>[R(f(A(u)(A(ia)(m.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.total_sales))},null,8,oee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(m=>[o("div",{class:de(["inline-flex",A(is)(m.row.total_refunds)]),innerHTML:A(xl)(m.row.total_refunds)},null,10,iee)]),_:1},8,["label"]),t.tax_total>0?(r(),$(s,{key:0,prop:"total_tax",label:A(u)("Taxes"),"min-width":"150"},{default:d(m=>[o("div",{class:de(["inline-flex",A(is)(m.row.total_tax)])},f(A(xl)(m.row.total_tax)),3)]),_:1},8,["label"])):k("",!0),t.shipping_total>0?(r(),$(s,{key:1,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(m=>[o("div",{class:de(["inline-flex",A(is)(m.row.shipping_total)])},f(A(xl)(m.row.shipping_total)),3)]),_:1},8,["label"])):k("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(m=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(m.row.net_revenue))},null,8,ree)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):k("",!0),n(s,{prop:"year",label:A(u)("Year"),"min-width":"50",fixed:""},null,8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"120"},{default:d(p=>[R(f(A(u)(A(ia)(p.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.gross_sale)},null,8,dee)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(p=>[o("div",{class:de(["inline-flex",A(is)(p.row.total_refunded_amount)]),innerHTML:A(xl)(p.row.total_refunded_amount)},null,10,uee)]),_:1},8,["label"]),t.tax_total>0?(r(),$(s,{key:1,prop:"tax_total",label:A(u)("Taxes"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.tax_total)},null,8,cee)]),_:1},8,["label"])):k("",!0),t.shipping_total>0?(r(),$(s,{key:2,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.shipping_total)},null,8,Aee)]),_:1},8,["label"])):k("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.net_revenue)},null,8,pee)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Dn(e){var t;return((t=Yf.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const hee={class:"px-5 pb-4"},_ee={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),$(s,{loading:e.loading,animated:""},{template:d(()=>[o("div",hee,[n(l,{class:"w-full h-7"})]),(r(),h(O,null,ae(8,i=>o("div",{key:i,class:"flex items-center gap-5 px-5"},[n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},vee={class:"fct-btn-group sm w-[240px] gap-2"},gee={class:"capitalize"},yee={class:"capitalize"},bee=["innerHTML"],wee=["innerHTML"],Cee=["innerHTML"],Bee=["innerHTML"],kee=["innerHTML"],xee={__name:"RevenueGroupedBy",props:{tableData:{type:Object},reportFilter:{type:Object},revenueReport:{type:Object}},emits:["fetch-data-by-group"],setup(e,{emit:t}){const a=e,l=t;K(()=>a.reportFilter.currentCurrencySign);const s=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];V({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const i=V("billing_country"),c=()=>{l("fetch-data-by-group",i.value)};return(p,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-table-column"),v=B("el-table");return r(),$(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:p.$t("Grouped by"),title_size:"small"},{action:d(()=>[o("div",vee,[n(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=C=>i.value=C),onChange:c,placeholder:p.$t("Select Group")},{default:d(()=>[(r(),h(O,null,ae(s,C=>n(_,{key:C.value,label:p.$t(C.label),value:C.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(On,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(_ee,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?k("",!0):(r(),$(v,{key:0,data:e.tableData,"max-height":"390"},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:p.$t("Currently there is no data!")},null,8,["text"])]),default:d(()=>[i.value==="country"?(r(),$(y,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(C=>[R(f(C.row.country),1)]),_:1},8,["label"])):k("",!0),i.value==="shipping_country"?(r(),$(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(C=>[o("span",gee,f(A(Dn)(C.row.shipping_country)),1)]),_:1},8,["label"])):k("",!0),i.value==="billing_country"?(r(),$(y,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(C=>[o("span",yee,f(A(Dn)(C.row.billing_country)),1)]),_:1},8,["label"])):k("",!0),i.value==="payment_method"?(r(),$(y,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:d(C=>[R(f(C.row.payment_method),1)]),_:1},8,["label"])):k("",!0),n(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:d(C=>[R(f(A(u)(C.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.gross_sale)},null,8,bee)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:d(C=>[o("div",{class:de(["inline-flex",A(is)(C.row.total_refunds)]),innerHTML:A(xl)(C.row.total_refunds)},null,10,wee)]),_:1},8,["label"]),p.total_tax>0?(r(),$(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:d(C=>[o("div",{class:de(["inline-flex",A(is)(C.row.total_tax)]),innerHTML:A(xl)(C.row.total_tax)},null,10,Cee)]),_:1},8,["label"])):k("",!0),p.shipping_total>0?(r(),$(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:d(C=>[o("div",{class:de(["inline-flex",A(is)(C.row.shipping_total)]),innerHTML:A(xl)(C.row.shipping_total)},null,10,Bee)]),_:1},8,["label"])):k("",!0),n(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.net_sale)},null,8,kee)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class See extends sl{constructor(){super(...arguments);Oe(this,"data",{revenueReport:[],previousMetrics:[],netRevenueByGroup:[],summary:{},previousSummary:{},fluctuations:{},isBusy:{revenueReport:!0,netRevenueByGroup:!1,revenueSummary:!1,fluctuations:!1,chartData:!1,productBarRacer:!1},chartData:[],productBarRacer:[],appliedGroupKey:"default"})}get controllerKey(){return"RevenueReportController"}makeRequest(a,l,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!1)})}getReportData(a={}){return this.makeRequest("revenue",a,null,"revenueReport")}getReportByGroup(a={}){return this.makeRequest("revenue-by-group",a,"data","netRevenueByGroup")}getChartData(a={}){return this.makeRequest("revenue-chart",a,"revenueReport","chartData")}getProductBarRacer(a={}){return this.makeRequest("fetch-product-bar-racer",a,"productBarRacer","productBarRacer")}}const Qa=See.init(),Ll={__name:"SummaryLoader",props:{loading:{type:Boolean,default:!1},count:{type:Number,default:1},marginBottom:{type:Number,default:7.5},padding:{type:Number,default:4},rows:{type:Number,default:1}},setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton");return r(),$(s,{loading:"loading",animated:""},{template:d(()=>[o("div",{class:de(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:na(`--loader-grid-cols: ${e.count};`)},[(r(!0),h(O,null,ae(e.rows,i=>(r(),h(O,{key:i},[(r(!0),h(O,null,ae(e.count,c=>(r(),h("div",{key:c},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},Fee={class:"summary-item-inner"},$ee={class:"value"},Eee={class:"inner-value"},Uee={class:"title"},Iee={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:u("Gross Sales"),key:"gross_sale",info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Taxes"),key:"tax_total",liability:!0,info:u("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Shipping"),key:"shipping_total",liability:!0,info:u("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",info:u("Gross sales less refunds, taxes, shipping, fees.")}],a=K(()=>t.map(s=>({key:s.key,title:s.title,value:Qa.data.summary[s.key]||0,fluctuation:Qa.data.fluctuations[s.key]||0,liability:s.liability||!1,info:s.info})).filter(s=>["tax_total","shipping_total"].includes(s.key)?s.value!==0:!0)),l=K(()=>Qa.data.isBusy.revenueReport);return(s,i)=>{const c=B("el-tooltip");return l.value?(r(),$(Ll,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:na(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(O,null,ae(a.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Fee,[o("div",$ee,[o("div",Eee,[n(Is,{amount:A(xl)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),n(ml,{fluctuation:p.fluctuation,amount:A(Qa).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",Uee,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Qee={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.currentMetrics.forEach((t,a)=>{const l=parseFloat(t.net_revenue);let s={group:this.formatDate(t.group),net_revenue:l};if(this.hasComparison){const i=this.previousMetrics[a];if(i){const c=parseFloat(i.net_revenue),p=c?((l-c)/c*100).toFixed(2):"n/a";s.previous_revenue=c,s.percent_change=p,s.group=`${this.formatDate(t.group)} vs ${this.formatDate(i.group)}`}}e.push(s)}),e}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Ha[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ha[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return Je.scaled(e)}}},Dee={class:"fct-revenue-comparison"},Vee=["innerHTML"],Tee=["innerHTML"];function Mee(e,t,a,l,s,i){const c=B("CardHeader"),p=B("el-skeleton"),m=B("el-table-column"),_=B("el-table"),g=B("CardBody"),y=B("CardContainer");return r(),h("div",Dee,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),$(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),$(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(m,{label:i.translate("Period")},{default:d(v=>[R(f(v.row.group),1)]),_:1},8,["label"]),n(m,{label:i.translate("Current Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,Vee)]),_:1},8,["label"]),a.hasComparison?(r(),h(O,{key:0},[n(m,{label:i.translate("Compare Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,Tee)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Lee=lt(Qee,[["render",Mee]]),Ree={class:"fct-revenue-report-page"},Oee={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V("default"),l=t.reportFilter,s=l.applicableFilters,i=(g,y="default")=>{Qa.getReportData({params:{...g.params,groupKey:y}})},c=g=>{Qa.getReportData({params:{...s.params,groupKey:g}})},p=g=>{g!==Qa.data.appliedGroupKey&&(a.value=g,i(s,a.value))},m=g=>{Qa.getReportByGroup({params:{...s.params,groupKey:g}})},_=g=>{i(g,a.value),Qa.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Qe(()=>{l.addListener("revenue-report",_),_(s)}),Ct(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",Ree,[n(Iee,{reportFilter:A(l)},null,8,["reportFilter"]),n(lee,{chartData:A(Qa).data.revenueReport,compareData:A(Qa).data.previousMetrics,reportFilter:A(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!A(Qa).data.summary.gross_sale,loading:A(Qa).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Lee,{class:"my-7.5",currentMetrics:A(Qa).data.revenueReport,previousMetrics:A(Qa).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:A(Qa).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(mee,{revenueReport:A(Qa).data.revenueReport,appliedGroupKey:a.value,onFetchData:c,loading:A(Qa).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(xee,{tableData:A(Qa).data.netRevenueByGroup,reportFilter:A(l),revenueReport:A(Qa),onFetchDataByGroup:m},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class Hee extends sl{constructor(){super(...arguments);Oe(this,"data",{summary:{},previousSummary:{},fluctuations:{},orderChartData:[],newVsReturning:[],orderByGroup:[],itemCountDistribution:[],grossSaleByDay:[],averageOrderGross:[],grossSaleByHour:[],orderCompletionTime:[],averageOrderItems:[],orderValueDistribution:[],orderByDayAndHour:[],dashBoardStats:[],isBusy:{summary:!1,fluctuations:!1,orderChartData:!0,newVsReturning:!0,orderByGroup:!1,itemCountDistribution:!1,grossSaleByDay:!1,averageOrderGross:!1,grossSaleByHour:!1,orderCompletionTime:!1,averageOrderItems:!1,orderValueDistribution:!1,orderByDayAndHour:!1,dashBoardStats:!1}})}get controllerKey(){return"OrderReportController"}makeRequest(a,l,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getOrderChartData(a={}){return this.data.isBusy.orderChartData=!0,this.makeRequest("order-chart",a).then(()=>this.data.isBusy.orderChartData=!1)}getNewVsReturningCustomer(a={}){return this.data.isBusy.newVsReturning=!0,this.makeRequest("fetch-new-vs-returning-customer",a).then(()=>this.data.isBusy.newVsReturning=!1)}getOrderByGroup(a={}){return this.makeRequest("fetch-order-by-group",a,"data","orderByGroup")}getItemCountDistribution(a={}){return this.makeRequest("item-count-distribution",a,"data","itemCountDistribution")}getOrderCompletionTime(a={}){return this.makeRequest("order-completion-time",a,"data","orderCompletionTime")}getOrderValueDistribution(a={}){return this.makeRequest("order-value-distribution",a,"data","orderValueDistribution")}getReportByDayAndHour(a={}){return this.data.isBusy.orderByDayAndHour=!0,this.makeRequest("fetch-report-by-day-and-hour",a).then(()=>this.data.isBusy.orderByDayAndHour=!1)}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}}const Qt=Hee.init(),Pee={key:1,class:"fct-report-order-summary summary-col-4"},Nee={class:"summary-item-inner"},Kee={class:"value"},Gee={key:0,class:"summary-checkbox"},jee={class:"inner-value"},zee={class:"title"},qee={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:u("Gross Sales"),key:"gross_sale",content:u("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:u("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",hasCurrency:!0,content:u("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:u("Orders"),key:"order_count",content:u("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:u("Items"),key:"total_item_count",content:u("The total number of items sold in this period."),hideCurrency:!0},{title:u("Average Gross"),key:"average_gross",hasCurrency:!0,content:u("Average gross sales per order in this period.")},{title:u("Average Revenue"),key:"average_net",hasCurrency:!0,content:u("Average revenue per order in this period.")},{title:u("Average Order Items"),key:"average_order_items_count",content:u("Average number of items per order in this period."),hideCurrency:!0}],l=K(()=>a.map(m=>({...m,value:t.orderReport.data.summary[m.key]||0,fluctuation:t.orderReport.data.fluctuations[m.key]||0,liability:m.liability||!1,hasCurrency:m.hasCurrency||!1}))),s=K(()=>a.filter(m=>!m.hideCurrency).map(m=>m.key)),i=K(()=>t.orderReport.data.isBusy.orderChartData),c=m=>{Ml.onCheckBoxChange("order",m)},p=m=>s.value.includes(m.key)?xl(m.value,m.liability):ia(m.value);return(m,_)=>{const g=B("el-checkbox"),y=B("el-tooltip");return i.value?(r(),$(Ll,{key:0,count:4,rows:2})):(r(),h("div",Pee,[(r(!0),h(O,null,ae(l.value,(v,C)=>(r(),h("div",{class:"summary-item",key:C},[o("div",Nee,[o("div",Kee,[v.checkable?(r(),h("div",Gee,[n(g,{"true-value":!0,"false-value":!1,"model-value":A(Ml).data.order.includes(v.key),onChange:()=>c(v.key)},null,8,["model-value","onChange"])])):k("",!0),o("div",jee,[n(Is,{amount:p(v),title:v.title},null,8,["amount","title"])]),n(ml,{fluctuation:v.fluctuation,amount:e.orderReport.data.previousSummary[v.key],"is-liability":v.liability,"has-currency":v.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",zee,[R(f(v.title)+" ",1),n(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Yee={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let l=null;const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=Te.colors,c=V(Te.isDark()),p=K(()=>{const b=[];return t.chartData.forEach((w,x)=>{s.forEach((F,L)=>{b.push([x,L,w[F]])})}),b}),m=K(()=>t.chartData.length?Math.max(...t.chartData.flatMap(b=>s.map(w=>b[w]||0))):0),_=K(()=>c.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=K(()=>Object.values(t.chartData).every(b=>b.order_count===0)),y=K(()=>Qt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),Se(()=>{if(a.value){l=Jt(a.value,null,{renderer:"svg"});const b=t.chartData.map(F=>F.hour),w=s,x={tooltip:{position:"top",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},formatter:F=>{const L=c.value?"#ffffff":"#000000";let U=`<div style="color: ${L};"><div>${s[F.data[1]]}, ${F.name||"-"}</div>`;return U+=`<div style="color: ${L};"> | |
| 183 | - ${F.marker} | |
| 184 | - <span style="color: ${L};">${F.seriesName}</span> | |
| 185 | - <span style="float: right; margin-left: 20px; color: ${L};"> | |
| 186 | - ${F.data[2]} | |
| 180 | + </div>`,ne&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:D.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,formatter:M=>`${ft.scaled(M)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};b.setOption(I,{notMerge:!0,replaceMerge:["series"]})},B=()=>{i.value=!i.value,i.value?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=V=>{ba.onChange("revenue","revenue_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Nl.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||S()}),be(()=>a.loading,V=>{V||S()});const Q=()=>{p.value=Te.isDark(),xe(()=>{F()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),xe(()=>{S()})}),(V,I)=>{const M=C("el-tooltip"),O=C("el-option"),L=C("el-select"),H=C("el-skeleton");return r(),h("div",Pte,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Hte,[o("h5",Nte,m(A(u)("Revenue Chart")),1),n(M,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Kte,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(!0),h(P,null,te(A(g),j=>(r(),E(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Gte,[n(Gl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:B,class:de(i.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?x("",!0):(r(),h("div",zte,[o("div",jte,[o("div",qte,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Yte,m(A(u)("Data")),1)]),o("div",Wte,[o("span",Jte,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Zte={components:{DynamicIcon:Y},props:{data:{type:Array,required:!0},filename:{type:String,default:"data.csv"}},methods:{exportCSV(){const t=(s=>{const i=_=>_.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase()),c=Object.keys(s[0]),f=[c.map(i).join(",")];return s.forEach(_=>{const g=c.map(y=>{let v=_[y];return typeof v=="object"&&(v=JSON.stringify(v)),typeof v=="string"&&(v=`"${v.replace(/"/g,'""')}"`),v});f.push(g.join(","))}),f.join(` | |
| 181 | +`)})(this.data),a=new Blob([t],{type:"text/csv"}),l=document.createElement("a");l.href=URL.createObjectURL(a),l.download=this.filename,l.click(),URL.revokeObjectURL(l.href)}}};function eae(e,t,a,l,s,i){const c=C("DynamicIcon"),p=C("el-button");return r(),E(p,{onClick:i.exportCSV,size:"small"},{default:d(()=>[n(c,{name:"Download"}),R(" "+m(e.$t("Export")),1)]),_:1},8,["onClick"])}const jn=nt(Zte,[["render",eae]]),tae=["innerHTML"],aae=["innerHTML"],lae=["innerHTML"],sae=["innerHTML"],nae=["innerHTML"],oae=["innerHTML"],iae=["innerHTML"],rae=["innerHTML"],dae={name:"Revenue",props:{revenueReport:{type:Array,required:!0},appliedGroupKey:{type:String},loading:{type:Boolean,default:!0}},computed:{dateFormat(){if(!this.revenueReport.length)return"";const e=this.revenueReport[0].group.split("-");return e.length===3?Ll("date"):e.length===2?Ll("month_year"):""},tableData(){const e=this.revenueReport.reduce((t,a)=>{const l=a.year;return t[l]||(t[l]={year:l,order_count:0,net_revenue:0,gross_sale:0,total_refunded_amount:0,tax_total:0,shipping_total:0,items:[]}),t[l].order_count+=Number(a.order_count),t[l].net_revenue+=Number(a.net_revenue),t[l].gross_sale+=Number(a.total_sales),t[l].total_refunded_amount+=Number(a.total_refunds),t[l].tax_total+=Number(a.total_tax),t[l].shipping_total+=Number(a.shipping_total),t[l].items.push(a),t},{});return Object.values(e)}},data(){return{}},methods:{formatDate(e){return lt(e).locale(Zl()).format(Ll("date"))},formatCurrency(e){return ft.scaled(e)},liabilityClass:fs,maybeLiability:Ul}},uae=Object.assign(dae,{setup(e){return(t,a)=>{const l=C("el-skeleton"),s=C("el-table-column"),i=C("el-table"),c=C("el-empty");return r(),E(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Revenue Breakdown"),title_size:"small"},oa({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[n(jn,{data:e.revenueReport,filename:"revenue.csv"},null,8,["data"])]),key:"0"}]),1032,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),E(l,{key:0,animated:"",rows:2,class:"p-4"})):(r(),E(i,{key:1,data:t.tableData,"row-key":"year","default-expand-all":!1,class:"w-full"},{empty:d(()=>[n(c,{description:A(u)("No data available")},null,8,["description"])]),default:d(()=>[t.dateFormat?(r(),E(s,{key:0,type:"expand"},{default:d(p=>[n(i,{data:p.row.items,"row-key":"month",size:"small",border:"",class:"w-full"},{default:d(()=>[n(s,{prop:"group",label:A(u)("Date"),"min-width":"160"},{default:d(f=>[R(m(A(lt)(f.row.group).format(t.dateFormat)),1)]),_:1},8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"140"},{default:d(f=>[R(m(A(u)(A(ua)(f.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"total_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(f=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.total_sales))},null,8,tae)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(fs)(f.row.total_refunds)]),innerHTML:A(Ul)(f.row.total_refunds)},null,10,aae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:0,prop:"total_tax",label:A(u)("Taxes"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(fs)(f.row.total_tax)])},m(A(Ul)(f.row.total_tax)),3)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),E(s,{key:1,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(f=>[o("div",{class:de(["inline-flex",A(fs)(f.row.shipping_total)])},m(A(Ul)(f.row.shipping_total)),3)]),_:1},8,["label"])):x("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(f=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(Number(f.row.net_revenue))},null,8,lae)]),_:1},8,["label"])]),_:2},1032,["data"])]),_:1})):x("",!0),n(s,{prop:"year",label:A(u)("Year"),"min-width":"50",fixed:""},null,8,["label"]),n(s,{prop:"order_count",label:A(u)("Order Count"),"min-width":"120"},{default:d(p=>[R(m(A(u)(A(ua)(p.row.order_count))),1)]),_:1},8,["label"]),n(s,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.gross_sale)},null,8,sae)]),_:1},8,["label"]),n(s,{label:A(u)("Refunds"),"min-width":"150"},{default:d(p=>[o("div",{class:de(["inline-flex",A(fs)(p.row.total_refunded_amount)]),innerHTML:A(Ul)(p.row.total_refunded_amount)},null,10,nae)]),_:1},8,["label"]),t.tax_total>0?(r(),E(s,{key:1,prop:"tax_total",label:A(u)("Taxes"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.tax_total)},null,8,oae)]),_:1},8,["label"])):x("",!0),t.shipping_total>0?(r(),E(s,{key:2,prop:"shipping_total",label:A(u)("Shipping"),"min-width":"150"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.shipping_total)},null,8,iae)]),_:1},8,["label"])):x("",!0),n(s,{prop:"net_revenue",label:A(u)("Revenue"),"min-width":"180"},{default:d(p=>[o("div",{class:"inline-flex",innerHTML:t.formatCurrency(p.row.net_revenue)},null,8,rae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}});function Qs(e){var t;return((t=Bm.find(a=>a.code2===e))==null?void 0:t.name)||"Uncategorized"}const cae={class:"px-5 pb-4"},Aae={__name:"ReportTableLoader",props:{loading:{type:Boolean,default:!1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),E(s,{loading:e.loading,animated:""},{template:d(()=>[o("div",cae,[n(l,{class:"w-full h-7"})]),(r(),h(P,null,te(8,i=>o("div",{key:i,class:"flex items-center gap-5 px-5"},[n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"}),n(l,{class:"w-1/2 h-4 mb-3"})])),64))]),_:1},8,["loading"])}}},pae={class:"fct-btn-group sm w-[240px] gap-2"},fae={class:"capitalize"},mae={class:"capitalize"},hae=["innerHTML"],_ae=["innerHTML"],vae=["innerHTML"],gae=["innerHTML"],yae=["innerHTML"],bae={__name:"RevenueGroupedBy",props:{tableData:{type:Object},reportFilter:{type:Object},revenueReport:{type:Object}},emits:["fetch-data-by-group"],setup(e,{emit:t}){const a=e,l=t;K(()=>a.reportFilter.currentCurrencySign);const s=[{label:"Billing Country",value:"billing_country"},{label:"Shipping Country",value:"shipping_country"},{label:"Payment Method",value:"payment_method"}];T({offline_payment:"Cash On Delivery",paypal:"PayPal",stripe:"Stripe"});const i=T("billing_country"),c=()=>{l("fetch-data-by-group",i.value)};return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:p.$t("Grouped by"),title_size:"small"},{action:d(()=>[o("div",pae,[n(g,{class:"el-select--x-small",modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=w=>i.value=w),onChange:c,placeholder:p.$t("Select Group")},{default:d(()=>[(r(),h(P,null,te(s,w=>n(_,{key:w.value,label:p.$t(w.label),value:w.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(jn,{data:e.tableData,filename:"revenue grouped by.csv",class:"!ml-0"},null,8,["data"])])]),_:1},8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(Aae,{loading:e.revenueReport.data.isBusy.netRevenueByGroup},null,8,["loading"]),e.revenueReport.data.isBusy.netRevenueByGroup?x("",!0):(r(),E(v,{key:0,data:e.tableData,"max-height":"390"},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:p.$t("Currently there is no data!")},null,8,["text"])]),default:d(()=>[i.value==="country"?(r(),E(y,{key:0,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(w=>[R(m(w.row.country),1)]),_:1},8,["label"])):x("",!0),i.value==="shipping_country"?(r(),E(y,{key:1,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(w=>[o("span",fae,m(A(Qs)(w.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),i.value==="billing_country"?(r(),E(y,{key:2,prop:"country",label:p.$t("Country"),"min-width":"150"},{default:d(w=>[o("span",mae,m(A(Qs)(w.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),i.value==="payment_method"?(r(),E(y,{key:3,prop:"payment_method",label:p.$t("Payment Method"),"min-width":"150"},{default:d(w=>[R(m(w.row.payment_method),1)]),_:1},8,["label"])):x("",!0),n(y,{prop:"order_count",label:p.$t("Order Count"),"min-width":"150"},{default:d(w=>[R(m(A(u)(w.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"total_sales",label:p.$t("Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.gross_sale)},null,8,hae)]),_:1},8,["label"]),n(y,{prop:"total_refunds",label:p.$t("Refunds"),"min-width":"150"},{default:d(w=>[o("div",{class:de(["inline-flex",A(fs)(w.row.total_refunds)]),innerHTML:A(Ul)(w.row.total_refunds)},null,10,_ae)]),_:1},8,["label"]),p.total_tax>0?(r(),E(y,{key:4,prop:"total_tax",label:p.$t("Taxes"),"min-width":"150"},{default:d(w=>[o("div",{class:de(["inline-flex",A(fs)(w.row.total_tax)]),innerHTML:A(Ul)(w.row.total_tax)},null,10,vae)]),_:1},8,["label"])):x("",!0),p.shipping_total>0?(r(),E(y,{key:5,prop:"shipping_total",label:p.$t("Shipping"),"min-width":"150"},{default:d(w=>[o("div",{class:de(["inline-flex",A(fs)(w.row.shipping_total)]),innerHTML:A(Ul)(w.row.shipping_total)},null,10,gae)]),_:1},8,["label"])):x("",!0),n(y,{prop:"net_revenue",label:p.$t("Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.net_sale)},null,8,yae)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}};class wae extends tl{constructor(){super(...arguments);Pe(this,"data",{revenueReport:[],previousMetrics:[],netRevenueByGroup:[],summary:{},previousSummary:{},fluctuations:{},isBusy:{revenueReport:!0,netRevenueByGroup:!1,revenueSummary:!1,fluctuations:!1,chartData:!1,productBarRacer:!1},chartData:[],productBarRacer:[],appliedGroupKey:"default"})}get controllerKey(){return"RevenueReportController"}makeRequest(a,l,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!1)})}getReportData(a={}){return this.makeRequest("revenue",a,null,"revenueReport")}getReportByGroup(a={}){return this.makeRequest("revenue-by-group",a,"data","netRevenueByGroup")}getChartData(a={}){return this.makeRequest("revenue-chart",a,"revenueReport","chartData")}getProductBarRacer(a={}){return this.makeRequest("fetch-product-bar-racer",a,"productBarRacer","productBarRacer")}}const Qa=wae.init(),Kl={__name:"SummaryLoader",props:{loading:{type:Boolean,default:!1},count:{type:Number,default:1},marginBottom:{type:Number,default:7.5},padding:{type:Number,default:4},rows:{type:Number,default:1}},setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton");return r(),E(s,{loading:"loading",animated:""},{template:d(()=>[o("div",{class:de(["grid gap-5 bg-white rounded dark:bg-dark-700 fct-summary-loader",`mb-${e.marginBottom} p-${e.padding}`]),style:ra(`--loader-grid-cols: ${e.count};`)},[(r(!0),h(P,null,te(e.rows,i=>(r(),h(P,{key:i},[(r(!0),h(P,null,te(e.count,c=>(r(),h("div",{key:c},[n(l),n(l,{class:"w-[90%]"})]))),128))],64))),128))],6)]),_:1})}}},Cae={class:"summary-item-inner"},kae={class:"value"},Bae={class:"inner-value"},xae={class:"title"},Sae={__name:"RevenueReportSummary",props:{reportFilter:{type:Object}},setup(e){const t=[{title:u("Gross Sales"),key:"gross_sale",info:u("The total sales you had in this period.")},{title:u("Refunds"),key:"total_refunded_amount",liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Taxes"),key:"tax_total",liability:!0,info:u("Taxes paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Shipping"),key:"shipping_total",liability:!0,info:u("Shipping paid in orders. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",info:u("Gross sales less refunds, taxes, shipping, fees.")}],a=K(()=>t.map(s=>({key:s.key,title:s.title,value:Qa.data.summary[s.key]||0,fluctuation:Qa.data.fluctuations[s.key]||0,liability:s.liability||!1,info:s.info})).filter(s=>["tax_total","shipping_total"].includes(s.key)?s.value!==0:!0)),l=K(()=>Qa.data.isBusy.revenueReport);return(s,i)=>{const c=C("el-tooltip");return l.value?(r(),E(Kl,{key:0,loading:l.value,count:a.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:"fct-report-order-summary",style:ra(`--avg-grid-cols: ${a.value.length}`)},[(r(!0),h(P,null,te(a.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",Cae,[o("div",kae,[o("div",Bae,[n(Rs,{amount:A(Ul)(p.value,p.liability),title:p.title},null,8,["amount","title"])]),n(vl,{fluctuation:p.fluctuation,amount:A(Qa).data.previousSummary[p.key],"is-liability":p.liability},null,8,["fluctuation","amount","is-liability"])]),o("div",xae,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],4))}}},Fae={name:"Comparison",components:{CardContainer:Se,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.currentMetrics.forEach((t,a)=>{const l=parseFloat(t.net_revenue);let s={group:this.formatDate(t.group),net_revenue:l};if(this.hasComparison){const i=this.previousMetrics[a];if(i){const c=parseFloat(i.net_revenue),p=c?((l-c)/c*100).toFixed(2):"n/a";s.previous_revenue=c,s.percent_change=p,s.group=`${this.formatDate(t.group)} vs ${this.formatDate(i.group)}`}}e.push(s)}),e}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Oa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Oa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}},formatCurrency(e){return ft.scaled(e)}}},$ae={class:"fct-revenue-comparison"},Eae=["innerHTML"],Uae=["innerHTML"];function Iae(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",$ae,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Revenue Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(f,{label:i.translate("Period")},{default:d(v=>[R(m(v.row.group),1)]),_:1},8,["label"]),n(f,{label:i.translate("Current Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.net_revenue)},null,8,Eae)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(f,{label:i.translate("Compare Revenue")},{default:d(v=>[o("div",{class:"inline-flex",innerHTML:i.formatCurrency(v.row.previous_revenue)},null,8,Uae)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Qae=nt(Fae,[["render",Iae]]),Dae={class:"fct-revenue-report-page"},Vae={__name:"RevenueReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T("default"),l=t.reportFilter,s=l.applicableFilters,i=(g,y="default")=>{Qa.getReportData({params:{...g.params,groupKey:y}})},c=g=>{Qa.getReportData({params:{...s.params,groupKey:g}})},p=g=>{g!==Qa.data.appliedGroupKey&&(a.value=g,i(s,a.value))},f=g=>{Qa.getReportByGroup({params:{...s.params,groupKey:g}})},_=g=>{i(g,a.value),Qa.getReportByGroup({params:{...g.params,groupKey:"billing_country"}})};return Ie(()=>{l.addListener("revenue-report",_),_(s)}),Bt(()=>{l.removeListener("revenue-report")}),(g,y)=>(r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",Dae,[n(Sae,{reportFilter:A(l)},null,8,["reportFilter"]),n(Xte,{chartData:A(Qa).data.revenueReport,compareData:A(Qa).data.previousMetrics,reportFilter:A(l),appliedGroupKey:a.value,onFilterData:p,"is-empty":!A(Qa).data.summary.gross_sale,loading:A(Qa).data.isBusy.revenueReport},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Qae,{class:"my-7.5",currentMetrics:A(Qa).data.revenueReport,previousMetrics:A(Qa).data.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:A(Qa).data.isBusy.revenueReport},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(uae,{revenueReport:A(Qa).data.revenueReport,appliedGroupKey:a.value,onFetchData:c,loading:A(Qa).data.isBusy.revenueReport},null,8,["revenueReport","appliedGroupKey","loading"]),n(bae,{tableData:A(Qa).data.netRevenueByGroup,reportFilter:A(l),revenueReport:A(Qa),onFetchDataByGroup:f},null,8,["tableData","reportFilter","revenueReport"])])]),_:1}))}};class Tae extends tl{constructor(){super(...arguments);Pe(this,"data",{summary:{},previousSummary:{},fluctuations:{},orderChartData:[],newVsReturning:[],orderByGroup:[],itemCountDistribution:[],grossSaleByDay:[],averageOrderGross:[],grossSaleByHour:[],orderCompletionTime:[],averageOrderItems:[],orderValueDistribution:[],orderByDayAndHour:[],dashBoardStats:[],isBusy:{summary:!1,fluctuations:!1,orderChartData:!0,newVsReturning:!0,orderByGroup:!1,itemCountDistribution:!1,grossSaleByDay:!1,averageOrderGross:!1,grossSaleByHour:!1,orderCompletionTime:!1,averageOrderItems:!1,orderValueDistribution:!1,orderByDayAndHour:!1,dashBoardStats:!1}})}get controllerKey(){return"OrderReportController"}makeRequest(a,l,s,i){this.data.isBusy[i]=!0,typeof l!="object"&&(l={});const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getOrderChartData(a={}){return this.data.isBusy.orderChartData=!0,this.makeRequest("order-chart",a).then(()=>this.data.isBusy.orderChartData=!1)}getNewVsReturningCustomer(a={}){return this.data.isBusy.newVsReturning=!0,this.makeRequest("fetch-new-vs-returning-customer",a).then(()=>this.data.isBusy.newVsReturning=!1)}getOrderByGroup(a={}){return this.makeRequest("fetch-order-by-group",a,"data","orderByGroup")}getItemCountDistribution(a={}){return this.makeRequest("item-count-distribution",a,"data","itemCountDistribution")}getOrderCompletionTime(a={}){return this.makeRequest("order-completion-time",a,"data","orderCompletionTime")}getOrderValueDistribution(a={}){return this.makeRequest("order-value-distribution",a,"data","orderValueDistribution")}getReportByDayAndHour(a={}){return this.data.isBusy.orderByDayAndHour=!0,this.makeRequest("fetch-report-by-day-and-hour",a).then(()=>this.data.isBusy.orderByDayAndHour=!1)}getDashboardStats(a={}){return this.makeRequest("dashboard-stats",a,"dashBoardStats","dashBoardStats")}}const Mt=Tae.init(),Mae={key:1,class:"fct-report-order-summary summary-col-4"},Lae={class:"summary-item-inner"},Rae={class:"value"},Oae={key:0,class:"summary-checkbox"},Pae={class:"inner-value"},Hae={class:"title"},Nae={__name:"Summary",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=[{title:u("Gross Sales"),key:"gross_sale",content:u("The total sales you had in this period."),checkable:!0,hasCurrency:!0},{title:u("Refunds"),key:"total_refund",liability:!0,hasCurrency:!0,content:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:u("Revenue"),key:"net_revenue",hasCurrency:!0,content:u("Gross sales less refunds, taxes, shipping, fees."),checkable:!0},{title:u("Orders"),key:"order_count",content:u("The total number of orders placed in this period."),checkable:!0,hideCurrency:!0},{title:u("Items"),key:"total_item_count",content:u("The total number of items sold in this period."),hideCurrency:!0},{title:u("Average Gross"),key:"average_gross",hasCurrency:!0,content:u("Average gross sales per order in this period.")},{title:u("Average Revenue"),key:"average_net",hasCurrency:!0,content:u("Average revenue per order in this period.")},{title:u("Average Order Items"),key:"average_order_items_count",content:u("Average number of items per order in this period."),hideCurrency:!0}],l=K(()=>a.map(f=>({...f,value:t.orderReport.data.summary[f.key]||0,fluctuation:t.orderReport.data.fluctuations[f.key]||0,liability:f.liability||!1,hasCurrency:f.hasCurrency||!1}))),s=K(()=>a.filter(f=>!f.hideCurrency).map(f=>f.key)),i=K(()=>t.orderReport.data.isBusy.orderChartData),c=f=>{Nl.onCheckBoxChange("order",f)},p=f=>s.value.includes(f.key)?Ul(f.value,f.liability):ua(f.value);return(f,_)=>{const g=C("el-checkbox"),y=C("el-tooltip");return i.value?(r(),E(Kl,{key:0,count:4,rows:2})):(r(),h("div",Mae,[(r(!0),h(P,null,te(l.value,(v,w)=>(r(),h("div",{class:"summary-item",key:w},[o("div",Lae,[o("div",Rae,[v.checkable?(r(),h("div",Oae,[n(g,{"true-value":!0,"false-value":!1,"model-value":A(Nl).data.order.includes(v.key),onChange:()=>c(v.key)},null,8,["model-value","onChange"])])):x("",!0),o("div",Pae,[n(Rs,{amount:p(v),title:v.title},null,8,["amount","title"])]),n(vl,{fluctuation:v.fluctuation,amount:e.orderReport.data.previousSummary[v.key],"is-liability":v.liability,"has-currency":v.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",Hae,[R(m(v.title)+" ",1),n(y,{content:v.content,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Kae={__name:"OrderHeatMap",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;const s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i=Te.colors,c=T(Te.isDark()),p=K(()=>{const k=[];return t.chartData.forEach((b,S)=>{s.forEach(($,D)=>{k.push([S,D,b[$]])})}),k}),f=K(()=>t.chartData.length?Math.max(...t.chartData.flatMap(k=>s.map(b=>k[b]||0))):0),_=K(()=>c.value?["#000000",i.blue[500]]:["#ffffff",i.blue[600]]),g=K(()=>Object.values(t.chartData).every(k=>k.order_count===0)),y=K(()=>Mt.data.isBusy.orderByDayAndHour),v=()=>{l&&(l.dispose(),l=null),xe(()=>{if(a.value){l=na(a.value,null,{renderer:"svg"});const k=t.chartData.map($=>$.hour),b=s,S={tooltip:{position:"top",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},formatter:$=>{const D=c.value?"#ffffff":"#000000";let F=`<div style="color: ${D};"><div>${s[$.data[1]]}, ${$.name||"-"}</div>`;return F+=`<div style="color: ${D};"> | |
| 182 | + ${$.marker} | |
| 183 | + <span style="color: ${D};">${$.seriesName}</span> | |
| 184 | + <span style="float: right; margin-left: 20px; color: ${D};"> | |
| 185 | + ${$.data[2]} | |
| 187 | 186 | </span> |
| 188 | - </div>`,U+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:b,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:w,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:m.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name:u("Orders"),type:"heatmap",data:p.value,label:{show:!0},itemStyle:{borderColor:"#e0e0e0",borderWidth:1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};l.setOption(x)}})};Ce([p,m],()=>{Se(()=>{v()})}),Ce(g,b=>{b||v()}),Ce(y,b=>{b||v()});const C=()=>{c.value=Te.isDark(),Se(()=>{v()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",C),Se(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),vl(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",C,!1),l.dispose(),l=null)}),(b,w)=>{const x=B("el-skeleton");return r(),$(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[y.value?(r(),$(x,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(O,{key:1},[g.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},Wee={class:"fct-gross-sale-vs-net-revenue-wrap"},Xee={class:"flex items-center gap-2"},Jee={class:"fct-card-header-title is-small"},Zee={class:"fct-chart-select"},ete={class:"fct-btn-group sm"},tte={key:2,class:"chart-action-wrap"},ate={class:"chart-change-wrap"},lte={class:"chart-change"},ste={class:"text"},nte={class:"chart-change"},ote={class:"text"},ite={__name:"OrderLineChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V("default"),i=V(va.getChartType("order","order_chart")||"line"),c=V(!1),p=Te.colors.report,m=V(Te.isDark()),_=[{value:"default",label:u("Default")},{value:"monthly",label:u("Monthly")},{value:"yearly",label:u("Yearly")}],g=t,y=()=>{g("fetch-chart-data",s.value)},v=K(()=>Qt.data.isBusy.orderChartData),C=K(()=>[{title:u("Orders"),key:"order_count",color:m.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:u("Gross Sales"),key:"gross_sale",color:m.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:u("Revenue"),key:"net_revenue",color:m.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:E})=>Ml.data.order.includes(E)).map(({title:E,key:D,color:H,yAxisIndex:P,type:G})=>M(E,G,P,a.chartData.map(J=>J[D]),H))),b=K(()=>a.chartData.map(E=>Us(E.group)));let w=null;const x=V(!0),F=()=>{w&&(w.dispose(),w=null),Se(()=>{l.value&&(w=Jt(l.value),S(),w.on("legendselectchanged",E=>{x.value=E.selected.Orders}))})},L=K(()=>{const E=Es(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+E}),U=K(()=>dl(a.chartData.length)),S=()=>{if(!w)return;const E={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}},formatter:D=>{let H=D[0].axisValue;const P=m.value?"#ffffff":"#565865";return D.forEach(function(G,J){const oe=J===0?G.value:Je.scaled(G.value);H+=`<div> | |
| 189 | - ${G.marker} | |
| 190 | - <span style="color: ${P};">${G.seriesName}</span> | |
| 191 | - <span style="float: right; margin-left: 20px; color: ${P};"> | |
| 192 | - ${oe} | |
| 187 | + </div>`,F+"</div>"}},grid:{height:"70%",top:"10%"},xAxis:{type:"category",data:k,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},yAxis:{type:"category",data:b,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12},splitArea:{show:!0}},visualMap:{min:0,max:f.value,calculable:!0,orient:"horizontal",left:"center",bottom:"0%",inRange:{color:_.value}},series:[{name:u("Orders"),type:"heatmap",data:p.value,label:{show:!0},itemStyle:{borderColor:"#e0e0e0",borderWidth:1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};l.setOption(S)}})};be([p,f],()=>{xe(()=>{v()})}),be(g,k=>{k||v()}),be(y,k=>{k||v()});const w=()=>{c.value=Te.isDark(),xe(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",w),xe(()=>{v(),window.addEventListener("resize",()=>l==null?void 0:l.resize())})}),cl(()=>{l&&(window.removeEventListener("resize",()=>l==null?void 0:l.resize()),window.removeEventListener("onFluentCartThemeChange",w,!1),l.dispose(),l=null)}),(k,b)=>{const S=C("el-skeleton");return r(),E(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Orders by day and hour"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[y.value?(r(),E(S,{key:0,animated:"",rows:4,class:"px-3 pb-5"})):(r(),h(P,{key:1},[g.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512))],64))]),_:1})]),_:1})}}},Gae={class:"fct-gross-sale-vs-net-revenue-wrap"},zae={class:"flex items-center gap-2"},jae={class:"fct-card-header-title is-small"},qae={class:"fct-chart-select"},Yae={class:"fct-btn-group sm"},Wae={key:2,class:"chart-action-wrap"},Jae={class:"chart-change-wrap"},Xae={class:"chart-change"},Zae={class:"text"},ele={class:"chart-change"},tle={class:"text"},ale={__name:"OrderLineChart",props:{chartData:{type:Array,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T("default"),i=T(ba.getChartType("order","order_chart")||"line"),c=T(!1),p=Te.colors.report,f=T(Te.isDark()),{groupKeys:_}=fn(a.reportFilter,s),g=t,y=()=>{g("fetch-chart-data",s.value)},v=K(()=>Mt.data.isBusy.orderChartData),w=K(()=>[{title:u("Orders"),key:"order_count",color:f.value?p.dark_cyan_blue_16:p.light_gray,yAxisIndex:1,type:"bar"},{title:u("Gross Sales"),key:"gross_sale",color:f.value?p.blue_dark_mode:p.blue,yAxisIndex:0,type:"line"},{title:u("Revenue"),key:"net_revenue",color:f.value?p.purple_dark_mode:p.purple,yAxisIndex:0,type:"line"}].filter(({key:M})=>Nl.data.order.includes(M)).map(({title:M,key:O,color:L,yAxisIndex:H,type:j})=>U(M,j,H,a.chartData.map(W=>W[O]),L))),k=K(()=>a.chartData.map(M=>Ls(M.group)));let b=null;const S=T(!0),$=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=na(l.value),B(),b.on("legendselectchanged",M=>{S.value=M.selected.Orders}))})},D=K(()=>{const M=Ms(a.reportFilter.data.dateRange);return u("This report looks at orders created ")+M}),F=K(()=>pl(a.chartData.length)),B=()=>{if(!b)return;const M={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:Ql(f.value,p.dark_cyan_blue_16,p.light_gray_blue),confine:!0,position:wl,formatter:O=>{let L=O[0].axisValue;const H=f.value?"#ffffff":"#565865";return O.forEach(function(j,W){const G=W===0?j.value:za(j.value*100);L+=`<div> | |
| 188 | + ${j.marker} | |
| 189 | + <span style="color: ${H};">${j.seriesName}</span> | |
| 190 | + <span style="float: right; margin-left: 20px; color: ${H};"> | |
| 191 | + ${G} | |
| 193 | 192 | </span> |
| 194 | - </div>`}),H}},xAxis:{type:"category",data:b.value,axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,interval:U.value.interval},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Sales"),type:"value",position:"left",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12,formatter:D=>`${Je.scaled(D)}`},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:m.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:C.value};w.setOption(E,{notMerge:!0,replaceMerge:["series"]})},M=(E,D,H,P,G)=>({name:E,type:D,yAxisIndex:H,barMaxWidth:30,data:P,smooth:!1,color:G,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:G,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(G)},lineStyle:{color:G},areaStyle:{opacity:.3,color:G}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),I=()=>{c.value=!c.value,c.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):S()};Ce([()=>a.chartData,i],()=>{Se(S)},{deep:!0}),Ce(()=>Ml.data.order,()=>{Se(()=>{S()})},{deep:!0}),Ce(()=>a.isEmpty,E=>{E||F()}),Ce(v,E=>{E||F()}),Ce(x,()=>{if(!w)return;const D=w.getOption().series.map(H=>H.type==="line"?{...H,areaStyle:x.value?void 0:{opacity:.3}}:H);Se(()=>{w.setOption({series:D})})});const T=()=>{m.value=Te.isDark(),Se(()=>{S()})},Q=()=>{Se(()=>{S()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Qe(()=>{Se(F),window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("fluentCartCurrencyChange",Q)}),(E,D)=>{const H=B("el-tooltip"),P=B("el-option"),G=B("el-select"),J=B("el-skeleton");return r(),h("div",Wee,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Xee,[o("h5",Jee,f(A(u)("Order Chart")),1),n(H,{"popper-class":"fct-tooltip",content:L.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",Zee,[n(G,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":D[0]||(D[0]=oe=>s.value=oe),onChange:y},{default:d(()=>[(r(),h(O,null,ae(_,oe=>n(P,{key:oe.value,label:oe.label,value:oe.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",ete,[n(Xe,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:I,class:de(c.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,null,{default:d(()=>[v.value?(r(),$(J,{key:0,animated:"",rows:4})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?k("",!0):(r(),h("div",tte,[o("div",ate,[o("div",lte,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",ste,f(A(u)("Data")),1)]),o("div",nte,[o("span",ote,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},rte={class:"fct-report-monthly-list"},dte={class:"list-left-content"},ute={class:"list-title"},cte={class:"list-right-content"},Ate={class:"list-value"},pte={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=K(()=>Wa.currentCurrencySign),l=[{title:u("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Orders"),key:"monthly_orders"},{title:u("Average Monthly Items"),key:"monthly_items"}],s=K(()=>l.map(c=>({...c,value:t.orderReport.data.summary[c.key]||0,fluctuation:t.orderReport.data.fluctuations[c.key]||0,hasCurrency:c.hasCurrency||!1}))),i=c=>["monthly_net","monthly_gross"].includes(c.key)?Je.scaled(c.value):ia(c.value);return(c,p)=>(r(),h("ul",rte,[(r(!0),h(O,null,ae(s.value,(m,_)=>(r(),h("li",{key:_},[o("div",dte,[o("div",ute,f(m.title),1)]),o("div",cte,[o("div",Ate,[n(Is,{amount:i(m),title:m.title},null,8,["amount","title"]),n(ml,{fluctuation:m.fluctuation,amount:e.orderReport.data.previousSummary[m.key],"is-liability":!1,"has-currency":m.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},fte={class:"fct-report-result-content"},mte={class:"value"},hte={class:"inline-flex"},_te={class:"title"},vte={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=K(()=>t.reportFilter.currentCurrencySign),l=[{title:u("Taxes"),content:u("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:u("Shipping"),content:u("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],s=K(()=>l.map(i=>({...i,value:t.orderReport.data.summary[i.key]||0,fluctuation:t.orderReport.data.fluctuations[i.key]||0})).filter(i=>i.value>0));return(i,c)=>{const p=B("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:na(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(O,null,ae(s.value,m=>(r(),h("div",{class:"fct-report-result",key:m.title},[o("div",fte,[o("div",mte,[o("span",hte,f(A(Je).scaled(m.value)),1),m.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:na({color:m.fluctuation>0?"green":"red"})},[m.fluctuation>0?(r(),$(ee,{key:0,class:"w-2",name:"CaretUp"})):k("",!0),m.fluctuation<0?(r(),$(ee,{key:1,class:"w-2",name:"CaretDown"})):k("",!0),R(" "+f(A(ia)(m.fluctuation))+"% ",1)],4)):k("",!0)]),o("div",_te,[R(f(m.title)+" ",1),m.content?(r(),$(p,{key:0,"popper-class":"fct-tooltip",content:m.content,placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):k("",!0)])])]))),128))],4)}}},gte={class:"flex items-center gap-2"},yte={class:"fct-card-header-title is-small"},bte={class:"fct-btn-group sm"},wte=["innerHTML"],Cte=["innerHTML"],Bte=["innerHTML"],kte=["innerHTML"],xte={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;V("number");const a=V(!1),l=K(()=>Qt.data.isBusy.newVsReturning),s=K(()=>{if(a.value===!0){const c=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},m={customer_type:"Returning"};return c.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,m[_]=y*100/v}),[p,m]}return t.tableData});K(()=>t.reportFilter.currentCurrencySign),Qe(()=>{});const i=c=>`${parseFloat(c).toFixed(2)}%`;return(c,p)=>{const m=B("el-tooltip"),_=B("el-checkbox"),g=B("el-skeleton"),y=B("el-table-column"),v=B("el-empty"),C=B("el-table");return r(),$(xe,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small"},{title:d(()=>[o("div",gte,[o("h5",yte,f(A(u)("New vs. Returning Customers")),1),n(m,{"popper-class":"fct-tooltip",content:A(u)("Returning customers are those who first ordered before this period."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:d(()=>[o("div",bte,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=b=>a.value=b),onChange:c.selectGroupKey},{default:d(()=>[R(f(A(u)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),n(On,{data:s.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),n(ke,{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),$(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),$(C,{key:1,data:s.value,border:""},{empty:d(()=>[n(v,{text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[n(y,{prop:"customer_type",label:A(u)("Type"),"min-width":"90"},{default:d(b=>[R(f(b.row.customer_type),1)]),_:1},8,["label"]),n(y,{prop:"customer_count",label:A(u)("Customer Count"),"min-width":"120"},{default:d(b=>[R(f(a.value?i(b.row.customer_count):b.row.customer_count),1)]),_:1},8,["label"]),n(y,{prop:"order_count",label:A(u)("Order Count"),"min-width":"150"},{default:d(b=>[R(f(a.value?i(b.row.order_count):b.row.order_count),1)]),_:1},8,["label"]),n(y,{prop:"gross_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.gross_sales):A(Je).scaled(b.row.gross_sales)},null,8,wte)]),_:1},8,["label"]),n(y,{prop:"average_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.average_gross):A(Je).scaled(b.row.average_gross)},null,8,Cte)]),_:1},8,["label"]),n(y,{prop:"net_sales",label:A(u)("Revenue"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.net_sales):A(Je).scaled(b.row.net_sales)},null,8,Bte)]),_:1},8,["label"]),n(y,{prop:"average_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(b=>[o("div",{class:"inline-flex",innerHTML:a.value?i(b.row.average_net):A(Je).scaled(b.row.average_net)},null,8,kte)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Ste=lt(xte,[["__scopeId","data-v-7818e7a0"]]),Fte={class:"w-[240px] fct-btn-group gap-1.5"},$te={class:"capitalize"},Ete={class:"capitalize"},Ute=["innerHTML"],Ite=["innerHTML"],Qte=["innerHTML"],Dte=["innerHTML"],Vte={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=V("billing_country"),s=a.applicableFilters;K(()=>a.currentCurrencySign);const i=()=>{Qt.getOrderByGroup({params:{...s.params,groupKey:l.value}})},c=[{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}];return Qe(()=>{i()}),(p,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-table-column"),v=B("el-table");return r(),$(xe,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Ve,{title:A(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[o("div",Fte,[n(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=C=>l.value=C),onChange:i,placeholder:A(u)("Select Group")},{default:d(()=>[(r(),h(O,null,ae(c,C=>n(_,{key:C.value,label:C.label,value:C.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(On,{data:A(Qt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(v,{data:A(Qt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[l.value==="payment_method"?(r(),$(y,{key:0,prop:"payment_method",label:A(u)("Payment Method"),"min-width":"150"},{default:d(C=>[R(f(C.row.payment_method),1)]),_:1},8,["label"])):k("",!0),l.value==="shipping_country"?(r(),$(y,{key:1,prop:"shipping_country",label:A(u)("Country"),"min-width":"150"},{default:d(C=>[o("span",$te,f(A(Dn)(C.row.shipping_country)),1)]),_:1},8,["label"])):k("",!0),l.value==="billing_country"?(r(),$(y,{key:2,prop:"billing_country",label:A(u)("Billing Country"),"min-width":"150"},{default:d(C=>[o("span",Ete,f(A(Dn)(C.row.billing_country)),1)]),_:1},8,["label"])):k("",!0),n(y,{prop:"orders",label:A(u)("Orders"),"min-width":"150"},{default:d(C=>[R(f(A(u)(C.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.gross_sale)},null,8,Ute)]),_:1},8,["label"]),n(y,{prop:"average_order_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.average_order_gross)},null,8,Ite)]),_:1},8,["label"]),n(y,{prop:"net_sale",label:A(u)("Revenue"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.net_sale)},null,8,Qte)]),_:1},8,["label"]),n(y,{prop:"average_order_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(C=>[o("div",{class:"inline-flex",innerHTML:A(Je).scaled(C.row.average_order_net)},null,8,Dte)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},Tte={class:"fct-report-spend-by-day-wrap"},Mte={class:"flex items-center gap-2"},Lte={class:"fct-card-header-title is-small"},Rte={class:"fct-btn-group sm"},Ote={key:2,class:"chart-action-wrap"},Hte={class:"chart-change-wrap"},Pte={class:"chart-change"},Nte={class:"text"},Kte={class:"chart-change"},Gte={class:"text"},jte={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=V(null);let l=null;V(va.getChartType("order","gross_sale_by_day_chart")||"line");const s=V(!1),i=K(()=>{const F=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((U,S)=>U.day-S.day).map(U=>F[U.day-1])}),c=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Qt.data.isBusy.orderByDayAndHour),m=Te.colors.report,_=V(Te.isDark()),g=K(()=>[y("Gross Sale","line",0,t.chartData.map(F=>F.gross_sale),_.value?m.blue_dark_mode:m.blue),y("Orders","bar",1,t.chartData.map(F=>F.order_count),_.value?m.dark_cyan_blue_16:m.light_gray)]),y=(F,L,U,S,M)=>({name:F,type:L,barMaxWidth:30,data:S,smooth:!1,color:M,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:M,borderRadius:[4,4,0,0]},yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:za(M)},lineStyle:{color:M},areaStyle:{opacity:.3,color:M}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const F={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:L=>{let U=L[0].name;return L.forEach(S=>{const M=S.seriesName==="Gross Sale"?`${Je.scaled(S.value)}`:S.value,I=_.value?"#ffffff":"#565865";U+=`<div> | |
| 195 | - ${S.marker} | |
| 196 | - <span style="color: ${I};">${S.seriesName}</span> | |
| 197 | - <span style="float: right; margin-left: 20px; color: ${I};"> | |
| 198 | - ${M} | |
| 193 | + </div>`}),L}},xAxis:{type:"category",data:k.value,axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{name:u("Sales"),type:"value",position:"left",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12,formatter:O=>`${ft.scaled(O)}`},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:500},{name:u("Orders"),type:"value",position:"right",axisLabel:{color:f.value?"#ffffff":"#696778",fontSize:12},splitLine:{show:!1,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}},minInterval:20}],dataZoom:[],series:w.value};b.setOption(M,{notMerge:!0,replaceMerge:["series"]})},U=(M,O,L,H,j)=>({name:M,type:O,yAxisIndex:L,barMaxWidth:30,data:H,smooth:!1,color:j,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:j,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(j)},lineStyle:{color:j},areaStyle:{opacity:.3,color:j}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),Q=()=>{c.value=!c.value,c.value?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):B()};be([()=>a.chartData,i],()=>{xe(B)},{deep:!0}),be(()=>Nl.data.order,()=>{xe(()=>{B()})},{deep:!0}),be(()=>a.isEmpty,M=>{M||$()}),be(v,M=>{M||$()}),be(S,()=>{if(!b)return;const O=b.getOption().series.map(L=>L.type==="line"?{...L,areaStyle:S.value?void 0:{opacity:.3}}:L);xe(()=>{b.setOption({series:O})})});const V=()=>{f.value=Te.isDark(),xe(()=>{B()})},I=()=>{xe(()=>{B()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Ie(()=>{xe($),window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("fluentCartCurrencyChange",I)}),(M,O)=>{const L=C("el-tooltip"),H=C("el-option"),j=C("el-select"),W=C("el-skeleton");return r(),h("div",Gae,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",zae,[o("h5",jae,m(A(u)("Order Chart")),1),n(L,{"popper-class":"fct-tooltip",content:D.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",qae,[n(j,{class:"el-select--x-small",modelValue:s.value,"onUpdate:modelValue":O[0]||(O[0]=G=>s.value=G),onChange:y},{default:d(()=>[(r(!0),h(P,null,te(A(_),G=>(r(),E(H,{key:G.value,label:G.label,value:G.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",Yae,[n(at,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:Q,class:de(c.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,null,{default:d(()=>[v.value?(r(),E(W,{key:0,animated:"",rows:4})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-order-line-chart",ref_key:"chartRef",ref:l},null,512)),e.isEmpty?x("",!0):(r(),h("div",Wae,[o("div",Jae,[o("div",Xae,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Zae,m(A(u)("Data")),1)]),o("div",ele,[o("span",tle,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},lle={class:"fct-report-monthly-list"},sle={class:"list-left-content"},nle={class:"list-title"},ole={class:"list-right-content"},ile={class:"list-value"},rle={__name:"MonthlySummary",props:{orderReport:{type:Object,required:!0}},setup(e){const t=e,a=K(()=>Ka.currentCurrencySign),l=[{title:u("Average Monthly Gross"),key:"monthly_gross",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Revenue"),key:"monthly_net",currencySign:a,hasCurrency:!0},{title:u("Average Monthly Orders"),key:"monthly_orders"},{title:u("Average Monthly Items"),key:"monthly_items"}],s=K(()=>l.map(c=>({...c,value:t.orderReport.data.summary[c.key]||0,fluctuation:t.orderReport.data.fluctuations[c.key]||0,hasCurrency:c.hasCurrency||!1}))),i=c=>["monthly_net","monthly_gross"].includes(c.key)?ft.scaled(c.value):ua(c.value);return(c,p)=>(r(),h("ul",lle,[(r(!0),h(P,null,te(s.value,(f,_)=>(r(),h("li",{key:_},[o("div",sle,[o("div",nle,m(f.title),1)]),o("div",ole,[o("div",ile,[n(Rs,{amount:i(f),title:f.title},null,8,["amount","title"]),n(vl,{fluctuation:f.fluctuation,amount:e.orderReport.data.previousSummary[f.key],"is-liability":!1,"has-currency":f.hasCurrency},null,8,["fluctuation","amount","has-currency"])])])]))),128))]))}},dle={class:"fct-report-result-content"},ule={class:"value"},cle={class:"inline-flex"},Ale={class:"title"},ple={__name:"AverageResults",props:{orderReport:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e,a=K(()=>t.reportFilter.currentCurrencySign),l=[{title:u("Taxes"),content:u("Total amount of taxes"),key:"tax_total",currencySign:a.value},{title:u("Shipping"),content:u("Total amount of shipping costs"),key:"shipping_total",currencySign:a.value}],s=K(()=>l.map(i=>({...i,value:t.orderReport.data.summary[i.key]||0,fluctuation:t.orderReport.data.fluctuations[i.key]||0})).filter(i=>i.value>0));return(i,c)=>{const p=C("el-tooltip");return r(),h("div",{class:"fct-report-avg-wrap mb-7.5",style:ra(`--avg-grid-cols: ${s.value.length}`)},[(r(!0),h(P,null,te(s.value,f=>(r(),h("div",{class:"fct-report-result",key:f.title},[o("div",dle,[o("div",ule,[o("span",cle,m(A(ft).scaled(f.value)),1),f.fluctuation!==0?(r(),h("div",{key:0,class:"percentage",style:ra({color:f.fluctuation>0?"green":"red"})},[f.fluctuation>0?(r(),E(Y,{key:0,class:"w-2",name:"CaretUp"})):x("",!0),f.fluctuation<0?(r(),E(Y,{key:1,class:"w-2",name:"CaretDown"})):x("",!0),R(" "+m(A(ua)(f.fluctuation))+"% ",1)],4)):x("",!0)]),o("div",Ale,[R(m(f.title)+" ",1),f.content?(r(),E(p,{key:0,"popper-class":"fct-tooltip",content:f.content,placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4"})]),_:2},1032,["content"])):x("",!0)])])]))),128))],4)}}},fle={class:"flex items-center gap-2"},mle={class:"fct-card-header-title is-small"},hle={class:"fct-btn-group sm"},_le=["innerHTML"],vle=["innerHTML"],gle=["innerHTML"],yle=["innerHTML"],ble={__name:"NewVsReturningCustomer",props:{tableData:{type:Object,required:!0},reportFilter:{type:Object}},setup(e){const t=e;T("number");const a=T(!1),l=K(()=>Mt.data.isBusy.newVsReturning),s=K(()=>{if(a.value===!0){const c=["customer_count","order_count","net_sales","average_net","gross_sales","average_gross"],p={customer_type:"New"},f={customer_type:"Returning"};return c.forEach(_=>{const g=parseFloat(t.tableData[0][_]),y=parseFloat(t.tableData[1][_]),v=g+y;p[_]=g*100/v,f[_]=y*100/v}),[p,f]}return t.tableData});K(()=>t.reportFilter.currentCurrencySign),Ie(()=>{});const i=c=>`${parseFloat(c).toFixed(2)}%`;return(c,p)=>{const f=C("el-tooltip"),_=C("el-checkbox"),g=C("el-skeleton"),y=C("el-table-column"),v=C("el-empty"),w=C("el-table");return r(),E(Se,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small"},{title:d(()=>[o("div",fle,[o("h5",mle,m(A(u)("New vs. Returning Customers")),1),n(f,{"popper-class":"fct-tooltip",content:A(u)("Returning customers are those who first ordered before this period."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"text-gray-500 w-4 h-4 cursor-pointer"})]),_:1},8,["content"])])]),action:d(()=>[o("div",hle,[n(_,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=k=>a.value=k),onChange:c.selectGroupKey},{default:d(()=>[R(m(A(u)("Show Percentages")),1)]),_:1},8,["modelValue","onChange"]),n(jn,{data:s.value,filename:"order_report.csv"},null,8,["data"])])]),_:1}),n(ke,{class:"px-0 pb-0"},{default:d(()=>[l.value?(r(),E(g,{key:0,animated:"",rows:3,class:"p-3"})):(r(),E(w,{key:1,data:s.value,border:""},{empty:d(()=>[n(v,{text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[n(y,{prop:"customer_type",label:A(u)("Type"),"min-width":"90"},{default:d(k=>[R(m(k.row.customer_type),1)]),_:1},8,["label"]),n(y,{prop:"customer_count",label:A(u)("Customer Count"),"min-width":"120"},{default:d(k=>[R(m(a.value?i(k.row.customer_count):k.row.customer_count),1)]),_:1},8,["label"]),n(y,{prop:"order_count",label:A(u)("Order Count"),"min-width":"150"},{default:d(k=>[R(m(a.value?i(k.row.order_count):k.row.order_count),1)]),_:1},8,["label"]),n(y,{prop:"gross_sales",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.gross_sales):A(ft).scaled(k.row.gross_sales)},null,8,_le)]),_:1},8,["label"]),n(y,{prop:"average_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.average_gross):A(ft).scaled(k.row.average_gross)},null,8,vle)]),_:1},8,["label"]),n(y,{prop:"net_sales",label:A(u)("Revenue"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.net_sales):A(ft).scaled(k.row.net_sales)},null,8,gle)]),_:1},8,["label"]),n(y,{prop:"average_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(k=>[o("div",{class:"inline-flex",innerHTML:a.value?i(k.row.average_net):A(ft).scaled(k.row.average_net)},null,8,yle)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},wle=nt(ble,[["__scopeId","data-v-7818e7a0"]]),Cle={class:"w-[240px] fct-btn-group gap-1.5"},kle={class:"capitalize"},Ble={class:"capitalize"},xle=["innerHTML"],Sle=["innerHTML"],Fle=["innerHTML"],$le=["innerHTML"],Ele={__name:"OrderGroupedBy",props:{reportFilter:{type:Object}},setup(e){const a=e.reportFilter,l=T("billing_country"),s=a.applicableFilters;K(()=>a.currentCurrencySign);const i=()=>{Mt.getOrderByGroup({params:{...s.params,groupKey:l.value}})},c=[{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}];return Ie(()=>{i()}),(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-table-column"),v=C("el-table");return r(),E(Se,{class:"overflow-hidden",id:"chartContainer"},{default:d(()=>[n(Ve,{title:A(u)("Orders grouped by"),title_size:"small"},{action:d(()=>[o("div",Cle,[n(g,{class:"el-select--x-small",modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=w=>l.value=w),onChange:i,placeholder:A(u)("Select Group")},{default:d(()=>[(r(),h(P,null,te(c,w=>n(_,{key:w.value,label:w.label,value:w.value},null,8,["label","value"])),64))]),_:1},8,["modelValue","placeholder"]),n(jn,{data:A(Mt).data.orderByGroup,filename:"order_grouped_by.csv",class:"m-0"},null,8,["data"])])]),_:1},8,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[n(v,{data:A(Mt).data.orderByGroup,border:"",class:"max-h-[350px] overflow-y-auto"},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[l.value==="payment_method"?(r(),E(y,{key:0,prop:"payment_method",label:A(u)("Payment Method"),"min-width":"150"},{default:d(w=>[R(m(w.row.payment_method),1)]),_:1},8,["label"])):x("",!0),l.value==="shipping_country"?(r(),E(y,{key:1,prop:"shipping_country",label:A(u)("Country"),"min-width":"150"},{default:d(w=>[o("span",kle,m(A(Qs)(w.row.shipping_country)),1)]),_:1},8,["label"])):x("",!0),l.value==="billing_country"?(r(),E(y,{key:2,prop:"billing_country",label:A(u)("Billing Country"),"min-width":"150"},{default:d(w=>[o("span",Ble,m(A(Qs)(w.row.billing_country)),1)]),_:1},8,["label"])):x("",!0),n(y,{prop:"orders",label:A(u)("Orders"),"min-width":"150"},{default:d(w=>[R(m(A(u)(w.row.orders)),1)]),_:1},8,["label"]),n(y,{prop:"gross_sale",label:A(u)("Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.gross_sale)},null,8,xle)]),_:1},8,["label"]),n(y,{prop:"average_order_gross",label:A(u)("Average Gross Sales"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.average_order_gross)},null,8,Sle)]),_:1},8,["label"]),n(y,{prop:"net_sale",label:A(u)("Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.net_sale)},null,8,Fle)]),_:1},8,["label"]),n(y,{prop:"average_order_net",label:A(u)("Average Revenue"),"min-width":"150"},{default:d(w=>[o("div",{class:"inline-flex",innerHTML:A(ft).scaled(w.row.average_order_net)},null,8,$le)]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})]),_:1})}}},Ule={class:"fct-report-spend-by-day-wrap"},Ile={class:"flex items-center gap-2"},Qle={class:"fct-card-header-title is-small"},Dle={class:"fct-btn-group sm"},Vle={key:2,class:"chart-action-wrap"},Tle={class:"chart-change-wrap"},Mle={class:"chart-change"},Lle={class:"text"},Rle={class:"chart-change"},Ole={class:"text"},Ple={__name:"GrossSaleByDay",props:{reportFilter:{type:Object},chartRef:{},chartData:{type:Array,required:!0}},setup(e){const t=e,a=T(null);let l=null;T(ba.getChartType("order","gross_sale_by_day_chart")||"line");const s=T(!1),i=K(()=>{const $=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return[...t.chartData].sort((F,B)=>F.day-B.day).map(F=>$[F.day-1])}),c=K(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=K(()=>Mt.data.isBusy.orderByDayAndHour),f=Te.colors.report,_=T(Te.isDark()),g=K(()=>[y("Gross Sale","line",0,t.chartData.map($=>$.gross_sale),_.value?f.blue_dark_mode:f.blue),y("Orders","bar",1,t.chartData.map($=>$.order_count),_.value?f.dark_cyan_blue_16:f.light_gray)]),y=($,D,F,B,U)=>({name:$,type:D,barMaxWidth:30,data:B,smooth:!1,color:U,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:U,borderRadius:[4,4,0,0]},yAxisIndex:F,emphasis:{scale:2,itemStyle:{color:ja(U)},lineStyle:{color:U},areaStyle:{opacity:.3,color:U}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{if(!l)return;const $={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:Ql(_.value,f.dark_cyan_blue_16,f.light_gray_blue),confine:!0,position:wl,formatter:D=>{let F=D[0].name;return D.forEach(B=>{const U=B.seriesName==="Gross Sale"?za(B.value*100):B.value,Q=_.value?"#ffffff":"#565865";F+=`<div> | |
| 194 | + ${B.marker} | |
| 195 | + <span style="color: ${Q};">${B.seriesName}</span> | |
| 196 | + <span style="float: right; margin-left: 20px; color: ${Q};"> | |
| 197 | + ${U} | |
| 199 | 198 | </span> |
| 200 | - </div>`}),U}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",name:"Gross Sale",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:L=>`${Je.scaled(L)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:"Orders",position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:g.value};l.setOption(F)},C=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value&&(l=Jt(a.value),v())})},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>[Qt.data.grossSaleByDay],()=>{Se(()=>{v()})},{deep:!0}),Ce(c,F=>{F||C()}),Ce(p,F=>{F||C()});const w=()=>{_.value=Te.isDark(),Se(()=>{v()})},x=()=>{Se(()=>{v()})};return Qe(()=>{Se(()=>{C(),t.reportFilter.addListener("spend-by-day",C),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",x)})}),Ct(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),t.reportFilter.removeListener("spend-by-day",C,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Tte,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Mte,[o("h5",Lte,f(A(u)("Spend by day")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Gross sales grouped by the days of the week."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",Rte,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),$(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(O,{key:1},[c.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),c.value?k("",!0):(r(),h("div",Ote,[o("div",Hte,[o("div",Pte,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Nte,f(F.$t("Gross Sale")),1)]),o("div",Kte,[o("span",Gte,f(F.$t("Days of the week")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},zte={class:"fct-report-item-count-distribution-wrap"},qte={class:"flex items-center gap-2"},Yte={class:"fct-card-header-title is-small"},Wte={class:"fct-btn-group sm"},Xte={key:2,class:"chart-action-wrap"},Jte={class:"chart-change-wrap"},Zte={class:"chart-change"},eae={class:"text"},tae={class:"chart-change"},aae={class:"text"},lae={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);V(t.chartData.length<=1?"bar":va.getChartType("order","item_count_distribtion_chart")||"bar");const l=V(!1);K(()=>{const F=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((U,S)=>U.day-S.day).map(U=>F[U.day-1])});const s=Te.colors,i=V(Te.isDark());let c=null;const p=()=>{l.value=!l.value,l.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):c.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},m=()=>{c&&c.resize()},_=K(()=>i.value?s.blue[500]+"52":s.blue[300]),g=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(F=>F.order_count),smooth:!1,color:_.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:_.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:i.value?s.blue[800]:s.blue[400]},lineStyle:{color:_.value},areaStyle:{opacity:.3,color:_.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?s.report.dark_cyan_blue_16:s.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map(F=>F.item_count),axisLabel:{color:i.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:i.value?"#FFFFFF":"#696778",fontSize:12},min:0,splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},dataZoom:[],series:g.value})),v=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),C=K(()=>Qt.data.isBusy.orderByDayAndHour),b=()=>{c&&(c.dispose(),c=null),Se(()=>{a.value&&(c=Jt(a.value),c.setOption(y.value),window.addEventListener("resize",m))})},w=()=>{c&&c.setOption(y.value)};Ce(()=>t.chartData,()=>{c?c.setOption(y.value):Se(()=>{b()})}),Ce(v,F=>{F||b()}),Ce(C,F=>{F||b()});const x=()=>{i.value=Te.isDark(),Se(()=>{w()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Se(()=>{b()})}),Ct(()=>{c&&(c.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",m))}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",zte,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",qte,[o("h5",Yte,f(A(u)("Item count distribution")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Grouping the orders by the number of items in each order."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",Wte,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:p,class:de(l.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[C.value?(r(),$(S,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(O,{key:1},[v.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?k("",!0):(r(),h("div",Xte,[o("div",Jte,[o("div",Zte,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",eae,f(F.$t("Order Count")),1)]),o("div",tae,[o("span",aae,f(F.$t("Item Count")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},sae={class:"fct-report-spend-by-hour-wrap"},nae={class:"flex items-center gap-2"},oae={class:"fct-card-header-title is-small"},iae={class:"fct-btn-group sm"},rae={key:2,class:"chart-action-wrap"},dae={class:"chart-change-wrap"},uae={class:"chart-change"},cae={class:"text"},Aae={class:"chart-change"},pae={class:"text"},fae={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=V(null);let l=null;V(va.getChartType("order","gross_sale_by_hour_chart")||"line");const s=V(!1),i=K(()=>t.chartData.map(F=>F.hour)),c=K(()=>Object.values(t.chartData).every(F=>F.order_count===0)),p=K(()=>Qt.data.isBusy.orderByDayAndHour),m=Te.colors.report,_=V(Te.isDark()),g=(F,L,U,S,M)=>({name:F,type:L,barMaxWidth:30,data:U,smooth:!1,color:S,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:S,borderRadius:[4,4,0,0]},yAxisIndex:M,emphasis:{scale:2,itemStyle:{color:za(S)},lineStyle:{color:S},areaStyle:{opacity:.3,color:S}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=K(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map(F=>F.gross_sale),color:_.value?m.purple_dark_mode:m.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map(F=>F.order_count),color:_.value?m.dark_cyan_blue_16:m.light_gray}].map(F=>g(F.name,F.type,F.data,F.color,F.yAxisIndex))),v=()=>{if(!l)return;const F={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:_.value?m.dark_cyan_blue_16:m.light_gray_blue}},formatter:L=>{let U=L[0].name;return L.forEach(S=>{const M=S.seriesName==="Gross Sale"?`${Je.scaled(S.value)}`:S.value,I=_.value?"#ffffff":"#565865";U+=`<div> | |
| 201 | - ${S.marker} | |
| 202 | - <span style="color: ${I};">${S.seriesName}</span> | |
| 203 | - <span style="float: right; margin-left: 20px; color: ${I};"> | |
| 204 | - ${M} | |
| 199 | + </div>`}),F}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",name:"Gross Sale",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:D=>`${ft.scaled(D)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:"Orders",position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:g.value};l.setOption($)},w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=na(a.value),v())})},k=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>[Mt.data.grossSaleByDay],()=>{xe(()=>{v()})},{deep:!0}),be(c,$=>{$||w()}),be(p,$=>{$||w()});const b=()=>{_.value=Te.isDark(),xe(()=>{v()})},S=()=>{xe(()=>{v()})};return Ie(()=>{xe(()=>{w(),t.reportFilter.addListener("spend-by-day",w),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",S)})}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),t.reportFilter.removeListener("spend-by-day",w,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",Ule,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Ile,[o("h5",Qle,m(A(u)("Spend by day")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Gross sales grouped by the days of the week."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",Dle,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(B,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(P,{key:1},[c.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-day-chart",ref_key:"chartRef",ref:a},null,512)),c.value?x("",!0):(r(),h("div",Vle,[o("div",Tle,[o("div",Mle,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Lle,m($.$t("Gross Sale")),1)]),o("div",Rle,[o("span",Ole,m($.$t("Days of the week")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Hle={class:"fct-report-item-count-distribution-wrap"},Nle={class:"flex items-center gap-2"},Kle={class:"fct-card-header-title is-small"},Gle={class:"fct-btn-group sm"},zle={key:2,class:"chart-action-wrap"},jle={class:"chart-change-wrap"},qle={class:"chart-change"},Yle={class:"text"},Wle={class:"chart-change"},Jle={class:"text"},Xle={__name:"ItemCountDistribution",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);T(t.chartData.length<=1?"bar":ba.getChartType("order","item_count_distribtion_chart")||"bar");const l=T(!1);K(()=>{const $=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];return[...t.chartData].sort((F,B)=>F.day-B.day).map(F=>$[F.day-1])});const s=Te.colors,i=T(Te.isDark());let c=null;const p=()=>{l.value=!l.value,l.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):c.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})},f=()=>{c&&c.resize()},_=K(()=>i.value?s.blue[500]+"52":s.blue[300]),g=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map($=>$.order_count),smooth:!1,color:_.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:_.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:i.value?s.blue[800]:s.blue[400]},lineStyle:{color:_.value},areaStyle:{opacity:.3,color:_.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),y=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?s.report.dark_cyan_blue_16:s.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:t.chartData.map($=>$.item_count),axisLabel:{color:i.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:i.value?"#FFFFFF":"#696778",fontSize:12},min:0,splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},dataZoom:[],series:g.value})),v=K(()=>Object.values(t.chartData).every($=>$.order_count===0)),w=K(()=>Mt.data.isBusy.orderByDayAndHour),k=()=>{c&&(c.dispose(),c=null),xe(()=>{a.value&&(c=na(a.value),c.setOption(y.value),window.addEventListener("resize",f))})},b=()=>{c&&c.setOption(y.value)};be(()=>t.chartData,()=>{c?c.setOption(y.value):xe(()=>{k()})}),be(v,$=>{$||k()}),be(w,$=>{$||k()});const S=()=>{i.value=Te.isDark(),xe(()=>{b()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),xe(()=>{k()})}),Bt(()=>{c&&(c.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",f))}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",Hle,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Nle,[o("h5",Kle,m(A(u)("Item count distribution")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Grouping the orders by the number of items in each order."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",Gle,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:p,class:de(l.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[w.value?(r(),E(B,{key:0,animated:"",rows:4,class:"px-5 pb-5"})):(r(),h(P,{key:1},[v.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-item-count-distribution-chart",ref_key:"chartRef",ref:a},null,512)),v.value?x("",!0):(r(),h("div",zle,[o("div",jle,[o("div",qle,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Yle,m($.$t("Order Count")),1)]),o("div",Wle,[o("span",Jle,m($.$t("Item Count")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Zle={class:"fct-report-spend-by-hour-wrap"},ese={class:"flex items-center gap-2"},tse={class:"fct-card-header-title is-small"},ase={class:"fct-btn-group sm"},lse={key:2,class:"chart-action-wrap"},sse={class:"chart-change-wrap"},nse={class:"chart-change"},ose={class:"text"},ise={class:"chart-change"},rse={class:"text"},dse={__name:"GrossSaleByHour",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""}},setup(e){const t=e,a=T(null);let l=null;T(ba.getChartType("order","gross_sale_by_hour_chart")||"line");const s=T(!1),i=K(()=>t.chartData.map($=>$.hour)),c=K(()=>Object.values(t.chartData).every($=>$.order_count===0)),p=K(()=>Mt.data.isBusy.orderByDayAndHour),f=Te.colors.report,_=T(Te.isDark()),g=($,D,F,B,U)=>({name:$,type:D,barMaxWidth:30,data:F,smooth:!1,color:B,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:B,borderRadius:[4,4,0,0]},yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:ja(B)},lineStyle:{color:B},areaStyle:{opacity:.3,color:B}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),y=K(()=>[{name:u("Gross Sale"),type:"line",yAxisIndex:0,data:t.chartData.map($=>$.gross_sale),color:_.value?f.purple_dark_mode:f.purple},{name:u("Orders"),type:"bar",yAxisIndex:1,data:t.chartData.map($=>$.order_count),color:_.value?f.dark_cyan_blue_16:f.light_gray}].map($=>g($.name,$.type,$.data,$.color,$.yAxisIndex))),v=()=>{if(!l)return;const $={title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:_.value?"#253241":"#ffffff",borderColor:_.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:_.value?"#ffffff":"#565865"},axisPointer:Ql(_.value,f.dark_cyan_blue_16,f.light_gray_blue),confine:!0,position:wl,formatter:D=>{let F=D[0].name;return D.forEach(B=>{const U=B.seriesName==="Gross Sale"?za(B.value*100):B.value,Q=_.value?"#ffffff":"#565865";F+=`<div> | |
| 200 | + ${B.marker} | |
| 201 | + <span style="color: ${Q};">${B.seriesName}</span> | |
| 202 | + <span style="float: right; margin-left: 20px; color: ${Q};"> | |
| 203 | + ${U} | |
| 205 | 204 | </span> |
| 206 | - </div>`}),U}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}},axisTick:{alignWithLabel:!0}},yAxis:[{type:"value",name:u("Gross Sale"),axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:L=>`${Je.scaled(L)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:u("Orders"),position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value};l.setOption(F)},C=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value&&(l=Jt(a.value),v())})},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>t.chartData,()=>{Se(()=>v())}),Ce(c,F=>{F||C()}),Ce(p,F=>{F||C()});const w=()=>{_.value=Te.isDark(),Se(()=>{v()})},x=()=>{Se(()=>{v()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",x),Se(()=>C())}),Ct(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",sae,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",nae,[o("h5",oae,f(A(u)("Spend by hour ")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",iae,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),$(S,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(O,{key:1},[c.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),c.value?k("",!0):(r(),h("div",rae,[o("div",dae,[o("div",uae,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",cae,f(F.$t("Gross Sale")),1)]),o("div",Aae,[o("span",pae,f(F.$t("Hour")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},mae={class:"fct-report-order-completion-time-wrap"},hae={class:"flex items-center gap-2"},_ae={class:"fct-card-header-title is-small"},vae={class:"fct-btn-group sm"},gae={key:2,class:"chart-action-wrap"},yae={class:"chart-change-wrap"},bae={class:"chart-change"},wae={class:"text"},Cae={class:"chart-change"},Bae={class:"text"},kae={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let l=null;V(va.getChartType("order","order_completion_time_chart")||"bar");const s=V(!1),i=K(()=>t.chartData.map(F=>F.hour)),c=Te.colors,p=V(Te.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map(F=>F.orders),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>Object.values(t.chartData).every(F=>F.orders===0)),y=K(()=>Qt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},C=()=>{if(!l)return;const F={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:p.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(F)},b=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value&&(l=Jt(a.value),C())})},w=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>t.chartData,()=>{l?C():Se(()=>{b()})}),Ce(g,F=>{F||b()}),Ce(y,F=>{F||b()});const x=()=>{p.value=Te.isDark(),Se(()=>{C()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Se(()=>b())}),Ct(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",v))}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",mae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",hae,[o("h5",_ae,f(A(u)("Time between an order's created & completed date")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",vae,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),$(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(O,{key:1},[g.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?k("",!0):(r(),h("div",gae,[o("div",yae,[o("div",bae,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",wae,f(A(u)("Order Count")),1)]),o("div",Cae,[o("span",Bae,f(A(u)("Hours")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},xae={class:"fct-report-order-value-distribution-wrap"},Sae={class:"flex items-center gap-2"},Fae={class:"fct-card-header-title is-small"},$ae={class:"fct-btn-group sm"},Eae={key:2,class:"chart-action-wrap"},Uae={class:"chart-change-wrap"},Iae={class:"chart-change"},Qae={class:"text"},Dae={class:"chart-change"},Vae={class:"text"},Tae={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=V(null);let l=null;V(va.getChartType("order","order_value_distribution_chart")||"bar");const s=V(!1),i=K(()=>Object.keys(t.chartData)),c=Te.colors,p=V(Te.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>!Object.values(t.chartData).every(F=>F&&F!==0)),g=K(()=>Qt.data.isBusy.orderValueDistribution),y=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:m.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),C=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value?(l=Jt(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},b=()=>{l&&l.setOption(v.value)},w=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>t.chartData,()=>{l&&l.setOption(v.value)}),Ce(_,F=>{F||C()}),Ce(g,F=>{F||C()});const x=()=>{p.value=Te.isDark(),Se(()=>{b()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",x,!1),Se(()=>{C()})}),Ct(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("resize",()=>{l.resize()}))}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",xae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Sae,[o("h5",Fae,f(A(u)("Order value distribution")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:d(()=>[o("div",$ae,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[g.value?(r(),$(S,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(O,{key:1},[_.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),_.value?k("",!0):(r(),h("div",Eae,[o("div",Uae,[o("div",Iae,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Qae,f(F.$t("Order Count")),1)]),o("div",Dae,[o("span",Vae,f(F.$t("Order Value Ranges")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Mae={class:"fct-report-average-order-gross-wrap"},Lae={class:"flex items-center gap-2"},Rae={class:"fct-card-header-title is-small"},Oae={class:"fct-btn-group sm"},Hae={key:2,class:"chart-action-wrap"},Pae={class:"chart-change-wrap"},Nae={class:"chart-change"},Kae={class:"text"},Gae={class:"chart-change"},jae={class:"text"},zae={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=V(null);let l=null;V("line");const s=V(!1),i=Te.colors.report,c=V(Te.isDark()),p=K(()=>c.value?i.blue_dark_mode:i.blue),m=K(()=>Qt.data.isBusy.orderChartData),_=K(()=>[{name:u("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map(F=>F.average_order_gross),smooth:!1,color:p.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:za(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>dl(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const F=Ql(t.chartData),L={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_cyan_blue}},valueFormatter:U=>Je.scaled(U)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:F,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:g.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(L)},C=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value&&(l=Jt(a.value),v())})},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>t.chartData,()=>{Se(()=>v())}),Ce(t.isEmpty,F=>{F||C()}),Ce(m,F=>{F||C()});const w=()=>{c.value=Te.isDark(),Se(()=>{v()})},x=()=>{v()};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",w,!1),window.addEventListener("fluentCartCurrencyChange",x),Se(()=>C())}),Ct(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",x,!1)}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",Mae,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small"},ta({title:d(()=>[o("div",Lae,[o("h5",Rae,f(A(u)("Average Order Gross ")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Average Order Gross grouped by date period."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",Oae,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[m.value?(r(),$(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?k("",!0):(r(),h("div",Hae,[o("div",Pae,[o("div",Nae,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Kae,f(F.$t("Average Order Gross")),1)]),o("div",Gae,[o("span",jae,f(F.$t("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},qae={class:"fct-report-average-order-items-wrap"},Yae={class:"flex items-center gap-2"},Wae={class:"fct-card-header-title is-small"},Xae={class:"fct-btn-group sm"},Jae={key:2,class:"chart-action-wrap"},Zae={class:"chart-change-wrap"},ele={class:"chart-change"},tle={class:"text"},ale={class:"chart-change"},lle={class:"text"},sle={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=V(null);let l=null;V(va.getChartType("order","avg_order_items_chart")||"line");const s=V(!1),i=Te.colors.report,c=V(Te.isDark()),p=K(()=>c.value?i.purple_dark_mode:i.purple),m=K(()=>[{name:u("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map(F=>F.average_order_items_count):[],smooth:!1,color:p.value,showSymbol:!0,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:za(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=K(()=>dl(t.chartData.length)),g=K(()=>{const F=Ql(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:F,axisLabel:{color:c.value?"#FFFFFF":"#696778",fontSize:12,interval:_.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:c.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:m.value}}),y=K(()=>Qt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},C=()=>{l&&(l.dispose(),l=null),Se(()=>{a.value?(l=Jt(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},b=()=>{l&&l.setOption(g.value)},w=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};Ce(()=>t.chartData,()=>{l&&l.setOption(g.value)}),Ce(t.isEmpty,F=>{F||C()}),Ce(y,F=>{F||C()});const x=()=>{c.value=Te.isDark(),Se(()=>{b()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",x),Se(()=>{C(),window.addEventListener("resize",v)})}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),(F,L)=>{const U=B("el-tooltip"),S=B("el-skeleton");return r(),h("div",qae,[n(xe,null,{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small"},ta({title:d(()=>[o("div",Yae,[o("h5",Wae,f(A(u)("Average Order Items ")),1),n(U,{"popper-class":"fct-tooltip",content:A(u)("Average Order Items grouped by date period."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",Xae,[n(Xe,{tag:"button",size:"x-small",title:F.$t("Zoom Chart"),onClick:w,class:de(s.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),$(S,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?k("",!0):(r(),h("div",Jae,[o("div",Zae,[o("div",ele,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",tle,f(F.$t("Average Order Items")),1)]),o("div",ale,[o("span",lle,f(F.$t("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},nle={class:"fct-order-report-page"},ole={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Qt.getOrderChartData({params:{...i.params,groupKey:""}}),Qt.getNewVsReturningCustomer(i),Qt.getReportByDayAndHour(i),Qt.getItemCountDistribution(i),Qt.getOrderCompletionTime(i),Qt.getOrderValueDistribution(i))},s=i=>{const c=a.applicableFilters;c&&Qt.getOrderChartData({params:{...c.params,groupKey:i}})};return Qe(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),Ct(()=>{a.removeListener("order-report",l,!1),a.value}),(i,c)=>{const p=B("el-col"),m=B("el-row");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",nle,[n(qee,{orderReport:A(Qt),reportFilter:A(a)},null,8,["orderReport","reportFilter"]),n(ite,{chartData:A(Qt).data.orderChartData,reportFilter:A(a),onFetchChartData:s,"is-empty":!A(Qt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),n(pte,{orderReport:A(Qt)},null,8,["orderReport"]),A(Qt).data.summary.tax_total||A(Qt).data.summary.shipping_total?(r(),$(vte,{key:0,orderReport:A(Qt),reportFilter:A(a)},null,8,["orderReport","reportFilter"])):k("",!0),n(Ste,{tableData:A(Qt).data.newVsReturning,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Vte,{tableData:A(Qt).data.orderByGroup,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Yee,{chartData:A(Qt).data.orderByDayAndHour},null,8,["chartData"]),n(m,{gutter:30},{default:d(()=>[n(p,{lg:12},{default:d(()=>[n(jte,{reportFilter:A(a),ref:"chartRef",chartData:A(Qt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(fae,{chartData:A(Qt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(lae,{ref:"chartRef",chartData:A(Qt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Tae,{chartData:A(Qt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(zae,{chartData:A(Qt).data.orderChartData,"is-empty":!A(Qt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(sle,{chartData:A(Qt).data.orderChartData,"is-empty":!A(Qt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(kae,{chartData:A(Qt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},ile={class:"fct-gross-sale-vs-net-revenue-wrap"},rle={class:"flex items-center gap-2"},dle={class:"fct-card-header-title is-small"},ule={class:"fct-chart-select"},cle={class:"fct-btn-group sm"},Ale={class:"chart-action-wrap"},ple={class:"chart-change-wrap"},fle={class:"chart-change"},mle={class:"text"},hle={class:"chart-change"},_le={class:"text"},vle={__name:"RefundLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!1},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=Te.colors.report,s=V(Te.isDark()),i=V(null),c=V("default"),p=V(va.getChartType("refund","refund_chart")||"line"),m=V(!1);K(()=>a.reportFilter.currentCurrencySign);const _=[{label:u("Default"),value:"default"},{label:u("Monthly"),value:"monthly"},{label:u("Yearly"),value:"yearly"}],g=t,y=()=>{g("fetch-chart-data",c.value)},v=K(()=>a.reportFilter.data.compareType!=="no_comparison"),C=(T,Q,E,D,H,P=!0)=>({name:T,type:Q,barMaxWidth:30,data:E,smooth:!1,color:D,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:D,borderRadius:[4,4,0,0]},yAxisIndex:H,emphasis:{scale:2,itemStyle:{color:za(D)},lineStyle:{color:D},areaStyle:{opacity:.3,color:D}},animation:P,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),b=K(()=>{let T=[{name:u("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(Q=>Q.refunded_amount),animation:!1},{name:u("Total Refunds"),key:"refund_count",type:"bar",color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(Q=>Q.refund_count),animation:!1}];return v.value&&T.unshift({name:u("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:s.value?l.purple_dark_mode:l.purple,yAxisIndex:0,data:a.compareData.map(Q=>Q.refunded_amount),animation:!1},{name:u("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:s.value?l.dark_cyan_blue_16:l.light_gray,yAxisIndex:1,data:a.compareData.map(Q=>Q.refund_count),animation:!0}),T.map(Q=>C(Q.name,Q.type,Q.data,Q.color,Q.yAxisIndex,Q.animation))});let w=null;const x=V(!0),F=()=>{w&&(w.dispose(),w=null),Se(()=>{i.value&&(w=Jt(i.value),S(),w.on("legendselectchanged",T=>{x.value=T.selected["Total Refunds"]||T.selected["Previous Total Refunds"]}))})},L=K(()=>{const T=Es(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+T}),U=K(()=>dl(a.chartData.length)),S=()=>{if(!w)return;const T=Ql(a.chartData),Q={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:E=>{let D=E[0].name;return E.forEach(H=>{const P=[0,2].includes(H.seriesIndex)?`${Je.scaled(H.value)}`:H.value,G=s.value?"#ffffff":"#565865";D+=`<div> | |
| 207 | - ${H.marker} | |
| 208 | - <span style="color: ${G};">${H.seriesName}</span> | |
| 209 | - <span style="float: right; margin-left: 20px; color: ${G};"> | |
| 210 | - ${P} | |
| 205 | + </div>`}),F}},grid:{left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:_.value?"#253241":"#D6DAE1"}},axisTick:{alignWithLabel:!0}},yAxis:[{type:"value",name:u("Gross Sale"),axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12,formatter:D=>`${ft.scaled(D)}`},min:0,max:"dataMax",splitLine:{show:!0,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",name:u("Orders"),position:"right",axisLabel:{color:_.value?"#FFFFFF":"#696778",fontSize:12},min:0,max:"dataMax",splitLine:{show:!1,lineStyle:{color:_.value?"#253241":"#D6DAE1",type:"dashed"}}}],dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value};l.setOption($)},w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=na(a.value),v())})},k=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{xe(()=>v())}),be(c,$=>{$||w()}),be(p,$=>{$||w()});const b=()=>{_.value=Te.isDark(),xe(()=>{v()})},S=()=>{xe(()=>{v()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",S),xe(()=>w())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",Zle,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",ese,[o("h5",tse,m(A(u)("Spend by hour ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Gross Sales grouped by the hours of the day."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[c.value?void 0:{name:"action",fn:d(()=>[o("div",ase,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[p.value?(r(),E(B,{key:0,animated:"",rows:10,class:"px-3"})):(r(),h(P,{key:1},[c.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-spend-by-hour-chart",ref_key:"chartRef",ref:a},null,512)),c.value?x("",!0):(r(),h("div",lse,[o("div",sse,[o("div",nse,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",ose,m($.$t("Gross Sale")),1)]),o("div",ise,[o("span",rse,m($.$t("Hour")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},use={class:"fct-report-order-completion-time-wrap"},cse={class:"flex items-center gap-2"},Ase={class:"fct-card-header-title is-small"},pse={class:"fct-btn-group sm"},fse={key:2,class:"chart-action-wrap"},mse={class:"chart-change-wrap"},hse={class:"chart-change"},_se={class:"text"},vse={class:"chart-change"},gse={class:"text"},yse={__name:"OrderCompletionTime",props:{chartData:{type:Array,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ba.getChartType("order","order_completion_time_chart")||"bar");const s=T(!1),i=K(()=>t.chartData.map($=>$.hour)),c=Te.colors,p=T(Te.isDark()),f=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:t.chartData.map($=>$.orders),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>Object.values(t.chartData).every($=>$.orders===0)),y=K(()=>Mt.data.isBusy.orderCompletionTime),v=()=>{l&&l.resize()},w=()=>{if(!l)return;const $={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#FFFFFF":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:p.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption($)},k=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=na(a.value),w())})},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l?w():xe(()=>{k()})}),be(g,$=>{$||k()}),be(y,$=>{$||k()});const S=()=>{p.value=Te.isDark(),xe(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),xe(()=>k())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",v))}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",use,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",cse,[o("h5",Ase,m(A(u)("Time between an order's created & completed date")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their completion time in Hours."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.chartData.length?{name:"action",fn:d(()=>[o("div",pse,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(B,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[g.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-completion-time-chart",ref_key:"chartRef",ref:a},null,512)),g.value?x("",!0):(r(),h("div",fse,[o("div",mse,[o("div",hse,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",_se,m(A(u)("Order Count")),1)]),o("div",vse,[o("span",gse,m(A(u)("Hours")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},bse={class:"fct-report-order-value-distribution-wrap"},wse={class:"flex items-center gap-2"},Cse={class:"fct-card-header-title is-small"},kse={class:"fct-btn-group sm"},Bse={key:2,class:"chart-action-wrap"},xse={class:"chart-change-wrap"},Sse={class:"chart-change"},Fse={class:"text"},$se={class:"chart-change"},Ese={class:"text"},Use={__name:"OrderValueDistribution",props:{chartData:{type:Object,required:!0},chartRef:{}},setup(e){const t=e,a=T(null);let l=null;T(ba.getChartType("order","order_value_distribution_chart")||"bar");const s=T(!1),i=K(()=>Object.keys(t.chartData)),c=Te.colors,p=T(Te.isDark()),f=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_=K(()=>!Object.values(t.chartData).every($=>$&&$!==0)),g=K(()=>Mt.data.isBusy.orderValueDistribution),y=K(()=>[{name:u("Orders"),type:"bar",barMaxWidth:30,data:Object.values(t.chartData),smooth:!1,color:f.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),v=K(()=>({title:{text:t.chartTitle,left:"center"},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:i.value,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",name:u("Orders"),axisLabel:{formatter:"{value}",color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:y.value})),w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value?(l=na(a.value),l.setOption(v.value),window.addEventListener("resize",()=>{l.resize()})):l&&l.setOption(v.value)})},k=()=>{l&&l.setOption(v.value)},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l&&l.setOption(v.value)}),be(_,$=>{$||w()}),be(g,$=>{$||w()});const S=()=>{p.value=Te.isDark(),xe(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S,!1),xe(()=>{w()})}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("resize",()=>{l.resize()}))}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",bse,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",wse,[o("h5",Cse,m(A(u)("Order value distribution")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Orders grouped by based on their order value in different ranges."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[_.value?void 0:{name:"action",fn:d(()=>[o("div",kse,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[g.value?(r(),E(B,{key:0,animated:"",rows:4,class:"p-3"})):(r(),h(P,{key:1},[_.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-order-value-distribution-chart",ref_key:"chartRef",ref:a},null,512)),_.value?x("",!0):(r(),h("div",Bse,[o("div",xse,[o("div",Sse,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Fse,m($.$t("Order Count")),1)]),o("div",$se,[o("span",Ese,m($.$t("Order Value Ranges")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Ise={class:"fct-report-average-order-gross-wrap"},Qse={class:"flex items-center gap-2"},Dse={class:"fct-card-header-title is-small"},Vse={class:"fct-btn-group sm"},Tse={key:2,class:"chart-action-wrap"},Mse={class:"chart-change-wrap"},Lse={class:"chart-change"},Rse={class:"text"},Ose={class:"chart-change"},Pse={class:"text"},Hse={__name:"AverageOrderGross",props:{chartData:{type:Array,required:!0},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=T(null);let l=null;T("line");const s=T(!1),i=Te.colors.report,c=T(Te.isDark()),p=K(()=>c.value?i.blue_dark_mode:i.blue),f=K(()=>Mt.data.isBusy.orderChartData),_=K(()=>[{name:u("Average Order Gross"),type:"line",barMaxWidth:30,data:t.chartData.map($=>$.average_order_gross),smooth:!1,color:p.value,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:ja(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),g=K(()=>pl(t.chartData.length)),y=()=>{l&&l.resize()},v=()=>{if(!l)return;const $=Ol(t.chartData),D={title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:Ql(c.value,i.dark_cyan_blue_16,i.light_gray_cyan_blue),confine:!0,position:wl,valueFormatter:F=>za(F*100)},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:$,axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:g.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:_.value};l.setOption(D)},w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value&&(l=na(a.value),v())})},k=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{xe(()=>v())}),be(t.isEmpty,$=>{$||w()}),be(f,$=>{$||w()});const b=()=>{c.value=Te.isDark(),xe(()=>{v()})},S=()=>{v()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",S),xe(()=>w())}),Bt(()=>{l&&(l.dispose(),window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("resize",y)),window.removeEventListener("fluentCartCurrencyChange",S,!1)}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",Ise,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small"},oa({title:d(()=>[o("div",Qse,[o("h5",Dse,m(A(u)("Average Order Gross ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Average Order Gross grouped by date period."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",Vse,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:k,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[f.value?(r(),E(B,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-gross-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",Tse,[o("div",Mse,[o("div",Lse,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Rse,m($.$t("Average Order Gross")),1)]),o("div",Ose,[o("span",Pse,m($.$t("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},Nse={class:"fct-report-average-order-items-wrap"},Kse={class:"flex items-center gap-2"},Gse={class:"fct-card-header-title is-small"},zse={class:"fct-btn-group sm"},jse={key:2,class:"chart-action-wrap"},qse={class:"chart-change-wrap"},Yse={class:"chart-change"},Wse={class:"text"},Jse={class:"chart-change"},Xse={class:"text"},Zse={__name:"AverageOrderItems",props:{chartData:{type:Array,required:!0},chartRef:{},isEmpty:{type:Boolean,required:!1}},setup(e){const t=e,a=T(null);let l=null;T(ba.getChartType("order","avg_order_items_chart")||"line");const s=T(!1),i=Te.colors.report,c=T(Te.isDark()),p=K(()=>c.value?i.purple_dark_mode:i.purple),f=K(()=>[{name:u("Average Order Items"),type:"line",barMaxWidth:30,data:Array.isArray(t.chartData)?t.chartData.map($=>$.average_order_items_count):[],smooth:!1,color:p.value,showSymbol:!0,symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:p.value,borderRadius:[4,4,0,0]},yAxisIndex:0,emphasis:{scale:2,itemStyle:{color:ja(p.value)},lineStyle:{color:p.value},areaStyle:{opacity:.3,color:p.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}]),_=K(()=>pl(t.chartData.length)),g=K(()=>{const $=Ol(t.chartData);return{title:{text:"",left:"center"},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_cyan_blue}}},grid:{show:!1,left:"10%",right:"10%",bottom:"15%"},xAxis:{type:"category",data:$,axisLabel:{color:c.value?"#FFFFFF":"#696778",fontSize:12,interval:_.value.interval},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{name:"Order Items",type:"value",axisLabel:{formatter:"{value}",color:c.value?"#FFFFFF":"#696778",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}},min:0,splitNumber:5},dataZoom:s.value?[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]:[],series:f.value}}),y=K(()=>Mt.data.isBusy.orderChartData),v=()=>{l&&l.resize()},w=()=>{l&&(l.dispose(),l=null),xe(()=>{a.value?(l=na(a.value),l.setOption(g.value),window.addEventListener("resize",v)):l&&l.setOption(g.value)})},k=()=>{l&&l.setOption(g.value)},b=()=>{s.value=!s.value,s.value?l.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:0,end:100},{type:"inside",xAxisIndex:[0],start:0,end:100}]}):l.setOption({dataZoom:[]},{replaceMerge:["dataZoom"]})};be(()=>t.chartData,()=>{l&&l.setOption(g.value)}),be(t.isEmpty,$=>{$||w()}),be(y,$=>{$||w()});const S=()=>{c.value=Te.isDark(),xe(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),xe(()=>{w(),window.addEventListener("resize",v)})}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),l&&(window.removeEventListener("resize",v),l.dispose(),l=null)}),($,D)=>{const F=C("el-tooltip"),B=C("el-skeleton");return r(),h("div",Nse,[n(Se,null,{default:d(()=>[n(Ve,{border_bottom:"",title_size:"small"},oa({title:d(()=>[o("div",Kse,[o("h5",Gse,m(A(u)("Average Order Items ")),1),n(F,{"popper-class":"fct-tooltip",content:A(u)("Average Order Items grouped by date period."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 cursor-pointer"})]),_:1},8,["content"])])]),_:2},[e.isEmpty?void 0:{name:"action",fn:d(()=>[o("div",zse,[n(at,{tag:"button",size:"x-small",title:$.$t("Zoom Chart"),onClick:b,class:de(s.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[y.value?(r(),E(B,{key:0,animated:"",rows:4,class:"px-5 pt-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-report-average-order-items-chart",ref_key:"chartRef",ref:a},null,512)),e.isEmpty?x("",!0):(r(),h("div",jse,[o("div",qse,[o("div",Yse,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Wse,m($.$t("Average Order Items")),1)]),o("div",Jse,[o("span",Xse,m($.$t("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])]))],64))]),_:1})]),_:1})])}}},ene={class:"fct-order-report-page"},tne={__name:"OrderReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=i=>{i&&(Mt.getOrderChartData({params:{...i.params,groupKey:"default"}}),Mt.getNewVsReturningCustomer(i),Mt.getReportByDayAndHour(i),Mt.getItemCountDistribution(i),Mt.getOrderCompletionTime(i),Mt.getOrderValueDistribution(i))},s=i=>{const c=a.applicableFilters;c&&Mt.getOrderChartData({params:{...c.params,groupKey:i}})};return Ie(()=>{a.addListener("order-report",l),l(a.applicableFilters),a.value}),Bt(()=>{a.removeListener("order-report",l,!1),a.value}),(i,c)=>{const p=C("el-col"),f=C("el-row");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",ene,[n(Nae,{orderReport:A(Mt),reportFilter:A(a)},null,8,["orderReport","reportFilter"]),n(ale,{chartData:A(Mt).data.orderChartData,reportFilter:A(a),onFetchChartData:s,"is-empty":!A(Mt).data.summary.gross_sale},null,8,["chartData","reportFilter","is-empty"]),n(rle,{orderReport:A(Mt)},null,8,["orderReport"]),A(Mt).data.summary.tax_total||A(Mt).data.summary.shipping_total?(r(),E(ple,{key:0,orderReport:A(Mt),reportFilter:A(a)},null,8,["orderReport","reportFilter"])):x("",!0),n(wle,{tableData:A(Mt).data.newVsReturning,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Ele,{tableData:A(Mt).data.orderByGroup,reportFilter:A(a)},null,8,["tableData","reportFilter"]),n(Kae,{chartData:A(Mt).data.orderByDayAndHour},null,8,["chartData"]),n(f,{gutter:30},{default:d(()=>[n(p,{lg:12},{default:d(()=>[n(Ple,{reportFilter:A(a),ref:"chartRef",chartData:A(Mt).data.grossSaleByDay},null,8,["reportFilter","chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(dse,{chartData:A(Mt).data.grossSaleByHour},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Xle,{ref:"chartRef",chartData:A(Mt).data.itemCountDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Use,{chartData:A(Mt).data.orderValueDistribution},null,8,["chartData"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Hse,{chartData:A(Mt).data.orderChartData,"is-empty":!A(Mt).data.summary.gross_sale},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(Zse,{chartData:A(Mt).data.orderChartData,"is-empty":!A(Mt).data.summary.order_count},null,8,["chartData","is-empty"])]),_:1}),n(p,{lg:12},{default:d(()=>[n(yse,{chartData:A(Mt).data.orderCompletionTime},null,8,["chartData"])]),_:1})]),_:1})])]),_:1})}}},ane={class:"fct-gross-sale-vs-net-revenue-wrap"},lne={class:"flex items-center gap-2"},sne={class:"fct-card-header-title is-small"},nne={class:"fct-chart-select"},one={class:"fct-btn-group sm"},ine={class:"chart-action-wrap"},rne={class:"chart-change-wrap"},dne={class:"chart-change"},une={class:"text"},cne={class:"chart-change"},Ane={class:"text"},pne={__name:"RefundLineChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!1},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-chart-data"],setup(e,{emit:t}){const a=e,l=Te.colors.report,s=T(Te.isDark()),i=T(null),c=T("default"),p=T(ba.getChartType("refund","refund_chart")||"line"),f=T(!1);K(()=>a.reportFilter.currentCurrencySign);const{groupKeys:_}=fn(a.reportFilter,c),g=t,y=()=>{g("fetch-chart-data",c.value)},v=K(()=>a.reportFilter.data.compareType!=="no_comparison"),w=(V,I,M,O,L,H=!0)=>({name:V,type:I,barMaxWidth:30,data:M,smooth:!1,color:O,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:O,borderRadius:[4,4,0,0]},yAxisIndex:L,emphasis:{scale:2,itemStyle:{color:ja(O)},lineStyle:{color:O},areaStyle:{opacity:.3,color:O}},animation:H,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),k=K(()=>{let V=[{name:u("Refunded Amount"),key:"refunded_amount",type:"line",color:s.value?l.blue_dark_mode:l.blue,yAxisIndex:0,data:a.chartData.map(I=>I.refunded_amount),animation:!1},{name:u("Total Refunds"),key:"refund_count",type:"bar",color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,yAxisIndex:1,data:a.chartData.map(I=>I.refund_count),animation:!1}];return v.value&&V.unshift({name:u("Previous Refunded Amount"),key:"refunded_amount_compare",type:"line",color:s.value?l.purple_dark_mode:l.purple,yAxisIndex:0,data:a.compareData.map(I=>I.refunded_amount),animation:!1},{name:u("Previous Total Refunds"),key:"refund_count_compare",type:"bar",color:s.value?l.dark_cyan_blue_16:l.light_gray,yAxisIndex:1,data:a.compareData.map(I=>I.refund_count),animation:!0}),V.map(I=>w(I.name,I.type,I.data,I.color,I.yAxisIndex,I.animation))});let b=null;const S=T(!0),$=()=>{b&&(b.dispose(),b=null),xe(()=>{i.value&&(b=na(i.value),B(),b.on("legendselectchanged",V=>{S.value=V.selected["Total Refunds"]||V.selected["Previous Total Refunds"]}))})},D=K(()=>{const V=Ms(a.reportFilter.data.dateRange);return u("This report looks at refunds made for successful orders created ")+V}),F=K(()=>pl(a.chartData.length)),B=()=>{if(!b)return;const V=Ol(a.chartData),I={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:Ql(s.value,l.dark_cyan_blue_16,l.light_gray_blue),confine:!0,position:wl,formatter:M=>{let O=M[0].name;return M.forEach(L=>{const H=[0,2].includes(L.seriesIndex)?za(L.value*100):L.value,j=s.value?"#ffffff":"#565865";O+=`<div> | |
| 206 | + ${L.marker} | |
| 207 | + <span style="color: ${j};">${L.seriesName}</span> | |
| 208 | + <span style="float: right; margin-left: 20px; color: ${j};"> | |
| 209 | + ${H} | |
| 211 | 210 | </span> |
| 212 | - </div>`}),D}},xAxis:{type:"category",data:T,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:U.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:E=>`${Je.scaled(E)}`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",axisLabel:{color:s.value?"#253241":"#D6DAE1",fontSize:12},splitLine:{show:!1}}],series:b.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};w.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},M=()=>{m.value=!m.value,m.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):S()};Ce([()=>a.chartData,p],()=>{Se(S)},{deep:!0}),Ce(()=>Ml.data.refund,()=>{Se(()=>{S()})},{deep:!0}),Ce(()=>a.isEmpty,T=>{T||F()}),Ce(()=>a.loading,T=>{T||F()}),Ce(x,()=>{if(!w)return;const Q=w.getOption().series.map(E=>E.type==="line"?{...E,areaStyle:x.value?void 0:{opacity:.3}}:E);Se(()=>{w.setOption({series:Q})})});const I=()=>{s.value=Te.isDark(),Se(()=>{S()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1),window.removeEventListener("fluentCartCurrencyChange",I,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",I),window.addEventListener("fluentCartCurrencyChange",I),Se(F)}),(T,Q)=>{const E=B("el-tooltip"),D=B("el-option"),H=B("el-select"),P=B("el-skeleton");return r(),h("div",ile,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",rle,[o("h5",dle,f(A(u)("Refunds Chart")),1),n(E,{"popper-class":"fct-tooltip",content:L.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",ule,[n(H,{class:"el-select--x-small",modelValue:c.value,"onUpdate:modelValue":Q[0]||(Q[0]=G=>c.value=G),onChange:y},{default:d(()=>[(r(),h(O,null,ae(_,G=>n(D,{key:G.value,label:T.$t(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",cle,[n(Xe,{tag:"button",size:"small",title:T.$t("Zoom Chart"),onClick:M,class:de(m.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),$(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[e.isEmpty?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",Ale,[o("div",ple,[o("div",fle,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",mle,f(T.$t("Data")),1)]),o("div",hle,[o("span",_le,f(T.$t("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class gle extends sl{constructor(){super(...arguments);Oe(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,l,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!1)})}getRefundChartData(a={}){return this.makeRequest("refund-chart",a,null,"chartData")}getWeeksBetweenRefund(a={}){return this.makeRequest("weeks-between-refund",a,"data","weeksBetweenRefund")}getRefundSummary(a={}){return this.makeRequest("refund-summary",a,"summaryData","summaryData")}getRefundDataByGroup(a={}){return this.makeRequest("refund-data-by-group",a,"data","refundData")}getRefundReportFluctuations(a={}){return this.makeRequest("refund-report-fluctuations",a,"data","fluctuations")}}const ba=gle.init(),yle={key:1,class:"fct-report-order-summary summary-col-4"},ble={class:"summary-item-inner"},wle={class:"value"},Cle={class:"inner-value"},Ble=["innerHTML"],kle={class:"title"},xle={__name:"Summary",setup(e){const t=K(()=>[{title:u("Refunds"),value:ba.data.summary.refund_count,key:"refund_count",percentage:ba.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:ba.data.summary.refunded_amount,key:"refunded_amount",percentage:ba.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:ba.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:ba.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:ba.data.summary.refund_rate,key:"refund_rate",percentage:ba.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=K(()=>ba.data.isBusy.chartData),l=s=>{const i=s.no_currency?ia(s.value):Je.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const c=B("el-tooltip");return a.value?(r(),$(Ll,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",yle,[(r(!0),h(O,null,ae(t.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",ble,[o("div",wle,[o("div",Cle,[o("span",{innerHTML:l(p)},null,8,Ble)]),n(ml,{fluctuation:p.percentage,amount:A(ba).data.previousSummary[p.key],"is-liability":!0,"has-currency":!p.no_currency,"is-percentage":p.is_percentage},null,8,["fluctuation","amount","has-currency","is-percentage"])]),o("div",kle,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},Sle={class:"fct-report-refund-weeks-between-an-order-wrap"},Fle={class:"fct-btn-group sm"},$le={class:"chart-action-wrap"},Ele={class:"chart-change-wrap"},Ule={class:"chart-change"},Ile={class:"text"},Qle={class:"chart-change"},Dle={class:"text"},Vle={__name:"WeeksBetweenRefundChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=V(null),l=V("bar");let s=null;const i=Te.colors.report,c=V(Te.isDark()),p=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),m=K(()=>[{name:u("Refund Count"),type:l.value,data:t.chartData.map(b=>b.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:za(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=K(()=>dl(t.chartData.length)),g=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(b=>b.weekBetween),axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:b=>b>1?`${b} weeks`:`${b} week`},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},series:m.value}),y=()=>{s&&(s.dispose(),s=null),Se(()=>{a.value&&(s=Jt(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};Ce(()=>t.chartData,()=>{s&&s.setOption(g())}),Ce(()=>t.isEmpty,b=>{b||y()}),Ce(()=>t.loading,b=>{b||y()});const v=()=>{c.value=Te.isDark(),Se(()=>{C()})};Ct(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const C=b=>{s&&s.setOption(g(),!0)};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",v),Se(()=>{y()})}),(b,w)=>{const x=B("el-skeleton");return r(),h("div",Sle,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},ta({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Fle,[n(ka,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),$(x,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[e.isEmpty?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),o("div",$le,[o("div",Ele,[o("div",Ule,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Ile,f(A(u)("Refund Count")),1)]),o("div",Qle,[o("span",Dle,f(A(u)("Weeks")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Tle={class:"fct-btn-group sm w-[240px] gap-2"},Mle={key:0},Lle={key:1},Rle={class:"inline-flex"},Ole={class:"inline-flex"},Hle={__name:"RefundTable",props:{tableData:{type:Array,required:!0},currencySign:{type:String},loading:{type:Boolean,default:!0}},emits:["group-data"],setup(e,{emit:t}){const a=t;V([]);const l=V([{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}]),s=V("billing_country"),i=K(()=>{var p;return((p=l.value.find(m=>m.value===s.value))==null?void 0:p.label)||""}),c=()=>{a("group-data",s.value)};return(p,m)=>{const _=B("el-option"),g=B("el-select"),y=B("el-skeleton"),v=B("el-table-column"),C=B("el-table");return r(),$(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Refunds Grouped By"),title_size:"small"},ta({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o("div",Tle,[n(g,{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=b=>s.value=b),onChange:c,class:"el-select--x-small",placeholder:A(u)("Select Group")},{default:d(()=>[(r(!0),h(O,null,ae(l.value,b=>(r(),$(_,{key:b.value,label:A(u)(b.label),value:b.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(On,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),$(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),$(C,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[n(v,{prop:s.value,label:A(u)(i.value),"min-width":"150"},{default:d(b=>[s.value!=="payment_method"?(r(),h("span",Mle,f(A(Dn)(b.row[s.value])),1)):(r(),h("span",Lle,f(b.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:A(u)("Refunds"),"min-width":"150"},{default:d(b=>m[1]||(m[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:A(u)("Refunded Amount"),"min-width":"150"},{default:d(b=>[o("div",Rle,f(A(Je).scaled(b.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),n(v,{prop:"average_refund",label:A(u)("Average Refund"),"min-width":"150"},{default:d(b=>[o("div",Ole,f(A(Je).scaled(b.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Ple={class:"fct-refund-report-page"},Nle={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{ba.getRefundChartData({params:{...p.params,groupKey:"default"}}),ba.getWeeksBetweenRefund(p),s(p)},s=p=>{ba.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const m=a.applicableFilters;ba.getRefundDataByGroup({params:{...m.params,groupKey:p}})},c=p=>{const m=a.applicableFilters;m&&ba.getRefundChartData({params:{...m.params,groupKey:p}})};return Qe(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),Ct(()=>{a.removeListener("refund-report")}),(p,m)=>(r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",Ple,[n(xle),n(vle,{ref:"refundChart",chartData:A(ba).data.chartData,compareData:A(ba).data.previousMetrics,reportFilter:A(a),onFetchChartData:c,"is-empty":!A(ba).data.summary.refund_count,loading:A(ba).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(Vle,{chartData:A(ba).data.weeksBetweenRefund,"is-empty":!A(ba).data.weeksBetweenRefund.length,loading:A(ba).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(Hle,{tableData:A(ba).data.refundData,currencySign:A(a).currentCurrencySign,onGroupData:i,loading:A(ba).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},Kle={class:"fct-gross-sale-vs-net-revenue-wrap"},Gle={class:"fct-chart-select"},jle={class:"fct-btn-group sm"},zle={class:"chart-action-wrap"},qle={class:"chart-change-wrap"},Yle={class:"chart-change"},Wle={class:"text"},Xle={class:"chart-change"},Jle={class:"text"},Zle={__name:"RetentionChart",props:{chartData:{type:Object,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-custom-chart-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(va.getChartType("subscription","retention_chart")||"line"),i=V(!1),c=V(null);V([]);const p=Te.colors.report,m=V(Te.isDark()),_=(S,M,I,T)=>({name:S,type:M,barMaxWidth:30,data:I,smooth:!1,color:T,lineStyle:{width:3},areaStyle:{opacity:.3,color:T},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:T,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(T)},lineStyle:{color:T},areaStyle:{opacity:.3,color:T}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=K(()=>Object.keys(a.chartData).map(M=>M.startsWith("day_")?u("%s Days",M.replace("day_","")):M==="more_than_year"?u("More than Year"):M)),y=K(()=>Object.keys(a.chartData).map(M=>a.chartData[M]||0)),v=K(()=>[_(u("Customers"),s.value,y.value,m.value?p.dark_cyan_blue_16:p.light_gray)]);let C=null;const b=()=>{C&&(C.dispose(),C=null),Se(()=>{l.value&&(C=Jt(l.value),w())})},w=()=>{if(!C)return;const S={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:m.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:m.value?"#253241":"#ffffff",borderColor:m.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:m.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:m.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:m.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:m.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:m.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};C.setOption(S,{notMerge:!0,replaceMerge:["series"]})},x=S=>{va.onChange("subscription","retention_chart",S),s.value!==S&&(i.value=!1,s.value=S,w())},F=t,L=()=>{F("fetch-custom-chart-data",c.value)};Ce(()=>a.chartData,()=>{Se(w)},{deep:!0}),Ce(()=>Ml.data.refund,()=>{Se(w)},{deep:!0}),Ce(()=>a.isEmpty,S=>{S||b()}),Ce(()=>a.loading,S=>{S||b()});const U=()=>{m.value=Te.isDark(),Se(()=>{w()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",U,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",U),Se(b)}),(S,M)=>{const I=B("el-input"),T=B("el-skeleton");return r(),h("div",Kle,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title:A(u)("Retention Chart"),title_size:"small",border_bottom:""},ta({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Gle,[n(I,{type:"text",modelValue:c.value,"onUpdate:modelValue":M[0]||(M[0]=Q=>c.value=Q),placeholder:A(u)("Enter custom days"),class:"el-input--x-small",onKeyup:$a(L,["enter"])},null,8,["modelValue","placeholder"])]),o("div",jle,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:x},null,8,["activeType"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),$(T,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",zle,[o("div",qle,[o("div",Yle,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Wle,f(A(u)("Data")),1)]),o("div",Xle,[o("span",Jle,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},ese={class:"fct-revenue-line-chart-wrap"},tse={class:"flex items-center gap-2"},ase={class:"fct-card-header-title is-small"},lse={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},sse={class:"chart-action-wrap"},nse={class:"chart-change-wrap"},ose={class:"chart-change"},ise={class:"text"},rse={class:"chart-change"},dse={class:"text"},use={__name:"SubscriptionChartNew",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(va.getChartType("subscription","subscription_chart")||"line"),i=V(!1),c=Te.colors.report,p=V(Te.isDark()),m=(T,Q,E,D,H)=>({name:T,type:Q,barMaxWidth:30,yAxisIndex:E,data:D,smooth:!1,color:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:H},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:H,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=V(a.appliedGroupKey);Ce(()=>a.appliedGroupKey,T=>{_.value=T});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),b=K(()=>{let T=[{name:u("Current Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(Q=>Q.count)}];return C.value&&T.unshift({name:u("Compare Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(Q=>({value:Q.count,date:Q.group}))}),T.map(Q=>m(Q.name,Q.type,0,Q.data,Q.color))});let w=null;const x=()=>{w&&(w.dispose(),w=null),Se(()=>{l.value&&(w=Jt(l.value),U())})},F=K(()=>{const T=Es(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+T}),L=K(()=>dl(a.chartData.length)),U=()=>{if(!w)return;const T=Ql(a.chartData),Q={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:E=>{let D="";return E.forEach(function(H,P){const G=typeof H.data=="object"&&H.data!==null,J=G?Us(H.data.date):H.name,oe=G?H.data.value:H.value,Z=E.length>1&&P===0;Z&&(D+='<div style="margin-bottom: 10px">'),D+=`<div>${J}</div>`,D+=`<div> | |
| 213 | - <span style="color:${H.color}">●</span> | |
| 211 | + </div>`}),O}},xAxis:{type:"category",data:V,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:F.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:M=>`${ft.scaled(M)}`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",axisLabel:{color:s.value?"#253241":"#D6DAE1",fontSize:12},splitLine:{show:!1}}],series:k.value,animation:!0,animationThreshold:2e3,animationDurationUpdate:300,animationEasingUpdate:"cubicInOut"};b.setOption(I,{notMerge:!0,replaceMerge:["series"]})},U=()=>{f.value=!f.value,f.value?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):B()};be([()=>a.chartData,p],()=>{xe(B)},{deep:!0}),be(()=>Nl.data.refund,()=>{xe(()=>{B()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||$()}),be(()=>a.loading,V=>{V||$()}),be(S,()=>{if(!b)return;const I=b.getOption().series.map(M=>M.type==="line"?{...M,areaStyle:S.value?void 0:{opacity:.3}}:M);xe(()=>{b.setOption({series:I})})});const Q=()=>{s.value=Te.isDark(),xe(()=>{B()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1),window.removeEventListener("fluentCartCurrencyChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),window.addEventListener("fluentCartCurrencyChange",Q),xe($)}),(V,I)=>{const M=C("el-tooltip"),O=C("el-option"),L=C("el-select"),H=C("el-skeleton");return r(),h("div",ane,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",lne,[o("h5",sne,m(A(u)("Refunds Chart")),1),n(M,{"popper-class":"fct-tooltip",content:D.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",nne,[n(L,{class:"el-select--x-small",modelValue:c.value,"onUpdate:modelValue":I[0]||(I[0]=j=>c.value=j),onChange:y},{default:d(()=>[(r(!0),h(P,null,te(A(_),j=>(r(),E(O,{key:j.value,label:V.$t(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",one,[n(at,{tag:"button",size:"small",title:V.$t("Zoom Chart"),onClick:U,class:de(f.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:i},null,512)),o("div",ine,[o("div",rne,[o("div",dne,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",une,m(V.$t("Data")),1)]),o("div",cne,[o("span",Ane,m(V.$t("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class fne extends tl{constructor(){super(...arguments);Pe(this,"data",{refundData:[],previousMetrics:[],summary:{},previousSummary:{},fluctuations:{},chartData:[],weeksBetweenRefund:[],isBusy:{chartData:!0,weeksBetweenRefund:!0,refundData:!0}})}get controllerKey(){return"RefundReportController"}makeRequest(a,l,s,i){i&&(this.data.isBusy[i]=!0),typeof l!="object"&&(l={});const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{s&&(this.data.isBusy[s]=!1)})}getRefundChartData(a={}){return this.makeRequest("refund-chart",a,null,"chartData")}getWeeksBetweenRefund(a={}){return this.makeRequest("weeks-between-refund",a,"data","weeksBetweenRefund")}getRefundSummary(a={}){return this.makeRequest("refund-summary",a,"summaryData","summaryData")}getRefundDataByGroup(a={}){return this.makeRequest("refund-data-by-group",a,"data","refundData")}getRefundReportFluctuations(a={}){return this.makeRequest("refund-report-fluctuations",a,"data","fluctuations")}}const ka=fne.init(),mne={key:1,class:"fct-report-order-summary summary-col-4"},hne={class:"summary-item-inner"},_ne={class:"value"},vne={class:"inner-value"},gne=["innerHTML"],yne={class:"title"},bne={__name:"Summary",setup(e){const t=K(()=>[{title:u("Refunds"),value:ka.data.summary.refund_count,key:"refund_count",percentage:ka.data.fluctuations.refund_count,info:u("Total refunds count including partially refunds."),no_currency:!0},{title:u("Refunded"),value:ka.data.summary.refunded_amount,key:"refunded_amount",percentage:ka.data.fluctuations.refunded_amount,info:u("Total Refunded Amount")},{title:u("Avgerage Amount"),value:ka.data.summary.average_refunded_amount,key:"average_refunded_amount",percentage:ka.data.fluctuations.average_refunded_amount,info:u("Total Refunded Amount / Total Refund count")},{title:u("Refund Rate"),value:ka.data.summary.refund_rate,key:"refund_rate",percentage:ka.data.fluctuations.refund_rate,info:u("Total Refunded Amount / Total Order Amount"),no_currency:!0,is_percentage:!0}]),a=K(()=>ka.data.isBusy.chartData),l=s=>{const i=s.no_currency?ua(s.value):ft.scaled(s.value);return s.is_percentage?`${i}%`:i};return(s,i)=>{const c=C("el-tooltip");return a.value?(r(),E(Kl,{key:0,loading:a.value,count:4},null,8,["loading"])):(r(),h("div",mne,[(r(!0),h(P,null,te(t.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",hne,[o("div",_ne,[o("div",vne,[o("span",{innerHTML:l(p)},null,8,gne)]),n(vl,{fluctuation:p.percentage,amount:A(ka).data.previousSummary[p.key],"is-liability":!0,"has-currency":!p.no_currency,"is-percentage":p.is_percentage},null,8,["fluctuation","amount","has-currency","is-percentage"])]),o("div",yne,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},wne={class:"fct-report-refund-weeks-between-an-order-wrap"},Cne={class:"fct-btn-group sm"},kne={class:"chart-action-wrap"},Bne={class:"chart-change-wrap"},xne={class:"chart-change"},Sne={class:"text"},Fne={class:"chart-change"},$ne={class:"text"},Ene={__name:"WeeksBetweenRefundChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=T(null),l=T("bar");let s=null;const i=Te.colors.report,c=T(Te.isDark()),p=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),f=K(()=>[{name:u("Refund Count"),type:l.value,data:t.chartData.map(k=>k.occurrence),smooth:!0,color:p.value,showSymbol:!1,itemStyle:{borderRadius:[4,4,0,0]},emphasis:{itemStyle:{color:ja(p.value)}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]),_=K(()=>pl(t.chartData.length)),g=()=>({title:{text:t.chartTitle,left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:t.chartData.map(k=>k.weekBetween),axisLabel:{color:c.value?"#ffffff":"#000000",fontSize:12,interval:_.value.interval,formatter:k=>k>1?`${k} weeks`:`${k} week`},axisLine:{lineStyle:{type:"dashed",color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{formatter:"{value}",color:c.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},series:f.value}),y=()=>{s&&(s.dispose(),s=null),xe(()=>{a.value&&(s=na(a.value),s.setOption(g()),window.addEventListener("resize",()=>{s.resize()}))})};be(()=>t.chartData,()=>{s&&s.setOption(g())}),be(()=>t.isEmpty,k=>{k||y()}),be(()=>t.loading,k=>{k||y()});const v=()=>{c.value=Te.isDark(),xe(()=>{w()})};Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)});const w=k=>{s&&s.setOption(g(),!0)};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",v),xe(()=>{y()})}),(k,b)=>{const S=C("el-skeleton");return r(),h("div",wne,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Weeks between an order's created date and refund date"),title_size:"small",border_bottom:""},oa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Cne,[n(Sa,{targetRef:a.value,size:"x-small"},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(S,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-refund-weeks-between-an-order-chart",ref_key:"chartRef",ref:a},null,512)),o("div",kne,[o("div",Bne,[o("div",xne,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Sne,m(A(u)("Refund Count")),1)]),o("div",Fne,[o("span",$ne,m(A(u)("Weeks")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Une={class:"fct-btn-group sm w-[240px] gap-2"},Ine={key:0},Qne={key:1},Dne={class:"inline-flex"},Vne={class:"inline-flex"},Tne={__name:"RefundTable",props:{tableData:{type:Array,required:!0},currencySign:{type:String},loading:{type:Boolean,default:!0}},emits:["group-data"],setup(e,{emit:t}){const a=t;T([]);const l=T([{label:u("Billing Country"),value:"billing_country"},{label:u("Shipping Country"),value:"shipping_country"},{label:u("Payment Method"),value:"payment_method"}]),s=T("billing_country"),i=K(()=>{var p;return((p=l.value.find(f=>f.value===s.value))==null?void 0:p.label)||""}),c=()=>{a("group-data",s.value)};return(p,f)=>{const _=C("el-option"),g=C("el-select"),y=C("el-skeleton"),v=C("el-table-column"),w=C("el-table");return r(),E(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Refunds Grouped By"),title_size:"small"},oa({_:2},[e.loading?void 0:{name:"action",fn:d(()=>[o("div",Une,[n(g,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=k=>s.value=k),onChange:c,class:"el-select--x-small",placeholder:A(u)("Select Group")},{default:d(()=>[(r(!0),h(P,null,te(l.value,k=>(r(),E(_,{key:k.value,label:A(u)(k.label),value:k.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(jn,{data:e.tableData,filename:"refund.csv",class:"!ml-0"},null,8,["data"])])]),key:"0"}]),1032,["title"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[e.loading?(r(),E(y,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(w,{key:1,data:e.tableData,height:"330"},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!")},null,8,["text"])]),default:d(()=>[n(v,{prop:s.value,label:A(u)(i.value),"min-width":"150"},{default:d(k=>[s.value!=="payment_method"?(r(),h("span",Ine,m(A(Qs)(k.row[s.value])),1)):(r(),h("span",Qne,m(k.row[s.value]),1))]),_:1},8,["prop","label"]),n(v,{prop:"refunds",label:A(u)("Refunds"),"min-width":"150"},{default:d(k=>f[1]||(f[1]=[])),_:1},8,["label"]),n(v,{prop:"refunded_amount",label:A(u)("Refunded Amount"),"min-width":"150"},{default:d(k=>[o("div",Dne,m(A(ft).scaled(k.row.totalRefundedAmount.total)),1)]),_:1},8,["label"]),n(v,{prop:"average_refund",label:A(u)("Average Refund"),"min-width":"150"},{default:d(k=>[o("div",Vne,m(A(ft).scaled(k.row.totalRefundedAmount.average)),1)]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})}}},Mne={class:"fct-refund-report-page"},Lne={__name:"RefundReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=p=>{ka.getRefundChartData({params:{...p.params,groupKey:"default"}}),ka.getWeeksBetweenRefund(p),s(p)},s=p=>{ka.getRefundDataByGroup({params:{...p.params,groupKey:"billing_country"}})},i=p=>{const f=a.applicableFilters;ka.getRefundDataByGroup({params:{...f.params,groupKey:p}})},c=p=>{const f=a.applicableFilters;f&&ka.getRefundChartData({params:{...f.params,groupKey:p}})};return Ie(()=>{a.addListener("refund-report",l),l(a.applicableFilters)}),Bt(()=>{a.removeListener("refund-report")}),(p,f)=>(r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",Mne,[n(bne),n(pne,{ref:"refundChart",chartData:A(ka).data.chartData,compareData:A(ka).data.previousMetrics,reportFilter:A(a),onFetchChartData:c,"is-empty":!A(ka).data.summary.refund_count,loading:A(ka).data.isBusy.chartData},null,8,["chartData","compareData","reportFilter","is-empty","loading"]),n(Ene,{chartData:A(ka).data.weeksBetweenRefund,"is-empty":!A(ka).data.weeksBetweenRefund.length,loading:A(ka).data.isBusy.weeksBetweenRefund},null,8,["chartData","is-empty","loading"]),n(Tne,{tableData:A(ka).data.refundData,currencySign:A(a).currentCurrencySign,onGroupData:i,loading:A(ka).data.isBusy.refundData},null,8,["tableData","currencySign","loading"])])]),_:1}))}},Rne={class:"fct-gross-sale-vs-net-revenue-wrap"},One={class:"fct-chart-select"},Pne={class:"fct-btn-group sm"},Hne={class:"chart-action-wrap"},Nne={class:"chart-change-wrap"},Kne={class:"chart-change"},Gne={class:"text"},zne={class:"chart-change"},jne={class:"text"},qne={__name:"RetentionChart",props:{chartData:{type:Object,required:!0},reportFilter:{type:Object},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["fetch-custom-chart-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(ba.getChartType("subscription","retention_chart")||"line"),i=T(!1),c=T(null);T([]);const p=Te.colors.report,f=T(Te.isDark()),_=(B,U,Q,V)=>({name:B,type:U,barMaxWidth:30,data:Q,smooth:!1,color:V,lineStyle:{width:3},areaStyle:{opacity:.3,color:V},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:V,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(V)},lineStyle:{color:V},areaStyle:{opacity:.3,color:V}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),g=K(()=>Object.keys(a.chartData).map(U=>U.startsWith("day_")?u("%s Days",U.replace("day_","")):U==="more_than_year"?u("More than Year"):U)),y=K(()=>Object.keys(a.chartData).map(U=>a.chartData[U]||0)),v=K(()=>[_(u("Customers"),s.value,y.value,f.value?p.dark_cyan_blue_16:p.light_gray)]);let w=null;const k=()=>{w&&(w.dispose(),w=null),xe(()=>{l.value&&(w=na(l.value),b())})},b=()=>{if(!w)return;const B={title:{text:a.chartTitle??"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:f.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:f.value?"#253241":"#ffffff",borderColor:f.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:f.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:f.value?p.dark_cyan_blue_16:p.light_gray_blue}}},xAxis:{type:"category",data:g.value,axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:f.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:f.value?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:f.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value};w.setOption(B,{notMerge:!0,replaceMerge:["series"]})},S=B=>{ba.onChange("subscription","retention_chart",B),s.value!==B&&(i.value=!1,s.value=B,b())},$=t,D=()=>{$("fetch-custom-chart-data",c.value)};be(()=>a.chartData,()=>{xe(b)},{deep:!0}),be(()=>Nl.data.refund,()=>{xe(b)},{deep:!0}),be(()=>a.isEmpty,B=>{B||k()}),be(()=>a.loading,B=>{B||k()});const F=()=>{f.value=Te.isDark(),xe(()=>{b()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",F,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",F),xe(k)}),(B,U)=>{const Q=C("el-input"),V=C("el-skeleton");return r(),h("div",Rne,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title:A(u)("Retention Chart"),title_size:"small",border_bottom:""},oa({_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",One,[n(Q,{type:"text",modelValue:c.value,"onUpdate:modelValue":U[0]||(U[0]=I=>c.value=I),placeholder:A(u)("Enter custom days"),class:"el-input--x-small",onKeyup:xa(D,["enter"])},null,8,["modelValue","placeholder"])]),o("div",Pne,[n(Gl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:S},null,8,["activeType"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1032,["title"]),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(V,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-refund-line-chart",ref_key:"chartRef",ref:l},null,512),o("div",Hne,[o("div",Nne,[o("div",Kne,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Gne,m(A(u)("Data")),1)]),o("div",zne,[o("span",jne,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Yne={class:"fct-revenue-line-chart-wrap"},Wne={class:"flex items-center gap-2"},Jne={class:"fct-card-header-title is-small"},Xne={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},Zne={class:"chart-action-wrap"},eoe={class:"chart-change-wrap"},toe={class:"chart-change"},aoe={class:"text"},loe={class:"chart-change"},soe={class:"text"},noe={__name:"SubscriptionChartNew",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(ba.getChartType("subscription","subscription_chart")||"line"),i=T(!1),c=Te.colors.report,p=T(Te.isDark()),f=(V,I,M,O,L)=>({name:V,type:I,barMaxWidth:30,yAxisIndex:M,data:O,smooth:!1,color:L,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,V=>{_.value=V});const{groupKeys:g}=fn(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let V=[{name:u("Current Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(I=>I.count)}];return w.value&&V.unshift({name:u("Compare Range"),key:"count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(I=>({value:I.count,date:I.group}))}),V.map(I=>f(I.name,I.type,0,I.data,I.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=na(l.value),F())})},$=K(()=>{const V=Ms(a.reportFilter.data.dateRange);return u("This report looks at the subscription you received ")+V}),D=K(()=>pl(a.chartData.length)),F=()=>{if(!b)return;const V=Ol(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:M=>{let O="";return M.forEach(function(L,H){const j=typeof L.data=="object"&&L.data!==null,W=j?Ls(L.data.date):L.name,G=j?L.data.value:L.value,Z=M.length>1&&H===0;Z&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${W}</div>`,O+=`<div> | |
| 212 | + <span style="color:${L.color}">●</span> | |
| 214 | 213 | <span>${u("Subscription")}</span> |
| 215 | 214 | <span style="float: right; margin-left: 20px;"> |
| 216 | - ${ia(oe)} | |
| 215 | + ${ua(G)} | |
| 217 | 216 | </span> |
| 218 | - </div>`,Z&&(D+="</div>")}),D}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:L.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):U()},M=T=>{va.onChange("subscription","subscription_chart",T),s.value!==T&&(i.value=!1,s.value=T,U())};Ce([()=>a.chartData,_],()=>{Se(U)},{deep:!0}),Ce(()=>Ml.data.revenue,()=>{Se(()=>{U()})},{deep:!0}),Ce(()=>a.isEmpty,T=>{T||x()}),Ce(()=>a.loading,T=>{T||x()});const I=()=>{p.value=Te.isDark(),Se(()=>{U()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",I),Se(()=>{x()})}),(T,Q)=>{const E=B("el-tooltip"),D=B("el-option"),H=B("el-select"),P=B("el-skeleton");return r(),h("div",ese,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",tse,[o("h4",ase,f(A(u)("Subscription Chart")),1),n(E,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",lse,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=G=>_.value=G),onChange:v},{default:d(()=>[(r(),h(O,null,ae(g,G=>n(D,{key:G.value,label:A(u)(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:M},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:de(i.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),$(P,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[e.isEmpty?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),o("div",sse,[o("div",nse,[o("div",ose,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",ise,f(A(u)("Data")),1)]),o("div",rse,[o("span",dse,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class cse extends sl{constructor(){super(...arguments);Oe(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:u("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:u("Net New MRR"),isCurrency:!0,value:0},isBusy:{overviews:!1,fluctuations:!1,chartData:!0,productList:!1,customerList:!1,revenueChurnRateNet:!0,netNewMrr:!0},currentMetrics:[],previousMetrics:[]})}get controllerKey(){return"SubscriptionReportController"}get revenueChurnRateNet(){return this.data.revenueChurnRateNet}get netNewMrr(){return this.data.netNewMrr}makeRequest(a,l,s,i){typeof l!="object"&&(l={}),this.data.isBusy[i]=!0;const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getSubscriptionReportFluctuations(a={}){return this.makeRequest("getSubscriptionReportFluctuations",a,"fluctuations","fluctuations")}getSubscriptionReportFluctuations(a={}){return this.makeRequest("get-subscription-fluctuations",a,"fluctuations","fluctuations")}getRetentionChart(a={}){return this.makeRequest("retention-chart",a,"chartData","chartData")}listSubscriptionsByProduct(a={}){return this.makeRequest("list-subscription-by-product",a,"productList","productList")}listSubscriptionsByCustomer(a={}){return this.makeRequest("list-subscription-by-customer",a,"customerList","customerList")}getSubscriptionOverview(a={}){return this.makeRequest("get-subscription-overview",a,"overviews","overviews").then(l=>{this.getRevenueChurnRateNet(a),this.getNetNewMrr(a)}).finally(()=>{})}getRevenueChurnRateNet(a={}){this.data.isBusy.revenueChurnRateNet=!0,ce.get("reports/get-subscription-overview/revenue-churn-rate-net",a).then(l=>{this.data.revenueChurnRateNet=l.data}).finally(()=>{this.data.isBusy.revenueChurnRateNet=!1})}getNetNewMrr(a={}){this.data.isBusy.netNewMrr=!0,ce.get("reports/get-subscription-overview/net-new-mrr",a).then(l=>{this.data.netNewMrr=l.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const Os=cse.init(),Ase={key:1,class:"fct-report-order-summary summary-col-4"},pse={class:"summary-item-inner"},fse={class:"value"},mse={class:"inner-value"},hse={class:"title"},_se={__name:"Summary",props:{summaryData:{type:Object,required:!0},fluctuations:{type:Object,required:!0},reportFilter:{type:Object},subscriptionReport:{type:Object},loading:{type:Boolean,default:!0}},setup(e){const t=e;K(()=>{var s;return((s=t.reportFilter)==null?void 0:s.currentCurrencySign)||""});const a=[{title:u("Future Installments"),key:"future_installments",info:u("The total amount expected from future installments."),hasCurrency:!0}],l=K(()=>!t.summaryData||!t.fluctuations?[]:a.map(s=>({...s,title:s.title,value:t.summaryData[s.key]||0,fluctuation:t.fluctuations[s.key]||0,hasCurrency:s.hasCurrency})));return(s,i)=>{const c=B("el-tooltip");return e.loading?(r(),$(Ll,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",Ase,[(r(!0),h(O,null,ae(l.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",pse,[o("div",fse,[o("div",mse,[n(Is,{amount:A(Je).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",hse,[R(f(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},vse={class:"chart-action-wrap"},gse={class:"chart-change-wrap"},yse={class:"chart-change"},bse={class:"text"},wse={class:"chart-change"},Cse={class:"text"},Bse={__name:"LineChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},formatValuePercentage:{type:Boolean,default:!1},amountFormat:{type:Boolean,default:!1},chartType:{type:String},zoomIsActive:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},setup(e,{expose:t}){const a=e,l=V(null),s=V(a.chartData);t({chartRef:l}),Ce(()=>a.chartData,F=>{s.value=F},{deep:!0});const i=Te.colors.report,c=V(Te.isDark()),p=K(()=>({textColor:c.value?"#ffffff":"#000000",borderColor:c.value?"#4a5a6b":"#c0c4ca",splitLineColor:c.value?"#253241":"#D6DAE1",bgColor:c.value?"#2d3748":"#ffffff"})),m=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),_=K(()=>s.value.map(F=>Us(F.label))),g=K(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map(F=>F.value),smooth:!1,color:m.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:m.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:m.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(m.value)},lineStyle:{color:m.value},areaStyle:{opacity:.3,color:m.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),Se(()=>{l.value&&(y=Jt(l.value),b())})},C=K(()=>dl(a.chartData.length)),b=()=>{if(!y)return;const F={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12,interval:C.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption(F,{notMerge:!0,replaceMerge:["series"]})},w=F=>{F?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):b()};Ce([()=>s.value,()=>a.chartType,()=>Te.isDark(),()=>a.loading],()=>{v()},{deep:!0}),Ce(()=>a.zoomIsActive,F=>{w(F)});const x=()=>{c.value=Te.isDark(),Se(()=>{b()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",x),window.addEventListener("fluentCartCurrencyChange",b),Se(v)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",x,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1)}),(F,L)=>{const U=B("el-skeleton");return e.loading?(r(),$(U,{key:0,animated:"",rows:8})):(r(),h(O,{key:1},[s.value.length?(r(),h(O,{key:0},[s.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):k("",!0),o("div",vse,[o("div",gse,[o("div",yse,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",bse,f(F.$t("Data")),1)]),o("div",wse,[o("span",Cse,f(F.$t("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},kse={class:"fct-daily-signup-chart-wrap"},xse={class:"fct-btn-group sm gap-2 lg:gap-0"},Sse={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=V(va.getChartType("subscription","daily_signups_chart")||"line"),l=V([]),s=V(""),i=V(!1),c=V(!0),p=_=>{c.value=!0,ce.get("reports/daily-signups",{params:{..._}}).then(g=>{l.value=g.signups,l.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>c.value=!1)},m=_=>{va.onChange("subscription","daily_signups_chart",_),a.value!==_&&(a.value=_)};return Qe(()=>{p(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",_=>{p(_.params)})}),(_,g)=>(r(),h("div",kse,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Daily Signups"),title_size:"small",border_bottom:""},ta({_:2},[l.value.length&&!c.value?{name:"action",fn:d(()=>[o("div",xse,[n(Rl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:m},null,8,["activeType"]),s.value?(r(),$(ka,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):k("",!0)])]),key:"0"}:void 0]),1032,["title"]),n(ke,null,{default:d(()=>[n(Bse,{chartData:l.value,"chart-title":A(u)("Signups"),chartType:a.value,zoomIsActive:i.value,ref_key:"lineChartRef",ref:s,loading:c.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const Fse={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{if(a<this.previousMetrics.length){const l=this.previousMetrics[a],s=t.count,i=l.count,c=i?((s-i)/i*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`,count:ia(s),previous_count:ia(i),percent_change:c})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Ha[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ha[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},$se={class:"fct-revenue-comparison"},Ese={class:"inline-flex"},Use={class:"inline-flex"};function Ise(e,t,a,l,s,i){const c=B("CardHeader"),p=B("el-skeleton"),m=B("el-table-column"),_=B("el-table"),g=B("CardBody"),y=B("CardContainer");return r(),h("div",$se,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),$(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),$(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(m,{label:"Date"},{default:d(v=>[R(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:d(v=>[o("div",Ese,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(O,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",Use,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Qse=lt(Fse,[["render",Ise]]),Dse={class:"fct-refund-report-page"};const Vse={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),l=t.reportFilter,s=V("default"),i=K(()=>l.currentCurrencySign);l.applicableFilters;const c=V(""),p=V(""),m=K(()=>{var F;const w=((F=Os.data)==null?void 0:F.productList)||[],x=c.value.toLowerCase();return w.filter(L=>L.product_name.toLowerCase().includes(x))}),_=K(()=>{var F;const w=((F=Os.data)==null?void 0:F.customerList)||[],x=p.value.toLowerCase();return w.filter(L=>L.customer_name.toLowerCase().includes(x)||L.email.toLowerCase().includes(x))}),g=w=>{y(w),C(w)},y=(w,x="default")=>{a.value.loading=!0,ce.get("reports/subscription-chart",{params:{...w.params,groupKey:x}}).then(F=>{a.value=F}).finally(()=>a.value.loading=!1)},v=w=>{s.value!==w&&(s.value=w,y(l.applicableFilters.params,w))},C=(w,x=null)=>{Os.getRetentionChart({params:{...w.params,customDays:x}})},b=w=>{C(l.applicableFilters,w)};return Qe(()=>{l.addListener("subscription-report",w=>{g(w)}),g(l.applicableFilters)}),Ct(()=>{l.removeListener("subscription-report")}),(w,x)=>{const F=B("el-col"),L=B("el-row"),U=B("el-input"),S=B("el-table-column"),M=B("el-empty"),I=B("el-table");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",Dse,[n(_se,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:A(Os),reportFilter:A(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),n(use,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:A(l),appliedGroupKey:s.value,onFilterData:v,"is-empty":!a.value.summary.total_subscriptions,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Qse,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(L,{gutter:30},{default:d(()=>[n(F,{lg:12},{default:d(()=>[n(Zle,{ref:"subscriptionChart",chartData:A(Os).data.chartData,onFetchCustomChartData:b,"is-empty":!a.value.summary.total_subscriptions,loading:A(Os).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n(F,{lg:12},{default:d(()=>[n(Sse,{reportFilter:A(l),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),k("",!0),k("",!0),k("",!0),k("",!0)])]),_:1})}}},Tse={class:"fct-refund-report-page"},Mse={key:1},Lse={key:1,class:"fct-report-order-summary summary-col-2"},Rse={class:"summary-item-inner"},Ose={class:"value"},Hse={class:"inner-value"},Pse=["innerHTML"],Nse={class:"title"},Kse={class:"fct-revenue-line-chart-wrap"},Gse={class:"flex items-center gap-2"},jse={class:"fct-card-header-title is-small"},zse={class:"fct-btn-group sm"},qse={class:"chart-action-wrap"},Yse={class:"chart-change-wrap"},Wse={class:"chart-change"},Xse={class:"text"},Jse={class:"chart-change"},Zse={class:"text"},ene={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=V(!1),s=Te.colors.report,i=V(Te.isDark()),c=V(null);let p=null;const m=V({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=V(!0),g=(M,I="monthly")=>{_.value=!0,ce.get("reports/future-renewals",{params:{...M.params,groupKey:I}}).then(T=>{m.value=T}).finally(()=>_.value=!1)},y=(M,I,T,Q,E)=>({name:M,type:I,barMaxWidth:30,yAxisIndex:T,data:Q,smooth:!1,color:E,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:E,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(E)},lineStyle:{color:E}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),Se(()=>{c.value&&(p=Jt(c.value),C())})},C=()=>{if(!p)return;const M=Ql(m.value.projections),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:i.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:i.value?s.dark_cyan_blue_16:s.light_gray_blue}},formatter:T=>{let Q=T[0].name;return T.forEach((E,D)=>{const H=D===0?`${Je.formatScaled(E.value)}`:ia(E.value),P=i.value?"#ffffff":"#565865";Q+=`<div> | |
| 219 | - ${E.marker} | |
| 220 | - <span style="color: ${P};">${E.seriesName}</span> | |
| 221 | - <span style="float: right; margin-left: 20px; color: ${P};"> | |
| 222 | - ${H} | |
| 217 | + </div>`,Z&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:D.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};b.setOption(I,{notMerge:!0,replaceMerge:["series"]})},B=()=>{i.value=!i.value,i.value?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=V=>{ba.onChange("subscription","subscription_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Nl.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||S()}),be(()=>a.loading,V=>{V||S()});const Q=()=>{p.value=Te.isDark(),xe(()=>{F()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),xe(()=>{S()})}),(V,I)=>{const M=C("el-tooltip"),O=C("el-option"),L=C("el-select"),H=C("el-skeleton");return r(),h("div",Yne,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Wne,[o("h4",Jne,m(A(u)("Subscription Chart")),1),n(M,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Xne,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(!0),h(P,null,te(A(g),j=>(r(),E(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(Gl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:B,class:de(i.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:7,class:"p-4"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512)),o("div",Zne,[o("div",eoe,[o("div",toe,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",aoe,m(A(u)("Data")),1)]),o("div",loe,[o("span",soe,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}};class ooe extends tl{constructor(){super(...arguments);Pe(this,"data",{overviews:[],fluctuations:[],chartData:[],productList:[],customerList:[],revenueChurnRateNet:{title:u("Revenue Churn Rate"),isCurrency:!1,value:0},netNewMrr:{title:u("Net New MRR"),isCurrency:!0,value:0},isBusy:{overviews:!1,fluctuations:!1,chartData:!0,productList:!1,customerList:!1,revenueChurnRateNet:!0,netNewMrr:!0},currentMetrics:[],previousMetrics:[]})}get controllerKey(){return"SubscriptionReportController"}get revenueChurnRateNet(){return this.data.revenueChurnRateNet}get netNewMrr(){return this.data.netNewMrr}makeRequest(a,l,s,i){typeof l!="object"&&(l={}),this.data.isBusy[i]=!0;const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null||(this.data[s]=i[l])}).catch(i=>{}).finally(()=>{this.data.isBusy[s]=!1})}getSubscriptionReportFluctuations(a={}){return this.makeRequest("getSubscriptionReportFluctuations",a,"fluctuations","fluctuations")}getSubscriptionReportFluctuations(a={}){return this.makeRequest("get-subscription-fluctuations",a,"fluctuations","fluctuations")}getRetentionChart(a={}){return this.makeRequest("retention-chart",a,"chartData","chartData")}listSubscriptionsByProduct(a={}){return this.makeRequest("list-subscription-by-product",a,"productList","productList")}listSubscriptionsByCustomer(a={}){return this.makeRequest("list-subscription-by-customer",a,"customerList","customerList")}getSubscriptionOverview(a={}){return this.makeRequest("get-subscription-overview",a,"overviews","overviews").then(l=>{this.getRevenueChurnRateNet(a),this.getNetNewMrr(a)}).finally(()=>{})}getRevenueChurnRateNet(a={}){this.data.isBusy.revenueChurnRateNet=!0,Ae.get("reports/get-subscription-overview/revenue-churn-rate-net",a).then(l=>{this.data.revenueChurnRateNet=l.data}).finally(()=>{this.data.isBusy.revenueChurnRateNet=!1})}getNetNewMrr(a={}){this.data.isBusy.netNewMrr=!0,Ae.get("reports/get-subscription-overview/net-new-mrr",a).then(l=>{this.data.netNewMrr=l.data}).finally(()=>{this.data.isBusy.netNewMrr=!1})}}const js=ooe.init(),ioe={key:1,class:"fct-report-order-summary summary-col-4"},roe={class:"summary-item-inner"},doe={class:"value"},uoe={class:"inner-value"},coe={class:"title"},Aoe={__name:"Summary",props:{summaryData:{type:Object,required:!0},fluctuations:{type:Object,required:!0},reportFilter:{type:Object},subscriptionReport:{type:Object},loading:{type:Boolean,default:!0}},setup(e){const t=e;K(()=>{var s;return((s=t.reportFilter)==null?void 0:s.currentCurrencySign)||""});const a=[{title:u("Future Installments"),key:"future_installments",info:u("The total amount expected from future installments."),hasCurrency:!0}],l=K(()=>!t.summaryData||!t.fluctuations?[]:a.map(s=>({...s,title:s.title,value:t.summaryData[s.key]||0,fluctuation:t.fluctuations[s.key]||0,hasCurrency:s.hasCurrency})));return(s,i)=>{const c=C("el-tooltip");return e.loading?(r(),E(Kl,{key:0,loading:e.loading},null,8,["loading"])):(r(),h("div",ioe,[(r(!0),h(P,null,te(l.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",roe,[o("div",doe,[o("div",uoe,[n(Rs,{amount:A(ft).scaled(p.value),title:p.title},null,8,["amount","title"])])]),o("div",coe,[R(m(p.title)+" ",1),n(c,{content:p.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))]))}}},poe={class:"chart-action-wrap"},foe={class:"chart-change-wrap"},moe={class:"chart-change"},hoe={class:"text"},_oe={class:"chart-change"},voe={class:"text"},goe={__name:"LineChart",props:{chartData:{type:Array,required:!0},chartTitle:{type:String,default:""},formatValuePercentage:{type:Boolean,default:!1},amountFormat:{type:Boolean,default:!1},chartType:{type:String},zoomIsActive:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},setup(e,{expose:t}){const a=e,l=T(null),s=T(a.chartData);t({chartRef:l}),be(()=>a.chartData,$=>{s.value=$},{deep:!0});const i=Te.colors.report,c=T(Te.isDark()),p=K(()=>({textColor:c.value?"#ffffff":"#000000",borderColor:c.value?"#4a5a6b":"#c0c4ca",splitLineColor:c.value?"#253241":"#D6DAE1",bgColor:c.value?"#2d3748":"#ffffff"})),f=K(()=>c.value?i.dark_cyan_blue_16:i.light_gray),_=K(()=>s.value.map($=>Ls($.label))),g=K(()=>[{name:a.chartTitle,type:a.chartType,data:s.value.map($=>$.value),smooth:!1,color:f.value,lineStyle:{width:3},barMaxWidth:30,areaStyle:{opacity:.3,color:f.value},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:f.value,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(f.value)},lineStyle:{color:f.value},areaStyle:{opacity:.3,color:f.value}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}]);let y=null;const v=()=>{y&&(y.dispose(),y=null),xe(()=>{l.value&&(y=na(l.value),k())})},w=K(()=>pl(a.chartData.length)),k=()=>{if(!y)return;const $={legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:c.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",borderColor:c.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:c.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?i.dark_cyan_blue_16:i.light_gray_blue}}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12,interval:w.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value};y.setOption($,{notMerge:!0,replaceMerge:["series"]})},b=$=>{$?y.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):k()};be([()=>s.value,()=>a.chartType,()=>Te.isDark(),()=>a.loading],()=>{v()},{deep:!0}),be(()=>a.zoomIsActive,$=>{b($)});const S=()=>{c.value=Te.isDark(),xe(()=>{k()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",S),window.addEventListener("fluentCartCurrencyChange",k),xe(v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",S,!1),window.removeEventListener("fluentCartCurrencyChange",k,!1)}),($,D)=>{const F=C("el-skeleton");return e.loading?(r(),E(F,{key:0,animated:"",rows:8})):(r(),h(P,{key:1},[s.value.length?(r(),h(P,{key:0},[s.value.length?(r(),h("div",{key:0,class:"fct-chart-wrap",ref_key:"chartRef",ref:l},null,512)):x("",!0),o("div",poe,[o("div",foe,[o("div",moe,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",hoe,m($.$t("Data")),1)]),o("div",_oe,[o("span",voe,m($.$t("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64)):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],64))}}},yoe={class:"fct-daily-signup-chart-wrap"},boe={class:"fct-btn-group sm gap-2 lg:gap-0"},woe={__name:"DailySignupChart",props:{reportFilter:{type:Object,required:!1}},setup(e){const t=e,a=T(ba.getChartType("subscription","daily_signups_chart")||"line"),l=T([]),s=T(""),i=T(!1),c=T(!0),p=_=>{c.value=!0,Ae.get("reports/daily-signups",{params:{..._}}).then(g=>{l.value=g.signups,l.value.forEach(y=>{y.label=y.trend_date})}).finally(()=>c.value=!1)},f=_=>{ba.onChange("subscription","daily_signups_chart",_),a.value!==_&&(a.value=_)};return Ie(()=>{p(t.reportFilter.applicableFilters.params),t.reportFilter.addListener("daily-signup-chart",_=>{p(_.params)})}),(_,g)=>(r(),h("div",yoe,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Daily Signups"),title_size:"small",border_bottom:""},oa({_:2},[l.value.length&&!c.value?{name:"action",fn:d(()=>[o("div",boe,[n(Gl,{activeType:a.value,types:{line:"LineChart",bar:"BarChart"},onChange:f},null,8,["activeType"]),s.value?(r(),E(Sa,{key:0,targetRef:s.value.chartRef},null,8,["targetRef"])):x("",!0)])]),key:"0"}:void 0]),1032,["title"]),n(ke,null,{default:d(()=>[n(goe,{chartData:l.value,"chart-title":A(u)("Signups"),chartType:a.value,zoomIsActive:i.value,ref_key:"lineChartRef",ref:s,loading:c.value},null,8,["chartData","chart-title","chartType","zoomIsActive","loading"])]),_:1})]),_:1})]))}};const Coe={name:"Comparison",components:{CardContainer:Se,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,default:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{if(a<this.previousMetrics.length){const l=this.previousMetrics[a],s=t.count,i=l.count,c=i?((s-i)/i*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(l.group)}`,count:ua(s),previous_count:ua(i),percent_change:c})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Oa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Oa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},koe={class:"fct-revenue-comparison"},Boe={class:"inline-flex"},xoe={class:"inline-flex"};function Soe(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",koe,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Subscription Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:7,class:"p-4"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(f,{label:"Date"},{default:d(v=>[R(m(v.row.group),1)]),_:1}),n(f,{label:i.translate("Current Range")},{default:d(v=>[o("div",Boe,m(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(f,{label:i.translate("Compare Range")},{default:d(v=>[o("div",xoe,m(v.row.previous_count),1)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const Foe=nt(Coe,[["render",Soe]]),$oe={class:"fct-refund-report-page"};const Eoe={__name:"SubscriptionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T({summary:{},fluctuations:{},currentMetrics:[],compareMetrics:[],loading:!0}),l=t.reportFilter,s=T("default"),i=K(()=>l.currentCurrencySign);l.applicableFilters;const c=T(""),p=T(""),f=K(()=>{var $;const b=(($=js.data)==null?void 0:$.productList)||[],S=c.value.toLowerCase();return b.filter(D=>D.product_name.toLowerCase().includes(S))}),_=K(()=>{var $;const b=(($=js.data)==null?void 0:$.customerList)||[],S=p.value.toLowerCase();return b.filter(D=>D.customer_name.toLowerCase().includes(S)||D.email.toLowerCase().includes(S))}),g=b=>{y(b),w(b)},y=(b,S="default")=>{a.value.loading=!0,Ae.get("reports/subscription-chart",{params:{...b.params,groupKey:S}}).then($=>{a.value=$}).finally(()=>a.value.loading=!1)},v=b=>{s.value!==b&&(s.value=b,y(l.applicableFilters.params,b))},w=(b,S=null)=>{js.getRetentionChart({params:{...b.params,customDays:S}})},k=b=>{w(l.applicableFilters,b)};return Ie(()=>{l.addListener("subscription-report",b=>{g(b)}),g(l.applicableFilters)}),Bt(()=>{l.removeListener("subscription-report")}),(b,S)=>{const $=C("el-col"),D=C("el-row"),F=C("el-input"),B=C("el-table-column"),U=C("el-empty"),Q=C("el-table");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",$oe,[n(Aoe,{summaryData:a.value.summary,fluctuations:a.value.fluctuations,subscriptionReport:A(js),reportFilter:A(l),loading:a.value.loading},null,8,["summaryData","fluctuations","subscriptionReport","reportFilter","loading"]),n(noe,{ref:"subscriptionChart",chartData:a.value.currentMetrics,compareData:a.value.compareMetrics,reportFilter:A(l),appliedGroupKey:s.value,onFilterData:v,"is-empty":!a.value.summary.total_subscriptions,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(Foe,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.compareMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(l),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"]),n(D,{gutter:30},{default:d(()=>[n($,{lg:12},{default:d(()=>[n(qne,{ref:"subscriptionChart",chartData:A(js).data.chartData,onFetchCustomChartData:k,"is-empty":!a.value.summary.total_subscriptions,loading:A(js).data.isBusy.chartData},null,8,["chartData","is-empty","loading"])]),_:1}),n($,{lg:12},{default:d(()=>[n(woe,{reportFilter:A(l),"is-empty":!a.value.summary.total_subscriptions},null,8,["reportFilter","is-empty"])]),_:1})]),_:1}),x("",!0),x("",!0),x("",!0),x("",!0)])]),_:1})}}},Uoe={class:"fct-refund-report-page"},Ioe={key:1},Qoe={key:1,class:"fct-report-order-summary summary-col-2"},Doe={class:"summary-item-inner"},Voe={class:"value"},Toe={class:"inner-value"},Moe=["innerHTML"],Loe={class:"title"},Roe={class:"fct-revenue-line-chart-wrap"},Ooe={class:"flex items-center gap-2"},Poe={class:"fct-card-header-title is-small"},Hoe={class:"fct-btn-group sm"},Noe={class:"chart-action-wrap"},Koe={class:"chart-change-wrap"},Goe={class:"chart-change"},zoe={class:"text"},joe={class:"chart-change"},qoe={class:"text"},Yoe={__name:"FutureRenewalsReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T(!1),s=Te.colors.report,i=T(Te.isDark()),c=T(null);let p=null;const f=T({totalProjected:0,totalRenewals:0,projections:[],period:{start:null,end:null},groupBy:"monthly"}),_=T(!0),g=(U,Q="monthly")=>{_.value=!0,Ae.get("reports/future-renewals",{params:{...U.params,groupKey:Q}}).then(V=>{f.value=V}).finally(()=>_.value=!1)},y=(U,Q,V,I,M)=>({name:U,type:Q,barMaxWidth:30,yAxisIndex:V,data:I,smooth:!1,color:M,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:M,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(M)},lineStyle:{color:M}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),v=()=>{p&&(p.dispose(),p=null),xe(()=>{c.value&&(p=na(c.value),w())})},w=()=>{if(!p)return;const U=Ol(f.value.projections),Q={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:i.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:i.value?"#253241":"#ffffff",borderColor:i.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:i.value?"#ffffff":"#565865"},axisPointer:Ql(i.value,s.dark_cyan_blue_16,s.light_gray_blue),confine:!0,position:wl,formatter:V=>{let I=V[0].name;return V.forEach((M,O)=>{const L=O===0?za(M.value):ua(M.value),H=i.value?"#ffffff":"#565865";I+=`<div> | |
| 218 | + ${M.marker} | |
| 219 | + <span style="color: ${H};">${M.seriesName}</span> | |
| 220 | + <span style="float: right; margin-left: 20px; color: ${H};"> | |
| 221 | + ${L} | |
| 223 | 222 | </span> |
| 224 | - </div>`}),Q}},grid:{show:!1},xAxis:{type:"category",data:M,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:L.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:T=>`${Je.formatScaledChart(T)}`},splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!1}}],series:F.value};p.setOption(I,{notMerge:!0,replaceMerge:["series"]})},b=()=>{l.value=!l.value,l.value?p.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):C()},w=()=>{i.value=Te.isDark(),Se(()=>{C()})},x=K(()=>{const M=Es(m.value.period);return u("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+M}),F=K(()=>[{name:u("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:m.value.projections.map(I=>I.projected_amount)},{name:u("Count"),key:"count",type:"bar",color:i.value?s.dark_cyan_blue_16:s.light_gray,data:m.value.projections.map(I=>I.renewals_count)}].map((I,T)=>y(I.name,I.type,T,I.data,I.color))),L=K(()=>dl(m.value.projections.length)),U=K(()=>[{title:u("Renewal Revenue"),value:Je.formatScaled(m.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:ia(m.value.totalRenewals),key:"renewals_count",no_currency:!0}]),S=K(()=>!m.value.totalRenewals);return Ce([()=>m.value],()=>{Se(C)},{deep:!0}),Ce(S,M=>{M||v()}),Ce(_,M=>{M||v()}),Qe(()=>{g(a.applicableFilters),Se(()=>{v()}),window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",C)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(M,I)=>{const T=B("el-skeleton");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",Tse,[n(ll,{title:A(u)("Subscription Future Revenue")},null,8,["title"])]),n(xe,null,{default:d(()=>[n(ke,{class:"p-3"},{default:d(()=>[_.value?(r(),$(Ll,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",Mse,f(x.value),1))]),_:1})]),_:1}),_.value?(r(),$(Ll,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",Lse,[(r(!0),h(O,null,ae(U.value,(Q,E)=>(r(),h("div",{class:"summary-item",key:E},[o("div",Rse,[o("div",Ose,[o("div",Hse,[o("span",{innerHTML:Q.value},null,8,Pse)])]),o("div",Nse,f(Q.title),1)])]))),128))])),o("div",Kse,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Gse,[o("h4",jse,f(A(u)("Upcoming Renewal Revenue")),1)])]),_:2},[m.value.totalRenewals&&!_.value?{name:"action",fn:d(()=>[o("div",zse,[n(Xe,{tag:"button",size:"small",title:M.$t("Zoom Chart"),onClick:b,class:de(l.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:c.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[_.value?(r(),$(T,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(O,{key:1},[S.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[S.value?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:c},null,512)),o("div",qse,[o("div",Yse,[o("div",Wse,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Xse,f(A(u)("Data")),1)]),o("div",Jse,[o("span",Zse,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},tne={class:"fct-retention-lifetime"},ane={class:"flex items-center gap-2"},lne={class:"fct-card-header-title is-small"},sne={key:0},nne={class:"mt-2"},one={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=K(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),l=K(()=>{const s=a.value;if(!s.length)return null;const c=s.reduce((x,F)=>x+parseFloat(F.retention_rate),0)/s.length,p=c/100;let m=0;p<1?m=1/(1-p):m=s.length;const _=s[s.length-1],g=parseInt(_.active_subscriptions),y=parseFloat(_.mrr);let v=0;g>0&&(v=y/g);const C=v*m,b=new Date(_.day),w=Ha[b.getMonth()]+" "+b.getFullYear().toString();return{expected_lifetime_text:u(`Based on an average monthly subscription retention rate of ${c.toFixed(1)}%, your expected subscription lifetime is ${m.toFixed(1)} months.`),ltv_text:u(`In ${w}, your average monthly revenue per subscriber was ${Je.scaled(v)}, giving you an expected subscription lifetime value of ${Je.scaled(C)}.`)}});return(s,i)=>{const c=B("el-skeleton");return r(),h("div",tne,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},{title:d(()=>[o("div",ane,[o("h4",lne,f(A(u)("Lifetime")),1)])]),_:1}),n(ke,null,{default:d(()=>[e.loading?(r(),$(c,{key:0,animated:"",rows:1})):(r(),h(O,{key:1},[l.value?(r(),h("div",sne,[o("div",null,f(l.value.expected_lifetime_text),1),o("div",nne,f(l.value.ltv_text),1)])):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},ine={class:"summary-item-inner"},rne={class:"title text-[16px] mb-2.5"},dne={class:"grid grid-cols-2 items-center"},une={class:"value"},cne={class:"sub-value mt-1.5"},Ane={class:"value"},pne={class:"sub-value mt-1.5"},fne={class:"description leading-[1.6] mt-3.5"},mne={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Te.colors.report,l=V(Te.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const _=(p.reduce((I,T)=>I+parseFloat(T.retention_rate),0)/p.length).toFixed(1),y=(p.reduce((I,T)=>I+parseFloat(T.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let C="",b=0,w=0;if(p.length>1){const I=p[p.length-2],T=new Date(I.day);C=Ha[T.getMonth()]+" "+T.getFullYear().toString(),b=parseInt(I.active_subscriptions),w=parseFloat(I.mrr)}else{const I=new Date(v.day);I.setMonth(I.getMonth()-1),C=Ha[I.getMonth()]+" "+I.getFullYear().toString();const T=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);b=v.retention_rate>0?Math.round(T/(v.retention_rate/100)):0;const Q=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);w=v.retention_rate_money>0?Q/(v.retention_rate_money/100):0}const x=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),F=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),L=parseFloat(v.retention_rate),U=parseFloat(v.retention_rate_money),S=new Date(v.day),M=Ha[S.getMonth()]+" "+S.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${L}%`,average_value:`${_}%`,month_name:M,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate}% (${ia(x)}) of your ${C} subscriptions (${ia(b)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${U}%`,average_value:`${y}%`,month_name:M,sub_title:u("Average in period"),description:u(`You retained ${v.retention_rate_money}% (${Je.scaled(F)}) of your ${C} subscription MRR (${Je.scaled(w)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Te.isDark()};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),$(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(O,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",ine,[o("div",rne,f(y.title),1),o("div",dne,[o("div",null,[o("div",une,f(y.value),1),o("div",cne,f(y.month_name),1)]),o("div",null,[o("div",Ane,f(y.average_value),1),o("div",pne,f(y.sub_title),1)])]),o("div",fne,f(y.description),1)])]))),128)):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},hne={class:"fct-revenue-line-chart-wrap"},_ne={class:"flex items-center gap-2"},vne={class:"fct-card-header-title is-small"},gne={class:"fct-btn-group sm"},yne={class:"chart-action-wrap"},bne={class:"chart-change-wrap"},wne={class:"chart-change"},Cne={class:"text"},Bne={class:"chart-change"},kne={class:"text"},xne={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=V(!1),l=Te.colors.report,s=V(Te.isDark()),i=V(null);let c=null;const p=V(va.getChartType("subscription","retention_chart")||"line"),m=(L,U,S,M,I)=>({name:L,type:U,barMaxWidth:30,yAxisIndex:S,data:M,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(I)},lineStyle:{color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),Se(()=>{i.value&&(c=Jt(i.value),g())})},g=()=>{if(!c)return;const L=Ql(b.value),U={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:S=>{let M=S[0].name;return S.forEach((I,T)=>{const Q=ia(I.value)+"%",E=s.value?"#ffffff":"#565865";M+=`<div> | |
| 225 | - ${I.marker} | |
| 226 | - <span style="color: ${E};">${I.seriesName}</span> | |
| 227 | - <span style="float: right; margin-left: 20px; color: ${E};"> | |
| 228 | - ${Q} | |
| 223 | + </div>`}),I}},grid:{show:!1},xAxis:{type:"category",data:U,axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,interval:D.value.interval},axisLine:{lineStyle:{type:"dashed",color:i.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12,formatter:V=>`${ft.formatScaledChart(V)}`},splitLine:{show:!0,lineStyle:{color:i.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",axisLabel:{color:i.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!1}}],series:$.value};p.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},k=()=>{l.value=!l.value,l.value?p.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):w()},b=()=>{i.value=Te.isDark(),xe(()=>{w()})},S=K(()=>{const U=Ms(f.value.period);return u("This report is calculated by looking at active subscriptions and extrapolating their renewals over time, to estimate future renewal revenue ")+U}),$=K(()=>[{name:u("Revenue"),key:"count",type:"line",color:i.value?s.blue_dark_mode:s.blue,data:f.value.projections.map(Q=>Q.projected_amount)},{name:u("Count"),key:"count",type:"bar",color:i.value?s.dark_cyan_blue_16:s.light_gray,data:f.value.projections.map(Q=>Q.renewals_count)}].map((Q,V)=>y(Q.name,Q.type,V,Q.data,Q.color))),D=K(()=>pl(f.value.projections.length)),F=K(()=>[{title:u("Renewal Revenue"),value:ft.formatScaled(f.value.totalProjected),key:"renewal_revenue"},{title:u("Renewals"),value:ua(f.value.totalRenewals),key:"renewals_count",no_currency:!0}]),B=K(()=>!f.value.totalRenewals);return be([()=>f.value],()=>{xe(w)},{deep:!0}),be(B,U=>{U||v()}),be(_,U=>{U||v()}),Ie(()=>{g(a.applicableFilters),xe(()=>{v()}),window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",w)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(U,Q)=>{const V=C("el-skeleton");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",Uoe,[n(ol,{title:A(u)("Subscription Future Revenue")},null,8,["title"])]),n(Se,null,{default:d(()=>[n(ke,{class:"p-3"},{default:d(()=>[_.value?(r(),E(Kl,{key:0,loading:_.value,"margin-bottom":0,padding:0},null,8,["loading"])):(r(),h("div",Ioe,m(S.value),1))]),_:1})]),_:1}),_.value?(r(),E(Kl,{key:0,loading:_.value,count:2},null,8,["loading"])):(r(),h("div",Qoe,[(r(!0),h(P,null,te(F.value,(I,M)=>(r(),h("div",{class:"summary-item",key:M},[o("div",Doe,[o("div",Voe,[o("div",Toe,[o("span",{innerHTML:I.value},null,8,Moe)])]),o("div",Loe,m(I.title),1)])]))),128))])),o("div",Roe,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Ooe,[o("h4",Poe,m(A(u)("Upcoming Renewal Revenue")),1)])]),_:2},[f.value.totalRenewals&&!_.value?{name:"action",fn:d(()=>[o("div",Hoe,[n(at,{tag:"button",size:"small",title:U.$t("Zoom Chart"),onClick:k,class:de(l.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:c.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[_.value?(r(),E(V,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[B.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[B.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:c},null,512)),o("div",Noe,[o("div",Koe,[o("div",Goe,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",zoe,m(A(u)("Data")),1)]),o("div",joe,[o("span",qoe,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])]),_:1})}}},Woe={class:"fct-retention-lifetime"},Joe={class:"flex items-center gap-2"},Xoe={class:"fct-card-header-title is-small"},Zoe={key:0},eie={class:"mt-2"},tie={__name:"Lifetime",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=K(()=>{var s;return((s=t.data)==null?void 0:s.retention_data)??[]}),l=K(()=>{const s=a.value;if(!s.length)return null;const c=s.reduce((S,$)=>S+parseFloat($.retention_rate),0)/s.length,p=c/100;let f=0;p<1?f=1/(1-p):f=s.length;const _=s[s.length-1],g=parseInt(_.active_subscriptions),y=parseFloat(_.mrr);let v=0;g>0&&(v=y/g);const w=v*f,k=new Date(_.day),b=Oa[k.getMonth()]+" "+k.getFullYear().toString();return{expected_lifetime_text:u("Based on an average monthly subscription retention rate of %1$s, your expected subscription lifetime is %2$s months.",`${c.toFixed(1)}%`,f.toFixed(1)),ltv_text:u("In %1$s, your average monthly revenue per subscriber was %2$s, giving you an expected subscription lifetime value of %3$s.",b,ft.scaled(v),ft.scaled(w))}});return(s,i)=>{const c=C("el-skeleton");return r(),h("div",Woe,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},{title:d(()=>[o("div",Joe,[o("h4",Xoe,m(A(u)("Lifetime")),1)])]),_:1}),n(ke,null,{default:d(()=>[e.loading?(r(),E(c,{key:0,animated:"",rows:1})):(r(),h(P,{key:1},[l.value?(r(),h("div",Zoe,[o("div",null,m(l.value.expected_lifetime_text),1),o("div",eie,m(l.value.ltv_text),1)])):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Not enough data to calculate lifetime metrics."),class:"fct-report-empty-state"},null,8,["text"]))],64))]),_:1})]),_:1})])}}},aie={class:"summary-item-inner"},lie={class:"title text-[16px] mb-2.5"},sie={class:"grid grid-cols-2 items-center"},nie={class:"value"},oie={class:"sub-value mt-1.5"},iie={class:"value"},rie={class:"sub-value mt-1.5"},die={class:"description leading-[1.6] mt-3.5"},uie={__name:"Summary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Te.colors.report,l=T(Te.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const _=(p.reduce((Q,V)=>Q+parseFloat(V.retention_rate),0)/p.length).toFixed(1),y=(p.reduce((Q,V)=>Q+parseFloat(V.retention_rate_money),0)/p.length).toFixed(1),v=p[p.length-1];let w="",k=0,b=0;if(p.length>1){const Q=p[p.length-2],V=new Date(Q.day);w=Oa[V.getMonth()]+" "+V.getFullYear().toString(),k=parseInt(Q.active_subscriptions),b=parseFloat(Q.mrr)}else{const Q=new Date(v.day);Q.setMonth(Q.getMonth()-1),w=Oa[Q.getMonth()]+" "+Q.getFullYear().toString();const V=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions);k=v.retention_rate>0?Math.round(V/(v.retention_rate/100)):0;const I=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr);b=v.retention_rate_money>0?I/(v.retention_rate_money/100):0}const S=parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions),$=parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr),D=parseFloat(v.retention_rate),F=parseFloat(v.retention_rate_money),B=new Date(v.day),U=Oa[B.getMonth()]+" "+B.getFullYear().toString();return[{title:u("Subscription Retention"),value:`${D}%`,average_value:`${_}%`,month_name:U,sub_title:u("Average in period"),description:u("You retained %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${v.retention_rate}%`,ua(S),w,ua(k)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Retention"),value:`${F}%`,average_value:`${y}%`,month_name:U,sub_title:u("Average in period"),description:u("You retained %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${v.retention_rate_money}%`,ft.scaled($),w,ft.scaled(b)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Te.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,f)=>{var _,g;return e.loading?(r(),E(Kl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},te(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",aie,[o("div",lie,m(y.title),1),o("div",sie,[o("div",null,[o("div",nie,m(y.value),1),o("div",oie,m(y.month_name),1)]),o("div",null,[o("div",iie,m(y.average_value),1),o("div",rie,m(y.sub_title),1)])]),o("div",die,m(y.description),1)])]))),128)):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},cie={class:"fct-revenue-line-chart-wrap"},Aie={class:"flex items-center gap-2"},pie={class:"fct-card-header-title is-small"},fie={class:"fct-btn-group sm"},mie={class:"chart-action-wrap"},hie={class:"chart-change-wrap"},_ie={class:"chart-change"},vie={class:"text"},gie={class:"chart-change"},yie={class:"text"},bie={__name:"RetentionChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Te.colors.report,s=T(Te.isDark()),i=T(null);let c=null;const p=T(ba.getChartType("subscription","retention_chart")||"line"),f=(D,F,B,U,Q)=>({name:D,type:F,barMaxWidth:30,yAxisIndex:B,data:U,smooth:!1,color:Q,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),xe(()=>{i.value&&(c=na(i.value),g())})},g=()=>{if(!c)return;const D=Ol(k.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:B=>{let U=B[0].name;return B.forEach((Q,V)=>{const I=ua(Q.value)+"%",M=s.value?"#ffffff":"#565865";U+=`<div> | |
| 224 | + ${Q.marker} | |
| 225 | + <span style="color: ${M};">${Q.seriesName}</span> | |
| 226 | + <span style="float: right; margin-left: 20px; color: ${M};"> | |
| 227 | + ${I} | |
| 229 | 228 | </span> |
| 230 | - </div>`}),M}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:x.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:S=>`${S}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};c.setOption(U,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{s.value=Te.isDark(),Se(()=>{g()})},C=L=>{va.onChange("subscription","retention_chart",L),p.value!==L&&(a.value=!1,p.value=L,g())},b=K(()=>{var L;return((L=t.data)==null?void 0:L.retention_data)??[]}),w=K(()=>[{name:u("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:b.value.map(U=>U.retention_rate)},{name:u("MRR Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:b.value.map(U=>U.retention_rate_money)}].map((U,S)=>m(U.name,U.type,0,U.data,U.color))),x=K(()=>dl(b.value.length)),F=K(()=>!b.value||!b.value.length);return Ce([()=>t.data],()=>{Se(_)},{deep:!0}),Ce(F,L=>{L||_()}),Ce(t.loading,L=>{L||_()}),Qe(()=>{Se(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(L,U)=>{const S=B("el-skeleton");return r(),h("div",hne,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",_ne,[o("h4",vne,f(A(u)("Retention Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:d(()=>[o("div",gne,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:L.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),$(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(O,{key:1},[F.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[F.value?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",yne,[o("div",bne,[o("div",wne,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Cne,f(A(u)("Data")),1)]),o("div",Bne,[o("span",kne,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Sne={class:"summary-item-inner"},Fne={class:"title text-[16px] mb-2.5"},$ne={class:"grid grid-cols-2 items-center"},Ene={class:"value"},Une={class:"sub-value mt-1.5"},Ine={class:"value"},Qne={class:"sub-value mt-1.5"},Dne={class:"description leading-[1.6] mt-3.5"},Vne={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Te.colors.report,l=V(Te.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const m=p.map((T,Q)=>{const E=Q>0?parseInt(p[Q-1].active_subscriptions)||0:parseInt(T.active_subscriptions)-parseInt(T.new_subscriptions)||0,D=parseInt(T.churned_subscriptions)||0;return E>0?D/E*100:0}),_=p.map((T,Q)=>{const E=Q>0?parseFloat(p[Q-1].mrr)||0:parseFloat(T.mrr)-parseFloat(T.new_subscriptions_mrr)||0,D=parseFloat(T.churned_subscriptions_mrr)||0;return E>0?D/E*100:0}),g=(m.reduce((T,Q)=>T+Q,0)/m.length).toFixed(1),y=(_.reduce((T,Q)=>T+Q,0)/_.length).toFixed(1),v=p[p.length-1],C=p.length-1,b=C>0?parseInt(p[C-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,w=C>0?parseFloat(p[C-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,x=parseInt(v.churned_subscriptions)||0,F=parseFloat(v.churned_subscriptions_mrr)||0,L=b>0?(x/b*100).toFixed(1):0,U=w>0?(F/w*100).toFixed(1):0,S=new Date(v.day),M=Ha[S.getMonth()]+" "+S.getFullYear().toString();let I="";if(p.length>1){const T=p[p.length-2],Q=new Date(T.day);I=Ha[Q.getMonth()]+" "+Q.getFullYear().toString()}else{const T=new Date(v.day);T.setMonth(T.getMonth()-1),I=Ha[T.getMonth()]+" "+T.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${L}%`,average_value:`${g}%`,month_name:M,sub_title:u("Average in period"),description:u(`You lost ${L}% (${ia(x)}) of your ${I} subscriptions (${ia(b)}).`),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${U}%`,average_value:`${y}%`,month_name:M,sub_title:u("Average in period"),description:u(`You lost ${U}% (${Je.scaled(F)}) of your ${I} subscription MRR (${Je.scaled(w)}).`),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Te.isDark()};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,m)=>{var _,g;return e.loading?(r(),$(Ll,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(O,{key:0},ae(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",Sne,[o("div",Fne,f(y.title),1),o("div",$ne,[o("div",null,[o("div",Ene,f(y.value),1),o("div",Une,f(y.month_name),1)]),o("div",null,[o("div",Ine,f(y.average_value),1),o("div",Qne,f(y.sub_title),1)])]),o("div",Dne,f(y.description),1)])]))),128)):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Tne={class:"fct-revenue-line-chart-wrap"},Mne={class:"flex items-center gap-2"},Lne={class:"fct-card-header-title is-small"},Rne={class:"fct-btn-group sm"},One={class:"chart-action-wrap"},Hne={class:"chart-change-wrap"},Pne={class:"chart-change"},Nne={class:"text"},Kne={class:"chart-change"},Gne={class:"text"},jne={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=V(!1),l=Te.colors.report,s=V(Te.isDark()),i=V(null);let c=null;const p=V(va.getChartType("subscription","churn_chart")||"line"),m=(L,U,S,M,I)=>({name:L,type:U,barMaxWidth:30,yAxisIndex:S,data:M,smooth:!1,color:I,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:I,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(I)},lineStyle:{color:I}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),Se(()=>{i.value&&(c=Jt(i.value),g())})},g=()=>{if(!c)return;const L=Ql(b.value),U={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:S=>{let M=S[0].name;return S.forEach((I,T)=>{const Q=ia(I.value)+"%",E=s.value?"#ffffff":"#565865";M+=`<div> | |
| 231 | - ${I.marker} | |
| 232 | - <span style="color: ${E};">${I.seriesName}</span> | |
| 233 | - <span style="float: right; margin-left: 20px; color: ${E};"> | |
| 234 | - ${Q} | |
| 229 | + </div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:B=>`${B}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};c.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{s.value=Te.isDark(),xe(()=>{g()})},w=D=>{ba.onChange("subscription","retention_chart",D),p.value!==D&&(a.value=!1,p.value=D,g())},k=K(()=>{var D;return((D=t.data)==null?void 0:D.retention_data)??[]}),b=K(()=>[{name:u("Subscription Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:k.value.map(F=>F.retention_rate)},{name:u("MRR Retention"),key:"count",type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:k.value.map(F=>F.retention_rate_money)}].map((F,B)=>f(F.name,F.type,0,F.data,F.color))),S=K(()=>pl(k.value.length)),$=K(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{xe(_)},{deep:!0}),be($,D=>{D||_()}),be(t.loading,D=>{D||_()}),Ie(()=>{xe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(D,F)=>{const B=C("el-skeleton");return r(),h("div",cie,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Aie,[o("h4",pie,m(A(u)("Retention Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",fie,[n(Gl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:w},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(B,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[$.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[$.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",mie,[o("div",hie,[o("div",_ie,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",vie,m(A(u)("Data")),1)]),o("div",gie,[o("span",yie,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},wie={class:"summary-item-inner"},Cie={class:"title text-[16px] mb-2.5"},kie={class:"grid grid-cols-2 items-center"},Bie={class:"value"},xie={class:"sub-value mt-1.5"},Sie={class:"value"},Fie={class:"sub-value mt-1.5"},$ie={class:"description leading-[1.6] mt-3.5"},Eie={__name:"ChurnSummary",props:{data:{type:Object,required:!0},loading:{type:Boolean,default:!0}},setup(e){const t=e,a=Te.colors.report,l=T(Te.isDark()),s=K(()=>{var p;return((p=t.data)==null?void 0:p.retention_data)??[]}),i=K(()=>{const p=s.value;if(!p.length)return[];const f=p.map((V,I)=>{const M=I>0?parseInt(p[I-1].active_subscriptions)||0:parseInt(V.active_subscriptions)-parseInt(V.new_subscriptions)||0,O=parseInt(V.churned_subscriptions)||0;return M>0?O/M*100:0}),_=p.map((V,I)=>{const M=I>0?parseFloat(p[I-1].mrr)||0:parseFloat(V.mrr)-parseFloat(V.new_subscriptions_mrr)||0,O=parseFloat(V.churned_subscriptions_mrr)||0;return M>0?O/M*100:0}),g=(f.reduce((V,I)=>V+I,0)/f.length).toFixed(1),y=(_.reduce((V,I)=>V+I,0)/_.length).toFixed(1),v=p[p.length-1],w=p.length-1,k=w>0?parseInt(p[w-1].active_subscriptions)||0:parseInt(v.active_subscriptions)-parseInt(v.new_subscriptions)||0,b=w>0?parseFloat(p[w-1].mrr)||0:parseFloat(v.mrr)-parseFloat(v.new_subscriptions_mrr)||0,S=parseInt(v.churned_subscriptions)||0,$=parseFloat(v.churned_subscriptions_mrr)||0,D=k>0?(S/k*100).toFixed(1):0,F=b>0?($/b*100).toFixed(1):0,B=new Date(v.day),U=Oa[B.getMonth()]+" "+B.getFullYear().toString();let Q="";if(p.length>1){const V=p[p.length-2],I=new Date(V.day);Q=Oa[I.getMonth()]+" "+I.getFullYear().toString()}else{const V=new Date(v.day);V.setMonth(V.getMonth()-1),Q=Oa[V.getMonth()]+" "+V.getFullYear().toString()}return[{title:u("Subscription Churn"),value:`${D}%`,average_value:`${g}%`,month_name:U,sub_title:u("Average in period"),description:u("You lost %1$s (%2$s) of your %3$s subscriptions (%4$s).",`${D}%`,ua(S),Q,ua(k)),color:l.value?a.dark_cyan_blue_16:a.light_gray},{title:u("MRR Churn"),value:`${F}%`,average_value:`${y}%`,month_name:U,sub_title:u("Average in period"),description:u("You lost %1$s (%2$s) of your %3$s subscription MRR (%4$s).",`${F}%`,ft.scaled($),Q,ft.scaled(b)),color:l.value?a.dark_cyan_blue_36:a.light_gray_cyan_blue}]}),c=()=>{l.value=Te.isDark()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",c)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",c,!1)}),(p,f)=>{var _,g;return e.loading?(r(),E(Kl,{key:0,loading:e.loading,count:2},null,8,["loading"])):(r(),h("div",{key:1,class:de(`fct-report-order-summary ${(_=i.value)!=null&&_.length?"summary-col-2":""}`)},[(g=i.value)!=null&&g.length?(r(!0),h(P,{key:0},te(i.value,(y,v)=>(r(),h("div",{class:"summary-item",key:v},[o("div",wie,[o("div",Cie,m(y.title),1),o("div",kie,[o("div",null,[o("div",Bie,m(y.value),1),o("div",xie,m(y.month_name),1)]),o("div",null,[o("div",Sie,m(y.average_value),1),o("div",Fie,m(y.sub_title),1)])]),o("div",$ie,m(y.description),1)])]))),128)):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"]))],2))}}},Uie={class:"fct-revenue-line-chart-wrap"},Iie={class:"flex items-center gap-2"},Qie={class:"fct-card-header-title is-small"},Die={class:"fct-btn-group sm"},Vie={class:"chart-action-wrap"},Tie={class:"chart-change-wrap"},Mie={class:"chart-change"},Lie={class:"text"},Rie={class:"chart-change"},Oie={class:"text"},Pie={__name:"ChurnChart",props:{loading:{type:Boolean,default:!0},data:{type:Object,required:!0}},setup(e){const t=e,a=T(!1),l=Te.colors.report,s=T(Te.isDark()),i=T(null);let c=null;const p=T(ba.getChartType("subscription","churn_chart")||"line"),f=(D,F,B,U,Q)=>({name:D,type:F,barMaxWidth:30,yAxisIndex:B,data:U,smooth:!1,color:Q,lineStyle:{width:3},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:Q,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(Q)},lineStyle:{color:Q}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,legendHoverLink:!1}),_=()=>{c&&(c.dispose(),c=null),xe(()=>{i.value&&(c=na(i.value),g())})},g=()=>{if(!c)return;const D=Ol(k.value),F={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:s.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:s.value?"#253241":"#ffffff",borderColor:s.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:s.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:s.value?l.dark_cyan_blue_16:l.light_gray_blue}},formatter:B=>{let U=B[0].name;return B.forEach((Q,V)=>{const I=ua(Q.value)+"%",M=s.value?"#ffffff":"#565865";U+=`<div> | |
| 230 | + ${Q.marker} | |
| 231 | + <span style="color: ${M};">${Q.seriesName}</span> | |
| 232 | + <span style="float: right; margin-left: 20px; color: ${M};"> | |
| 233 | + ${I} | |
| 235 | 234 | </span> |
| 236 | - </div>`}),M}},grid:{show:!1},xAxis:{type:"category",data:L,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:x.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:S=>`${S}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:w.value};c.setOption(U,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{s.value=Te.isDark(),Se(()=>{g()})},C=L=>{va.onChange("subscription","churn_chart",L),p.value!==L&&(a.value=!1,p.value=L,g())},b=K(()=>{var L;return((L=t.data)==null?void 0:L.retention_data)??[]}),w=K(()=>{const L=b.value.map((M,I)=>{const T=I>0?parseInt(b.value[I-1].active_subscriptions)||0:parseInt(M.active_subscriptions)-parseInt(M.new_subscriptions)||0,Q=parseInt(M.churned_subscriptions)||0;return T>0?(Q/T*100).toFixed(2):0}),U=b.value.map((M,I)=>{const T=I>0?parseFloat(b.value[I-1].mrr)||0:parseFloat(M.mrr)-parseFloat(M.new_subscriptions_mrr)||0,Q=parseFloat(M.churned_subscriptions_mrr)||0;return T>0?(Q/T*100).toFixed(2):0});return[{name:u("Subscription Churn"),type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:L},{name:u("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:U}].map((M,I)=>m(M.name,M.type,0,M.data,M.color))}),x=K(()=>dl(b.value.length)),F=K(()=>!b.value||!b.value.length);return Ce([()=>t.data],()=>{Se(_)},{deep:!0}),Ce(F,L=>{L||_()}),Ce(t.loading,L=>{L||_()}),Qe(()=>{Se(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(L,U)=>{const S=B("el-skeleton");return r(),h("div",Tne,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Mne,[o("h4",Lne,f(A(u)("Churn Rate")),1)])]),_:2},[!F.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Rne,[n(Rl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:C},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:L.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),$(S,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(O,{key:1},[F.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[F.value?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",One,[o("div",Hne,[o("div",Pne,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",Nne,f(A(u)("Data")),1)]),o("div",Kne,[o("span",Gne,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},zne={class:"fct-retention-report-page"},qne={class:"page-title"},Yne={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=V({retention_data:[]}),s=V(!0),i=(c,p="monthly")=>{s.value=!0,ce.get("reports/subscription-retention",{params:{...c.params,groupKey:p}}).then(m=>{l.value=m}).finally(()=>s.value=!1)};return Qe(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(c,p)=>{const m=B("el-tooltip");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",zne,[n(ll,null,{title:d(()=>[o("h1",qne,[R(f(A(u)("Subscription Retention"))+" ",1),n(m,{"popper-class":"fct-tooltip",content:A(u)("Retention is calculated by looking at the active subscriptions at the end of each month, compared to the active subscriptions at the end of the start of each month."),placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(mne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(xne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(one,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Vne,{data:l.value,loading:s.value},null,8,["data","loading"]),n(jne,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},Wne={key:1,class:"fct-report-order-summary"},Xne={class:"summary-item-inner"},Jne={class:"value"},Zne={class:"inner-value"},eoe={class:"title"},toe={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],l=K(()=>t.customerReport.loading),s=K(()=>a.map(i=>({key:i.key,title:i.title,value:t.customerReport.summary[i.key],fluctuation:t.customerReport.fluctuations[i.key]})));return(i,c)=>l.value?(r(),$(Ll,{key:0,count:s.value.length},null,8,["count"])):(r(),h("div",Wne,[(r(!0),h(O,null,ae(s.value,(p,m)=>(r(),h("div",{class:"summary-item",key:m},[o("div",Xne,[o("div",Jne,[o("div",Zne,f(A(ia)(p.value)),1),n(ml,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",eoe,f(p.title),1)])]))),128))]))}},aoe={class:"fct-revenue-line-chart-wrap"},loe={class:"flex items-center gap-2"},soe={class:"fct-card-header-title is-small"},noe={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},ooe={class:"chart-action-wrap"},ioe={class:"chart-change-wrap"},roe={class:"chart-change"},doe={class:"text"},uoe={class:"chart-change"},coe={class:"text"},Aoe={__name:"CustomerReportChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,required:!1},loading:{type:Boolean,required:!1}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(va.getChartType("revenue","revenue_chart")||"line"),i=V(!1),c=Te.colors.report,p=V(Te.isDark()),m=(T,Q,E,D,H)=>({name:T,type:Q,barMaxWidth:30,yAxisIndex:E,data:D,smooth:!1,color:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:H},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:H,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=V(a.appliedGroupKey);Ce(()=>a.appliedGroupKey,T=>{_.value=T});const g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),b=K(()=>{var Q;let T=[{name:u("Current Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(E=>E.customer_count)}];return C.value&&T.unshift({name:u("Compare Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:(Q=a.compareData)==null?void 0:Q.map(E=>({value:E.customer_count,date:E.group}))}),T.map(E=>m(E.name,E.type,0,E.data,E.color))});let w=null;const x=()=>{w&&(w.dispose(),w=null),Se(()=>{l.value&&(w=Jt(l.value),U())})},F=K(()=>{const T=Es(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+T}),L=K(()=>dl(a.chartData.length)),U=()=>{if(!w)return;const T=Ql(a.chartData),Q={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:E=>{let D="";const H=p.value?"#ffffff":"#565865";return E.forEach(function(P,G){const J=typeof P.data=="object"&&P.data!==null,oe=J?Us(P.data.date):P.name,Z=J?P.data.value:P.value,W=E.length>1&&G===0;W&&(D+='<div style="margin-bottom: 10px">'),D+=`<div>${oe}</div>`,D+=`<div> | |
| 237 | - ${P.marker} | |
| 238 | - <span style="color: ${H}">${u("Customer")}</span> | |
| 235 | + </div>`}),U}},grid:{show:!1},xAxis:{type:"category",data:D,axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,interval:S.value.interval},axisLine:{lineStyle:{type:"dashed",color:s.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",axisLabel:{color:s.value?"#ffffff":"#000000",fontSize:12,formatter:B=>`${B}%`},splitLine:{show:!0,lineStyle:{color:s.value?"#253241":"#D6DAE1",type:"dashed"}},splitNumber:2}],series:b.value};c.setOption(F,{notMerge:!0,replaceMerge:["series"]})},y=()=>{a.value=!a.value,a.value?c.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):g()},v=()=>{s.value=Te.isDark(),xe(()=>{g()})},w=D=>{ba.onChange("subscription","churn_chart",D),p.value!==D&&(a.value=!1,p.value=D,g())},k=K(()=>{var D;return((D=t.data)==null?void 0:D.retention_data)??[]}),b=K(()=>{const D=k.value.map((U,Q)=>{const V=Q>0?parseInt(k.value[Q-1].active_subscriptions)||0:parseInt(U.active_subscriptions)-parseInt(U.new_subscriptions)||0,I=parseInt(U.churned_subscriptions)||0;return V>0?(I/V*100).toFixed(2):0}),F=k.value.map((U,Q)=>{const V=Q>0?parseFloat(k.value[Q-1].mrr)||0:parseFloat(U.mrr)-parseFloat(U.new_subscriptions_mrr)||0,I=parseFloat(U.churned_subscriptions_mrr)||0;return V>0?(I/V*100).toFixed(2):0});return[{name:u("Subscription Churn"),type:p.value,color:s.value?l.dark_cyan_blue_16:l.light_gray,data:D},{name:u("MRR Churn"),type:p.value,color:s.value?l.dark_cyan_blue_36:l.light_gray_cyan_blue,data:F}].map((U,Q)=>f(U.name,U.type,0,U.data,U.color))}),S=K(()=>pl(k.value.length)),$=K(()=>!k.value||!k.value.length);return be([()=>t.data],()=>{xe(_)},{deep:!0}),be($,D=>{D||_()}),be(t.loading,D=>{D||_()}),Ie(()=>{xe(()=>{_()}),window.addEventListener("onFluentCartThemeChange",v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",v,!1)}),(D,F)=>{const B=C("el-skeleton");return r(),h("div",Uie,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Iie,[o("h4",Qie,m(A(u)("Churn Rate")),1)])]),_:2},[!$.value&&!e.loading?{name:"action",fn:d(()=>[o("div",Die,[n(Gl,{activeType:p.value,types:{line:"LineChart",bar:"BarChart"},onChange:w},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:D.$t("Zoom Chart"),onClick:y,class:de(a.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:i.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(B,{key:0,animated:"",rows:7,class:"px-4 pt-4"})):(r(),h(P,{key:1},[$.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[$.value?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:i},null,512)),o("div",Vie,[o("div",Tie,[o("div",Mie,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",Lie,m(A(u)("Data")),1)]),o("div",Rie,[o("span",Oie,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},Hie={class:"fct-retention-report-page"},Nie={class:"page-title"},Kie={__name:"RetentionReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const a=e.reportFilter,l=T({retention_data:[]}),s=T(!0),i=(c,p="monthly")=>{s.value=!0,Ae.get("reports/subscription-retention",{params:{...c.params,groupKey:p}}).then(f=>{l.value=f}).finally(()=>s.value=!1)};return Ie(()=>{i(a.applicableFilters),a.addListener("retention-report",i)}),(c,p)=>{const f=C("el-tooltip");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",Hie,[n(ol,null,{title:d(()=>[o("h1",Nie,[R(m(A(u)("Subscription Retention"))+" ",1),n(f,{"popper-class":"fct-tooltip",content:A(u)("Retention is calculated by looking at the active subscriptions at the end of each month, compared to the active subscriptions at the end of the start of each month."),placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:1}),n(uie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(bie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(tie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Eie,{data:l.value,loading:s.value},null,8,["data","loading"]),n(Pie,{data:l.value,loading:s.value},null,8,["data","loading"])])]),_:1})}}},Gie={key:1,class:"fct-report-order-summary"},zie={class:"summary-item-inner"},jie={class:"value"},qie={class:"inner-value"},Yie={class:"title"},Wie={__name:"Summary",props:{reportFilter:{type:Object},customerReport:{type:Object}},setup(e){const t=e,a=[{title:u("Customer Growth"),key:"customer_count"}],l=K(()=>t.customerReport.loading),s=K(()=>a.map(i=>({key:i.key,title:i.title,value:t.customerReport.summary[i.key],fluctuation:t.customerReport.fluctuations[i.key]})));return(i,c)=>l.value?(r(),E(Kl,{key:0,count:s.value.length},null,8,["count"])):(r(),h("div",Gie,[(r(!0),h(P,null,te(s.value,(p,f)=>(r(),h("div",{class:"summary-item",key:f},[o("div",zie,[o("div",jie,[o("div",qie,m(A(ua)(p.value)),1),n(vl,{fluctuation:p.fluctuation,"has-currency":!1,amount:t.customerReport.previousSummary[p.key]},null,8,["fluctuation","amount"])]),o("div",Yie,m(p.title),1)])]))),128))]))}},Jie={class:"fct-revenue-line-chart-wrap"},Xie={class:"flex items-center gap-2"},Zie={class:"fct-card-header-title is-small"},ere={class:"w-[270px] fct-btn-group sm gap-1.5 lg:gap-0"},tre={class:"chart-action-wrap"},are={class:"chart-change-wrap"},lre={class:"chart-change"},sre={class:"text"},nre={class:"chart-change"},ore={class:"text"},ire={__name:"CustomerReportChart",props:{chartData:{type:Array,required:!0},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,required:!1},loading:{type:Boolean,required:!1}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(ba.getChartType("revenue","revenue_chart")||"line"),i=T(!1),c=Te.colors.report,p=T(Te.isDark()),f=(V,I,M,O,L)=>({name:V,type:I,barMaxWidth:30,yAxisIndex:M,data:O,smooth:!1,color:L,lineStyle:{width:3},areaStyle:{opacity:.3,color:L},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:L,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(L)},lineStyle:{color:L},areaStyle:{opacity:.3,color:L}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T(a.appliedGroupKey);be(()=>a.appliedGroupKey,V=>{_.value=V});const{groupKeys:g}=fn(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{var I;let V=[{name:u("Current Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(M=>M.customer_count)}];return w.value&&V.unshift({name:u("Compare Range"),key:"customer_count",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:(I=a.compareData)==null?void 0:I.map(M=>({value:M.customer_count,date:M.group}))}),V.map(M=>f(M.name,M.type,0,M.data,M.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=na(l.value),F())})},$=K(()=>{const V=Ms(a.reportFilter.data.dateRange);return u("Customers that first ordered ")+V}),D=K(()=>pl(a.chartData.length)),F=()=>{if(!b)return;const V=Ol(a.chartData),I={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},alwaysShowContent:!1,formatter:M=>{let O="";const L=p.value?"#ffffff":"#565865";return M.forEach(function(H,j){const W=typeof H.data=="object"&&H.data!==null,G=W?Ls(H.data.date):H.name,Z=W?H.data.value:H.value,ne=M.length>1&&j===0;ne&&(O+='<div style="margin-bottom: 10px">'),O+=`<div>${G}</div>`,O+=`<div> | |
| 236 | + ${H.marker} | |
| 237 | + <span style="color: ${L}">${u("Customer")}</span> | |
| 238 | + <span style="float: right; margin-left: 20px; color: ${L}"> | |
| 239 | + ${ua(Z)} | |
| 240 | + </span> | |
| 241 | + </div>`,ne&&(O+="</div>")}),O}},grid:{show:!1},xAxis:{type:"category",data:V,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:D.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};b.setOption(I,{notMerge:!0,replaceMerge:["series"]})},B=()=>{i.value=!i.value,i.value?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):F()},U=V=>{ba.onChange("revenue","revenue_chart",V),s.value!==V&&(i.value=!1,s.value=V,F())};be([()=>a.chartData,_],()=>{xe(F)},{deep:!0}),be(()=>Nl.data.revenue,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,V=>{V||S()}),be(()=>a.loading,V=>{V||S()});const Q=()=>{p.value=Te.isDark(),xe(()=>{F()})};return Bt(()=>{window.removeEventListener("onFluentCartThemeChange",Q,!1)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",Q),xe(()=>{S()})}),(V,I)=>{const M=C("el-tooltip"),O=C("el-option"),L=C("el-select"),H=C("el-skeleton");return r(),h("div",Jie,[n(Se,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",Xie,[o("h5",Zie,m(A(u)("New Customers")),1),n(M,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",ere,[n(L,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":I[0]||(I[0]=j=>_.value=j),onChange:v},{default:d(()=>[(r(!0),h(P,null,te(A(g),j=>(r(),E(O,{key:j.value,label:A(u)(j.label),value:j.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),n(Gl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:B,class:de(i.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),E(H,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",tre,[o("div",are,[o("div",lre,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",sre,m(A(u)("Data")),1)]),o("div",nre,[o("span",ore,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},rre={name:"Comparison",components:{CardContainer:Se,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,required:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{var l;if(a<((l=this.previousMetrics)==null?void 0:l.length)){const s=this.previousMetrics[a],i=t.customer_count,c=s.customer_count,p=c?((i-c)/c*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:i,previous_count:c,percent_change:p})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Oa[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Oa[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},dre={class:"fct-revenue-comparison"},ure={class:"inline-flex"},cre={class:"inline-flex"};function Are(e,t,a,l,s,i){const c=C("CardHeader"),p=C("el-skeleton"),f=C("el-table-column"),_=C("el-table"),g=C("CardBody"),y=C("CardContainer");return r(),h("div",dre,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),E(p,{key:0,animated:"",rows:6,class:"p-5"})):(r(),E(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(f,{label:"Date"},{default:d(v=>[R(m(v.row.group),1)]),_:1}),n(f,{label:i.translate("Current Range")},{default:d(v=>[o("div",ure,m(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(P,{key:0},[n(f,{label:i.translate("Compare Range")},{default:d(v=>[o("div",cre,m(v.row.previous_count),1)]),_:1},8,["label"]),n(f,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},m(v.row.percent_change),3)]),_:1},8,["label"])],64)):x("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const pre=nt(rre,[["render",Are]]),fre={class:"fct-customer-report-page"},mre={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),l=T("default"),s=t.reportFilter,i=s.applicableFilters.params,c=(f,_="default")=>{a.value.loading=!0,Ae.get("reports/customer-report",{params:{...f,groupKey:_}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},p=f=>{l.value!==f&&(l.value=f,c(i,f))};return Ie(()=>{c(i),t.reportFilter.addListener("customer-report",f=>{c(f.params,l.value)})}),(f,_)=>(r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",fre,[n(ol,{title:A(u)("Customers")},null,8,["title"]),n(Wie,{reportFilter:A(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(ire,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:A(s),appliedGroupKey:l.value,onFilterData:p,"is-empty":!a.value.summary.customer_count,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(pre,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},hre="source_report";class _re extends tl{constructor(a={}){super();Pe(this,"data",{});this.initOptions=a}beforeInit(){this.data.advanceFilters=this.getStoredAdvanceFilters(),this.data.filterType=this.getStoredFilterType(),this.data.vueInstance=this.initOptions.instance||null,this.data.onApply=typeof this.initOptions.onApply=="function"?this.initOptions.onApply:null}getTableName(){return hre}getFilterTypeStorageName(){return`${this.getTableName()}_filter_type`}getAdvancedFilterStorageName(){return`${this.getTableName()}_advanced_filter`}getStoredAdvanceFilters(){const a=Vt.get(this.getAdvancedFilterStorageName());return!Array.isArray(a)||!a.length?[[]]:a}getStoredFilterType(){return this.isProActive()&&Vt.get(this.getFilterTypeStorageName())==="advanced"&&this.isAdvanceFilterEnabled()?"advanced":"simple"}storeAdvanceFilter(){Vt.set(this.getAdvancedFilterStorageName(),this.data.advanceFilters)}isProActive(){return ze.get("app_config.isProActive")}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}getAdvanceFilterOptions(){return dt.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.advance`)}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}onFilterTypeChanged(a){a==="simple"&&this.triggerApply(),Vt.set(this.getFilterTypeStorageName(),this.data.filterType)}applyAdvancedFilter(a=!1){if(!this.isProActive()){a||qc.showFeaturesCTA(u("Advanced Filter"),u("Advanced filter is only available in pro version"),[],this.data.vueInstance,"feature_lock_advanced_filtering"),this.storeAdvanceFilter();return}this.storeAdvanceFilter(),this.triggerApply()}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(a){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(a,1),this.storeAdvanceFilter()}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.applyAdvancedFilter(!0)}getQueryParams(){return this.isUsingAdvanceFilter()?{filter_type:"advanced",advanced_filters:JSON.stringify(this.data.advanceFilters)}:{filter_type:"simple"}}triggerApply(){this.data.onApply&&this.data.onApply()}}const vre={class:"fct-revenue-report-page"},gre={class:"fct-revenue-comparison fct-table-wrapper"},yre={class:"fct-card"},bre={class:"fct-card-header"},wre={class:"fct-card-header-top"},Cre={key:0,class:"fct-card-header-left flex-1"},kre={class:"search-bar is-transparent"},Bre={class:"text-xs text-system-light pt-1 dark:text-gray-300"},xre={key:1,class:"flex-1"},Sre={class:"fct-card-header-actions"},Fre={key:0,class:"fct-advanced-filter-toggle-wrapper"},$re={class:"w-[130px]"},Ere={class:"fct-btn-group sm"},Ure={class:"filter-popover-item"},Ire={class:"filter-popover-title"},Qre={class:"fct-card-body"},Dre={key:1},Vre={key:2,class:"unknown"},Tre={key:1},Mre={key:2,class:"unknown"},Lre={key:1},Rre={key:2,class:"unknown"},Ore={key:1},Pre={key:2,class:"unknown"},Hre={key:1},Nre={key:2,class:"unknown"},Kre={key:1},Gre={key:2,class:"unknown"},zre={class:"inline-flex items-center gap-2"},jre={class:"inline-flex items-center gap-2"},qre={class:"inline-flex items-center gap-2"},Yre={class:"inline-flex items-center gap-2"},Wre={class:"inline-flex items-center gap-2"},Jre=4,Xre={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=T([]),l=T({}),s=T(!1),i=T({utm_campaign:u("UTM Campaign"),utm_source:u("UTM Source"),utm_medium:u("UTM Medium"),utm_term:u("UTM Term"),utm_content:u("UTM Content"),utm_id:u("UTM ID")}),c=T(["utm_campaign","utm_source","utm_medium"]),p=T(!0),f=T(""),_=K(()=>a.value.filter(S=>{if(!f.value)return!0;const $=f.value.toLowerCase();return S.utm_campaign&&S.utm_campaign.toLowerCase().includes($)||S.utm_source&&S.utm_source.toLowerCase().includes($)||S.utm_medium&&S.utm_medium.toLowerCase().includes($)||S.utm_term&&S.utm_term.toLowerCase().includes($)||S.utm_content&&S.utm_content.toLowerCase().includes($)||S.utm_id&&S.utm_id.toLowerCase().includes($)}));let g=0;const y=()=>{const S=++g;p.value=!0;const $={params:{...t.reportFilter.applicableFilters.params,...v.getQueryParams()}};Ae.get("/reports/sources",$).then(D=>{S===g&&(a.value=D.sourceReportData,l.value=D.fluctuations||{})}).catch(D=>{var F;S===g&&q.error(((F=D==null?void 0:D.data)==null?void 0:F.message)||u("Failed to load the order sources report"))}).finally(()=>{S===g&&(p.value=!1)})},v=_re.init({instance:Jt(),onApply:()=>y()}),w=K(()=>!v.isUsingAdvanceFilter()),k=S=>{S==="advanced"&&(f.value=""),v.onFilterTypeChanged(S)},b=S=>c.value.includes(S)?!1:c.value.length>=Jre;return Ie(()=>{y(),t.reportFilter.addListener("product-top-chart",()=>{y()})}),(S,$)=>{const D=C("el-input"),F=C("el-switch"),B=C("el-checkbox"),U=C("el-checkbox-group"),Q=C("el-tooltip"),V=C("el-popover"),I=C("el-skeleton"),M=C("el-table-column"),O=C("el-table");return r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",vre,[n(ol,{title:A(u)("Order Sources")},null,8,["title"]),o("div",gre,[o("div",yre,[o("div",bre,[o("div",wre,[A(v).isUsingAdvanceFilter()?(r(),h("div",xre)):(r(),h("div",Cre,[o("div",kre,[n(D,{placeholder:A(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:f.value,"onUpdate:modelValue":$[0]||($[0]=L=>f.value=L)},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",Bre,m(A(u)("Filter results by UTM values")),1)])),o("div",Sre,[A(v).isAdvanceFilterEnabled()?(r(),h("div",Fre,[n(F,{class:"fct-advanced-filter-toggle",onChange:$[1]||($[1]=L=>{k(L)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(v).data.filterType,"onUpdate:modelValue":$[2]||($[2]=L=>A(v).data.filterType=L),"active-text":A(u)("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),o("div",$re,[n(F,{modelValue:s.value,"onUpdate:modelValue":$[3]||($[3]=L=>s.value=L),"active-text":A(u)("Net"),"inactive-text":A(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",Ere,[n(V,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(Q,{effect:"light",content:A(u)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button"},{default:d(()=>[n(Y,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",Ure,[o("h3",Ire,m(S.$t("Columns")),1),n(U,{class:"fct-checkbox-blocks",modelValue:c.value,"onUpdate:modelValue":$[4]||($[4]=L=>c.value=L)},{default:d(()=>[(r(!0),h(P,null,te(i.value,(L,H)=>(r(),E(B,{label:L,value:H,disabled:b(H)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])]),n(Yc,{table:A(v),"show-save-view":!1},null,8,["table"])]),o("div",Qre,[p.value?(r(),E(I,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),E(O,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:d(()=>[n(Ct,{icon:"Empty/Order","has-dark":"",text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[c.value.includes("utm_campaign")?(r(),E(M,{key:0,label:A(u)("UTM Campaign"),width:"180"},{default:d(L=>[L.row.utm_campaign&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_campaign},{default:d(()=>[R(m(L.row.utm_campaign),1)]),_:2},1032,["onClick"])):L.row.utm_campaign?(r(),h("span",Dre,m(L.row.utm_campaign),1)):(r(),h("span",Vre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),c.value.includes("utm_source")?(r(),E(M,{key:1,label:A(u)("UTM Source"),width:"150"},{default:d(L=>[L.row.utm_source&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_source},{default:d(()=>[R(m(L.row.utm_source),1)]),_:2},1032,["onClick"])):L.row.utm_source?(r(),h("span",Tre,m(L.row.utm_source),1)):(r(),h("span",Mre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),c.value.includes("utm_medium")?(r(),E(M,{key:2,label:A(u)("UTM Medium"),width:"150"},{default:d(L=>[L.row.utm_medium&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_medium},{default:d(()=>[R(m(L.row.utm_medium),1)]),_:2},1032,["onClick"])):L.row.utm_medium?(r(),h("span",Lre,m(L.row.utm_medium),1)):(r(),h("span",Rre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),c.value.includes("utm_term")?(r(),E(M,{key:3,label:A(u)("UTM Term"),width:"150"},{default:d(L=>[L.row.utm_term&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_term},{default:d(()=>[R(m(L.row.utm_term),1)]),_:2},1032,["onClick"])):L.row.utm_term?(r(),h("span",Ore,m(L.row.utm_term),1)):(r(),h("span",Pre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),c.value.includes("utm_content")?(r(),E(M,{key:4,label:A(u)("UTM Content"),width:"150"},{default:d(L=>[L.row.utm_content&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_content},{default:d(()=>[R(m(L.row.utm_content),1)]),_:2},1032,["onClick"])):L.row.utm_content?(r(),h("span",Hre,m(L.row.utm_content),1)):(r(),h("span",Nre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),c.value.includes("utm_id")?(r(),E(M,{key:5,label:A(u)("UTM ID"),width:"100"},{default:d(L=>[L.row.utm_id&&w.value?(r(),E(A(Os),{key:0,class:"font-normal",underline:"always",onClick:H=>f.value=L.row.utm_id},{default:d(()=>[R(m(L.row.utm_id),1)]),_:2},1032,["onClick"])):L.row.utm_id?(r(),h("span",Kre,m(L.row.utm_id),1)):(r(),h("span",Gre,m(A(u)("Unknown")),1))]),_:1},8,["label"])):x("",!0),n(M,{label:A(u)("Orders"),width:"200"},{default:d(L=>{var H,j;return[o("div",zre,[R(m(A(ua)(L.row.orders))+" ",1),n(vl,{class:"flex",fluctuation:((H=l.value[L.row.utm_key])==null?void 0:H.orders_fluctuation)||0,amount:((j=l.value[L.row.utm_key])==null?void 0:j.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),h(P,{key:6},[n(M,{label:A(u)("Net Sales"),width:"200"},{default:d(L=>{var H,j;return[o("div",jre,[R(m(A(ft).scaled(L.row.net_sales))+" ",1),n(vl,{class:"flex",fluctuation:((H=l.value[L.row.utm_key])==null?void 0:H.net_sales_fluctuation)||0,amount:((j=l.value[L.row.utm_key])==null?void 0:j.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(M,{label:A(u)("Average Order Net"),width:"200"},{default:d(L=>{var H,j;return[o("div",qre,[R(m(A(ft).scaled(L.row.average_net_order))+" ",1),n(vl,{class:"flex",fluctuation:((H=l.value[L.row.utm_key])==null?void 0:H.average_net_order_fluctuation)||0,amount:((j=l.value[L.row.utm_key])==null?void 0:j.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(P,{key:7},[n(M,{label:A(u)("Gross Sales"),width:"200"},{default:d(L=>{var H,j;return[o("div",Yre,[R(m(A(ft).scaled(L.row.gross_sales))+" ",1),n(vl,{class:"flex",fluctuation:((H=l.value[L.row.utm_key])==null?void 0:H.gross_sales_fluctuation)||0,amount:((j=l.value[L.row.utm_key])==null?void 0:j.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(M,{label:A(u)("Average Order"),width:"200"},{default:d(L=>{var H,j;return[o("div",Wre,[R(m(A(ft).scaled(L.row.average_order))+" ",1),n(vl,{class:"flex",fluctuation:((H=l.value[L.row.utm_key])==null?void 0:H.average_order_fluctuation)||0,amount:((j=l.value[L.row.utm_key])==null?void 0:j.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},Zre={class:"fct-revenue-line-chart-wrap"},ede={class:"flex items-center gap-2"},tde={class:"fct-card-header-title is-small"},ade={class:"fct-chart-select"},lde={class:"fct-btn-group sm"},sde={class:"chart-action-wrap"},nde={class:"chart-change-wrap"},ode={class:"chart-change"},ide={class:"text"},rde={class:"chart-change"},dde={class:"text"},ude={__name:"ProductReportChart",props:{chartData:{type:Array,required:!0,default:()=>[]},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=T(null),s=T(ba.getChartType("product","product_chart")||"bar"),i=T(!1),c=Te.colors.report,p=T(Te.isDark()),f=(I,M,O,L,H)=>({name:I,type:M,barMaxWidth:30,yAxisIndex:O,data:L,smooth:!1,color:H,lineStyle:{width:3},areaStyle:{opacity:.3,color:H},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:H,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:ja(H)},lineStyle:{color:H},areaStyle:{opacity:.3,color:H}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=T("default"),{groupKeys:g}=fn(a.reportFilter,_),y=t,v=()=>{y("filter-data",_.value)},w=K(()=>a.reportFilter.data.compareType!=="no_comparison"),k=K(()=>{let I=[{name:u("Current Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(M=>M.units_sold)}];return w.value&&I.unshift({name:u("Compare Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(M=>({value:M.units_sold,date:M.group}))}),I.map(M=>f(M.name,M.type,0,M.data,M.color))});let b=null;const S=()=>{b&&(b.dispose(),b=null),xe(()=>{l.value&&(b=na(l.value),F())})},$=K(()=>{const I=Ms(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+I}),D=K(()=>pl(a.chartData.length)),F=()=>{if(!b)return;const I=Ol(a.chartData),M={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:O=>{let L="";const H=p.value?"#ffffff":"#565865";return O.forEach(function(j,W){const G=typeof j.data=="object"&&j.data!==null,Z=G?Ls(j.data.date):j.name,ne=G?j.data.value:j.value,ce=O.length>1&&W===0;ce&&(L+='<div style="margin-bottom: 10px">'),L+=`<div>${Z}</div>`,L+=`<div> | |
| 242 | + ${j.marker} | |
| 243 | + <span style="color: ${H}">${u("Units Sold")}</span> | |
| 239 | 244 | <span style="float: right; margin-left: 20px; color: ${H}"> |
| 240 | - ${ia(Z)} | |
| 245 | + ${ua(ne)} | |
| 241 | 246 | </span> |
| 242 | - </div>`,W&&(D+="</div>")}),D}},grid:{show:!1},xAxis:{type:"category",data:T,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:L.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(Q,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):U()},M=T=>{va.onChange("revenue","revenue_chart",T),s.value!==T&&(i.value=!1,s.value=T,U())};Ce([()=>a.chartData,_],()=>{Se(U)},{deep:!0}),Ce(()=>Ml.data.revenue,()=>{Se(()=>{U()})},{deep:!0}),Ce(()=>a.isEmpty,T=>{T||x()}),Ce(()=>a.loading,T=>{T||x()});const I=()=>{p.value=Te.isDark(),Se(()=>{U()})};return Ct(()=>{window.removeEventListener("onFluentCartThemeChange",I,!1)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",I),Se(()=>{x()})}),(T,Q)=>{const E=B("el-tooltip"),D=B("el-option"),H=B("el-select"),P=B("el-skeleton");return r(),h("div",aoe,[n(xe,null,{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",loe,[o("h5",soe,f(A(u)("New Customers")),1),n(E,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-help",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",noe,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":Q[0]||(Q[0]=G=>_.value=G),onChange:v},{default:d(()=>[(r(),h(O,null,ae(g,G=>n(D,{key:G.value,label:A(u)(G.label),value:G.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:M},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:de(i.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0 pt-0"},{default:d(()=>[e.loading?(r(),$(P,{key:0,animated:"",rows:6,class:"p-5"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[o("div",{class:"fct-chart-wrap fct-revenue-line-chart mt-3",ref_key:"chartRef",ref:l},null,512),o("div",ooe,[o("div",ioe,[o("div",roe,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",doe,f(A(u)("Data")),1)]),o("div",uoe,[o("span",coe,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},poe={name:"Comparison",components:{CardContainer:xe,CardHeader:Ve,CardBody:ke},props:{currentMetrics:{type:Array},previousMetrics:{type:Array},reportFilter:{type:Object},hasComparison:{type:Boolean},loading:{type:Boolean,required:!0}},data(){return{}},computed:{currencySign(){return this.reportFilter.currentCurrencySign},comparisonData(){const e=[];return this.hasComparison?(this.currentMetrics.forEach((t,a)=>{var l;if(a<((l=this.previousMetrics)==null?void 0:l.length)){const s=this.previousMetrics[a],i=t.customer_count,c=s.customer_count,p=c?((i-c)/c*100).toFixed(2):"n/a";e.push({group:`${this.formatDate(t.group)} vs ${this.formatDate(s.group)}`,count:i,previous_count:c,percent_change:p})}}),e):this.currentMetrics}},methods:{translate:u,getPercentageClass(e){return e>0?"text-success-500":e<0?"text-red-500":"text-system-light"},formatDate(e){const t=e.split("-");if(t.length===3){const[a,l,s]=t;return`${Ha[parseInt(l)-1]} ${s}, ${a}`}else if(t.length===2){const[a,l]=t;return`${Ha[parseInt(l)-1]} ${a}`}else if(t.length===1){const[a]=t;return`${a}`}}}},foe={class:"fct-revenue-comparison"},moe={class:"inline-flex"},hoe={class:"inline-flex"};function _oe(e,t,a,l,s,i){const c=B("CardHeader"),p=B("el-skeleton"),m=B("el-table-column"),_=B("el-table"),g=B("CardBody"),y=B("CardContainer");return r(),h("div",foe,[n(y,{class:"overflow-hidden"},{default:d(()=>[n(c,{title:i.translate("Comparison"),title_size:"small"},null,8,["title"]),n(g,{class:"px-0 pb-0"},{default:d(()=>[a.loading?(r(),$(p,{key:0,animated:"",rows:6,class:"p-5"})):(r(),$(_,{key:1,data:i.comparisonData,class:"w-full",maxHeight:"390"},{default:d(()=>[n(m,{label:"Date"},{default:d(v=>[R(f(v.row.group),1)]),_:1}),n(m,{label:i.translate("Current Range")},{default:d(v=>[o("div",moe,f(v.row.count),1)]),_:1},8,["label"]),a.hasComparison?(r(),h(O,{key:0},[n(m,{label:i.translate("Compare Range")},{default:d(v=>[o("div",hoe,f(v.row.previous_count),1)]),_:1},8,["label"]),n(m,{label:i.translate("Change")+" (%)"},{default:d(v=>[o("span",{class:de(i.getPercentageClass(v.row.percent_change))},f(v.row.percent_change),3)]),_:1},8,["label"])],64)):k("",!0)]),_:1},8,["data"]))]),_:1})]),_:1})])}const voe=lt(poe,[["render",_oe]]),goe={class:"fct-customer-report-page"},yoe={__name:"CustomerReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V({summary:{},previousSummary:{},fluctuations:{},currentMetrics:[],previousMetrics:[],loading:!0}),l=V("default"),s=t.reportFilter,i=s.applicableFilters.params,c=(m,_="default")=>{a.value.loading=!0,ce.get("reports/customer-report",{params:{...m,groupKey:_}}).then(g=>{a.value=g}).finally(()=>{a.value.loading=!1})},p=m=>{l.value!==m&&(l.value=m,c(i,m))};return Qe(()=>{c(i),t.reportFilter.addListener("customer-report",m=>{c(m.params,l.value)})}),(m,_)=>(r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",goe,[n(ll,{title:A(u)("Customers")},null,8,["title"]),n(toe,{reportFilter:A(s),customerReport:a.value},null,8,["reportFilter","customerReport"]),n(Aoe,{chartData:a.value.currentMetrics,compareData:a.value.previousMetrics,reportFilter:A(s),appliedGroupKey:l.value,onFilterData:p,"is-empty":!a.value.summary.customer_count,loading:a.value.loading},null,8,["chartData","compareData","reportFilter","appliedGroupKey","is-empty","loading"]),n(voe,{class:"my-7.5",currentMetrics:a.value.currentMetrics,previousMetrics:a.value.previousMetrics,hasComparison:t.reportFilter.data.compareType!=="no_comparison",reportFilter:A(s),loading:a.value.loading},null,8,["currentMetrics","previousMetrics","hasComparison","reportFilter","loading"])])]),_:1}))}},boe={class:"fct-revenue-report-page"},woe={class:"fct-revenue-comparison fct-table-wrapper"},Coe={class:"fct-card"},Boe={class:"fct-card-header"},koe={class:"fct-card-header-top"},xoe={class:"fct-card-header-left flex-1"},Soe={class:"search-bar is-transparent"},Foe={class:"text-xs text-system-light pt-1 dark:text-gray-300"},$oe={class:"fct-card-header-actions"},Eoe={class:"w-[130px]"},Uoe={class:"fct-btn-group sm"},Ioe={class:"filter-popover-item"},Qoe={class:"filter-popover-title"},Doe={class:"fct-card-body"},Voe={key:1,class:"unknown"},Toe={key:1,class:"unknown"},Moe={key:1,class:"unknown"},Loe={key:1,class:"unknown"},Roe={key:1,class:"unknown"},Ooe={key:1,class:"unknown"},Hoe={class:"inline-flex items-center gap-2"},Poe={class:"inline-flex items-center gap-2"},Noe={class:"inline-flex items-center gap-2"},Koe={class:"inline-flex items-center gap-2"},Goe={class:"inline-flex items-center gap-2"},joe=4,zoe={__name:"SourcesReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=V([]),l=V({}),s=V(!1),i=V({utm_campaign:u("UTM Campaign"),utm_source:u("UTM Source"),utm_medium:u("UTM Medium"),utm_term:u("UTM Term"),utm_content:u("UTM Content"),utm_id:u("UTM ID")}),c=V(["utm_campaign","utm_source","utm_medium"]),p=V(!0),m=V(""),_=K(()=>a.value.filter(v=>{if(!m.value)return!0;const C=m.value.toLowerCase();return v.utm_campaign&&v.utm_campaign.toLowerCase().includes(C)||v.utm_source&&v.utm_source.toLowerCase().includes(C)||v.utm_medium&&v.utm_medium.toLowerCase().includes(C)||v.utm_term&&v.utm_term.toLowerCase().includes(C)||v.utm_content&&v.utm_content.toLowerCase().includes(C)||v.utm_id&&v.utm_id.toLowerCase().includes(C)})),g=()=>{p.value=!0,ce.get("/reports/sources",t.reportFilter.applicableFilters).then(v=>{a.value=v.sourceReportData,l.value=v.fluctuations||{}}).finally(()=>{p.value=!1})},y=v=>c.value.includes(v)?!1:c.value.length>=joe;return Qe(()=>{g(),t.reportFilter.addListener("product-top-chart",()=>{g()})}),(v,C)=>{const b=B("el-input"),w=B("el-switch"),x=B("el-checkbox"),F=B("el-checkbox-group"),L=B("el-tooltip"),U=B("el-popover"),S=B("el-skeleton"),M=B("el-table-column"),I=B("el-table");return r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",boe,[n(ll,{title:A(u)("Order Sources")},null,8,["title"]),o("div",woe,[o("div",Coe,[o("div",Boe,[o("div",koe,[o("div",xoe,[o("div",Soe,[n(b,{placeholder:A(u)("Search"),ref:"search-input",type:"text",clearable:"",modelValue:m.value,"onUpdate:modelValue":C[0]||(C[0]=T=>m.value=T)},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["placeholder","modelValue"])]),o("div",Foe,f(A(u)("Filter results by UTM values")),1)]),o("div",$oe,[o("div",Eoe,[n(w,{modelValue:s.value,"onUpdate:modelValue":C[1]||(C[1]=T=>s.value=T),"active-text":A(u)("Net"),"inactive-text":A(u)("Gross")},null,8,["modelValue","active-text","inactive-text"])]),o("div",Uoe,[n(U,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(L,{effect:"light",content:A(u)("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button"},{default:d(()=>[n(ee,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",Ioe,[o("h3",Qoe,f(v.$t("Columns")),1),n(F,{class:"fct-checkbox-blocks",modelValue:c.value,"onUpdate:modelValue":C[2]||(C[2]=T=>c.value=T)},{default:d(()=>[(r(!0),h(O,null,ae(i.value,(T,Q)=>(r(),$(x,{label:T,value:Q,disabled:y(Q)},null,8,["label","value","disabled"]))),256))]),_:1},8,["modelValue"])])]),_:1})])])])]),o("div",Doe,[p.value?(r(),$(S,{key:0,class:"px-5 pb-5",rows:5,animated:""})):(r(),$(I,{key:1,data:_.value,class:"w-full fct-source-report"},{empty:d(()=>[n(_t,{icon:"Empty/Order","has-dark":"",text:A(u)("No data available")},null,8,["text"])]),default:d(()=>[c.value.includes("utm_campaign")?(r(),$(M,{key:0,label:A(u)("UTM Campaign"),width:"180"},{default:d(T=>[T.row.utm_campaign?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_campaign},{default:d(()=>[R(f(T.row.utm_campaign),1)]),_:2},1032,["onClick"])):(r(),h("span",Voe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_source")?(r(),$(M,{key:1,label:A(u)("UTM Source"),width:"150"},{default:d(T=>[T.row.utm_source?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_source},{default:d(()=>[R(f(T.row.utm_source),1)]),_:2},1032,["onClick"])):(r(),h("span",Toe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_medium")?(r(),$(M,{key:2,label:A(u)("UTM Medium"),width:"150"},{default:d(T=>[T.row.utm_medium?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_medium},{default:d(()=>[R(f(T.row.utm_medium),1)]),_:2},1032,["onClick"])):(r(),h("span",Moe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_term")?(r(),$(M,{key:3,label:A(u)("UTM Term"),width:"150"},{default:d(T=>[T.row.utm_term?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_term},{default:d(()=>[R(f(T.row.utm_term),1)]),_:2},1032,["onClick"])):(r(),h("span",Loe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_content")?(r(),$(M,{key:4,label:A(u)("UTM Content"),width:"150"},{default:d(T=>[T.row.utm_content?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_content},{default:d(()=>[R(f(T.row.utm_content),1)]),_:2},1032,["onClick"])):(r(),h("span",Roe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),c.value.includes("utm_id")?(r(),$(M,{key:5,label:A(u)("UTM ID"),width:"100"},{default:d(T=>[T.row.utm_id?(r(),$(A(Qs),{key:0,class:"font-normal",underline:"always",onClick:Q=>m.value=T.row.utm_id},{default:d(()=>[R(f(T.row.utm_id),1)]),_:2},1032,["onClick"])):(r(),h("span",Ooe,f(A(u)("Unknown")),1))]),_:1},8,["label"])):k("",!0),n(M,{label:A(u)("Orders"),width:"200"},{default:d(T=>{var Q,E;return[o("div",Hoe,[R(f(A(ia)(T.row.orders))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[T.row.utm_key])==null?void 0:Q.orders_fluctuation)||0,amount:((E=l.value[T.row.utm_key])==null?void 0:E.previous_orders)||0,"has-currency":!1},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),s.value?(r(),h(O,{key:6},[n(M,{label:A(u)("Net Sales"),width:"200"},{default:d(T=>{var Q,E;return[o("div",Poe,[R(f(A(Je).scaled(T.row.net_sales))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[T.row.utm_key])==null?void 0:Q.net_sales_fluctuation)||0,amount:((E=l.value[T.row.utm_key])==null?void 0:E.previous_net_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(M,{label:A(u)("Average Order Net"),width:"200"},{default:d(T=>{var Q,E;return[o("div",Noe,[R(f(A(Je).scaled(T.row.average_net_order))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[T.row.utm_key])==null?void 0:Q.average_net_order_fluctuation)||0,amount:((E=l.value[T.row.utm_key])==null?void 0:E.previous_average_net_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64)):(r(),h(O,{key:7},[n(M,{label:A(u)("Gross Sales"),width:"200"},{default:d(T=>{var Q,E;return[o("div",Koe,[R(f(A(Je).scaled(T.row.gross_sales))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[T.row.utm_key])==null?void 0:Q.gross_sales_fluctuation)||0,amount:((E=l.value[T.row.utm_key])==null?void 0:E.previous_gross_sales)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"]),n(M,{label:A(u)("Average Order"),width:"200"},{default:d(T=>{var Q,E;return[o("div",Goe,[R(f(A(Je).scaled(T.row.average_order))+" ",1),n(ml,{class:"flex",fluctuation:((Q=l.value[T.row.utm_key])==null?void 0:Q.average_order_fluctuation)||0,amount:((E=l.value[T.row.utm_key])==null?void 0:E.previous_average_order)||0},null,8,["fluctuation","amount"])])]}),_:1},8,["label"])],64))]),_:1},8,["data"]))])])])])]),_:1})}}},qoe={class:"fct-revenue-line-chart-wrap"},Yoe={class:"flex items-center gap-2"},Woe={class:"fct-card-header-title is-small"},Xoe={class:"fct-chart-select"},Joe={class:"fct-btn-group sm"},Zoe={class:"chart-action-wrap"},eie={class:"chart-change-wrap"},tie={class:"chart-change"},aie={class:"text"},lie={class:"chart-change"},sie={class:"text"},nie={__name:"ProductReportChart",props:{chartData:{type:Array,required:!0,default:()=>[]},compareData:{type:Array,required:!0},reportFilter:{type:Object},appliedGroupKey:{type:String},isEmpty:{type:Boolean,default:!1},loading:{type:Boolean,default:!0}},emits:["filter-data"],setup(e,{emit:t}){const a=e,l=V(null),s=V(va.getChartType("product","product_chart")||"bar"),i=V(!1),c=Te.colors.report,p=V(Te.isDark()),m=(Q,E,D,H,P)=>({name:Q,type:E,barMaxWidth:30,yAxisIndex:D,data:H,smooth:!1,color:P,lineStyle:{width:3},areaStyle:{opacity:.3,color:P},symbol:"circle",showSymbol:!0,symbolSize:8,itemStyle:{color:P,borderRadius:[4,4,0,0]},emphasis:{scale:2,itemStyle:{color:za(P)},lineStyle:{color:P},areaStyle:{opacity:.3,color:P}},animation:!0,animationEasing:"cubicOut",animationDuration:800,animationDelay:0,barGap:"-100%",legendHoverLink:!1}),_=V("default"),g=[{label:"Default",value:"default"},{label:"Monthly",value:"monthly"},{label:"Yearly",value:"yearly"}],y=t,v=()=>{y("filter-data",_.value)},C=K(()=>a.reportFilter.data.compareType!=="no_comparison"),b=K(()=>{let Q=[{name:u("Current Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_36:c.light_gray_cyan_blue,data:a.chartData.map(E=>E.units_sold)}];return C.value&&Q.unshift({name:u("Compare Range"),key:"units_sold",type:s.value,color:p.value?c.dark_cyan_blue_16:c.light_gray,data:a.compareData.map(E=>({value:E.units_sold,date:E.group}))}),Q.map(E=>m(E.name,E.type,0,E.data,E.color))});let w=null;const x=()=>{w&&(w.dispose(),w=null),Se(()=>{l.value&&(w=Jt(l.value),U())})},F=K(()=>{const Q=Es(a.reportFilter.data.dateRange);return u("This report looks at the units sold ")+Q}),L=K(()=>dl(a.chartData.length)),U=()=>{if(!w)return;const Q=Ql(a.chartData),E={title:{text:"",left:"center"},legend:{show:!0,itemGap:20,itemWidth:10,itemHeight:10,textStyle:{color:p.value?"#ffffff":"#000000"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.dark_cyan_blue_16:c.light_gray_blue}},formatter:D=>{let H="";const P=p.value?"#ffffff":"#565865";return D.forEach(function(G,J){const oe=typeof G.data=="object"&&G.data!==null,Z=oe?Us(G.data.date):G.name,W=oe?G.data.value:G.value,pe=D.length>1&&J===0;pe&&(H+='<div style="margin-bottom: 10px">'),H+=`<div>${Z}</div>`,H+=`<div> | |
| 243 | - ${G.marker} | |
| 244 | - <span style="color: ${P}">${u("Units Sold")}</span> | |
| 245 | - <span style="float: right; margin-left: 20px; color: ${P}"> | |
| 246 | - ${ia(W)} | |
| 247 | + </div>`,ce&&(L+="</div>")}),L}},grid:{show:!1},xAxis:{type:"category",data:I,splitNumber:D.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:D.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:k.value};b.setOption(M,{notMerge:!0,replaceMerge:["series"]})},B=()=>{i.value=!i.value,i.value&&b?b.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):b&&F()},U=I=>{ba.onChange("revenue","revenue_chart",I),s.value!==I&&(i.value=!1,s.value=I,F())};be([()=>a.chartData,_],()=>{xe(()=>{F()})},{deep:!0}),be(()=>Nl.data.product,()=>{xe(()=>{F()})},{deep:!0}),be(()=>a.isEmpty,I=>{I||S()}),be(()=>a.loading,I=>{I||S()});const Q=()=>{b&&b.resize()},V=()=>{p.value=Te.isDark(),xe(()=>{F()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",V),window.addEventListener("resize",Q),setTimeout(()=>{S()},100)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",V,!1),window.removeEventListener("resize",Q),b&&(b.dispose(),b=null)}),(I,M)=>{const O=C("el-tooltip"),L=C("el-option"),H=C("el-select"),j=C("el-skeleton");return r(),h("div",Zre,[n(Se,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},oa({title:d(()=>[o("div",ede,[o("h5",tde,m(A(u)("Product Report Chart")),1),n(O,{"popper-class":"fct-tooltip",content:$.value,placement:"top"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",ade,[n(H,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":M[0]||(M[0]=W=>_.value=W),onChange:v},{default:d(()=>[(r(!0),h(P,null,te(A(g),W=>(r(),E(L,{key:W.value,label:A(u)(W.label),value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),o("div",lde,[n(Gl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),n(at,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:B,class:de(i.value?"primary":"")},{default:d(()=>[n(Y,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(Sa,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),E(j,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(P,{key:1},[e.isEmpty?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[e.isEmpty?x("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",sde,[o("div",nde,[o("div",ode,[n(Y,{name:"ArrowUp",class:"arrow-up"}),o("span",ide,m(A(u)("Data")),1)]),o("div",rde,[o("span",dde,m(A(u)("Timeline")),1),n(Y,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},cde=nt(ude,[["__scopeId","data-v-8add5f1e"]]);class Ade extends tl{constructor(){super(...arguments);Pe(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,l,s,i){this.data.isBusy=!0,typeof l!="object"&&(l={});const c=Ae.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy=!1})}getReportData(a={}){return this.makeRequest("net-revenue",a,"data","revenueReport")}getReportByGroup(a={}){return this.makeRequest("net-revenue-by-group",a,"data","netRevenueByGroup")}getProductReportData(a={}){return this.makeRequest("product-report",a)}getSummary(a={}){return this.makeRequest("product-report-summary",a)}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const Bl=Ade.init(),pde={class:"summary-item-inner"},fde={class:"value"},mde={class:"inner-value"},hde={class:"title"},_de={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:u("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:u("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:u("Gross sales less refunds, taxes, shipping, fees.")}],l=K(()=>Bl.data.isBusy),s=K(()=>a.map(p=>({key:p.key,title:p.title,value:Bl.data.summary[p.key]||0,fluctuation:Bl.data.fluctuations[p.key]||0,info:p.info,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),i=K(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),c=p=>i.value.includes(p.key)?Ul(p.value,p.liability):ua(p.value);return(p,f)=>{const _=C("el-tooltip");return l.value?(r(),E(Kl,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:de(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(P,null,te(s.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",pde,[o("div",fde,[o("div",mde,[n(Rs,{amount:c(g),title:g.title},null,8,["amount","title"])]),n(vl,{fluctuation:g.fluctuation,amount:A(Bl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",hde,[R(m(A(u)(g.title))+" ",1),n(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(Y,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},vde={class:"fct-product-performance-chart"},gde={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},yde={class:"flex items-center gap-3 flex-wrap"},bde={class:"selector-group"},wde={class:"vs-pill inline-flex items-center justify-center px-2 h-6 bg-gray-100 rounded-[12px] font-xs font-medium text-uppercase dark:bg-primary-500"},Cde={class:"selector-group"},kde={key:0,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},Bde={class:"text-xs font-medium text-gray-500"},xde={key:1,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},Sde={class:"text-xs font-medium text-gray-500"},Fde={key:0,class:"comparison-results"},$de={class:"legend flex items-center gap-4 mb-4"},Ede={class:"flex items-center"},Ude={class:"text-xs text-gray-600"},Ide={class:"flex items-center"},Qde={class:"text-xs text-gray-600"},Dde={class:"comparison-table"},Vde={class:"w-full"},Tde={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Mde={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Lde={class:"w-[40%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Rde={class:"w-[10%] text-right font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Ode={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Pde={class:"py-3"},Hde={class:"dual-bar-container"},Nde={class:"bar-label"},Kde={class:"dual-bar-wrapper"},Gde=["onMouseenter"],zde=["onMouseenter"],jde={class:"py-3 text-right"},qde={key:0},Yde={colspan:"3",class:"py-4 text-center text-gray-500"},Wde={class:"text-sm"},Jde={key:1,class:"current-period-data"},Xde={class:"legend flex items-center gap-4 mb-4"},Zde={class:"flex items-center"},eue={class:"text-xs text-gray-600"},tue={class:"current-period-table"},aue={class:"w-full"},lue={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},sue={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},nue={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},oue={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},iue={class:"py-3"},rue={class:"single-bar-container"},due=["onMouseenter"],uue={class:"single-bar-wrapper"},cue=["onMouseenter"],Aue={key:0},pue={colspan:"2",class:"py-4 text-center text-gray-500"},fue={class:"text-sm"},mue={key:2,class:"no-comparison-message"},hue={class:"flex flex-col items-center justify-center text-center py-8"},_ue={class:"text-gray-500 text-sm"},vue={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){Jf(ie=>({"0b3f8aef":a.value?"#1C2732":"#F9FAFB","0a9a6549":H.value,e9fdd5fc:j.value,"36e9ce8e":W.value}));const t=e,a=T(Te.isDark()),l=T(!0);Ie(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Te.isDark()})}),T({});const s=T({}),i=()=>{l.value=!0;const ie=t.reportFilter.applicableFilters;Ae.get("reports/product-performance",ie).then(J=>{s.value=J.productPerformance,w(),D(!0)}).finally(()=>l.value=!1)},c=K(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=T(""),f=T(""),_=T(""),g=T(""),y=ie=>ie.sort((J,N)=>lt(J.value).diff(lt(N.value))),v=T([]),w=()=>{const ie=new Set;Object.keys(s.value).forEach(J=>{const N=J.split("-")[0];ie.add(N)}),v.value=Array.from(ie).sort()},k=ie=>{if(!ie)return[];const J=[];return Object.keys(s.value).forEach(N=>{N.startsWith(ie)&&J.push({value:N,label:lt(N).locale(Zl()).format(Ll("month_long"))})}),y(J)},b=K(()=>{if(!p.value||!_.value)return!1;const ie=!!f.value,J=!!g.value;return!ie&&!J?p.value!==_.value:ie&&J?f.value!==g.value:!0}),S=K(()=>f.value?lt(f.value).locale(Zl()).format(Ll("month_year")):p.value),$=K(()=>g.value?lt(g.value).locale(Zl()).format(Ll("month_year")):_.value),D=(ie=!1)=>{const J=v.value;if(J.length){if(!p.value||ie){p.value=J[0];const N=k(p.value);N.length&&(f.value=N[0].value)}if(!_.value||ie){_.value=J[J.length-1];const N=k(_.value);N.length&&(g.value=N[N.length-1].value)}}},F=ie=>s.value[ie]||[],B=ie=>{const J={};Object.entries(s.value).forEach(([ae,oe])=>{ae.startsWith(ie)&&oe.forEach(fe=>{J[fe.name]||(J[fe.variation_id]={...fe,value:0}),J[fe.variation_id].value+=fe.value})});const N=[];return Object.values(J).forEach(ae=>{N.push(ae)}),N},U=(ie,J)=>J?F(J):(B(ie),B(ie)),Q=K(()=>p.value?[...U(p.value,f.value)].sort((J,N)=>N.value-J.value):[]),V=K(()=>Q.value.length?Math.max(...Q.value.map(ie=>ie.value))*1.1:100),I=ie=>ie===0||V.value===0?0:ie/V.value*100,M=K(()=>{if(!b.value)return[];const ie=U(p.value,f.value),J=U(_.value,g.value),N=new Set;return ie.forEach(fe=>N.add(fe.variation_id)),J.forEach(fe=>N.add(fe.variation_id)),Array.from(N).map(fe=>{const re=ie.find(Ue=>Ue.variation_id===fe),Ee=(re==null?void 0:re.value)||0,ye=J.find(Ue=>Ue.variation_id===fe),Ce=(ye==null?void 0:ye.value)||0;let ve=0;return Ee>0?ve=(Ce-Ee)/Ee*100:Ce>0&&(ve=100),{name:(re==null?void 0:re.name)||(ye==null?void 0:ye.name)||"",post_title:(re==null?void 0:re.post_title)||(ye==null?void 0:ye.post_title)||"",primaryValue:Ee,comparisonValue:Ce,growthRate:parseFloat(ve.toFixed(1))}}).sort((fe,re)=>Math.abs(re.growthRate)-Math.abs(fe.growthRate))}),O=(ie,J)=>{if(ie===0&&J===0)return{primaryWidth:0,comparisonWidth:0};const N=ie+J,ae=ie/N*100,oe=J/N*100;return{primaryWidth:ae,comparisonWidth:oe}},L=ie=>ie>0?"positive":ie<0?"negative":"neutral",H=K(()=>a.value?Te.colors.report.dark_cyan_blue_16:Te.colors.report.light_gray),j=K(()=>a.value?Te.colors.report.dark_cyan_blue_36:Te.colors.report.light_gray_cyan_blue),W=K(()=>a.value?"#ffffff":Te.colors.system.mid),G=(ie,J)=>`${ie} ${Io("unit","units",ie)} sold in ${J}`,Z=T(!1),ne=T(""),ce=T(null);function z(ie,J){ce.value=ie.currentTarget,ne.value=J,setTimeout(()=>{Z.value=!0},150)}function ue(){Z.value=!1}return(ie,J)=>{const N=C("el-skeleton"),ae=C("el-option"),oe=C("el-select"),fe=C("el-tooltip");return r(),h("div",vde,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"pt-6"},{default:d(()=>[l.value?(r(),E(N,{key:0,animated:"",rows:8})):(r(),h(P,{key:1},[c.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(P,{key:0},[o("div",gde,[o("div",yde,[o("div",bde,[n(oe,{modelValue:p.value,"onUpdate:modelValue":J[0]||(J[0]=re=>p.value=re),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(P,null,te(v.value,re=>(r(),E(ae,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(oe,{modelValue:f.value,"onUpdate:modelValue":J[1]||(J[1]=re=>f.value=re),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(P,null,te(k(p.value),re=>(r(),E(ae,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",wde,m(A(u)("vs")),1),o("div",Cde,[n(oe,{modelValue:_.value,"onUpdate:modelValue":J[2]||(J[2]=re=>_.value=re),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(P,null,te(v.value,re=>(r(),E(ae,{key:re,label:re,value:re},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(oe,{modelValue:g.value,"onUpdate:modelValue":J[3]||(J[3]=re=>g.value=re),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(P,null,te(k(_.value),re=>(r(),E(ae,{key:re.value,label:re.label,value:re.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),b.value?(r(),h("div",kde,[o("span",Bde,m(A(u)("Comparing %s with %s",S.value,$.value)),1)])):p.value?(r(),h("div",xde,[o("span",Sde,m(A(u)("Viewing %s",S.value)),1)])):x("",!0)]),b.value?(r(),h("div",Fde,[o("div",$de,[o("div",Ede,[J[5]||(J[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Ude,m(S.value),1)]),o("div",Ide,[J[6]||(J[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",Qde,m($.value),1)])]),o("div",Dde,[o("table",Vde,[o("thead",Tde,[o("tr",null,[o("th",Mde,m(A(u)("Product")),1),o("th",Lde,m(A(u)("Sales")),1),o("th",Rde,m(A(u)("Change")),1)])]),o("tbody",null,[(r(!0),h(P,null,te(M.value,(re,Ee)=>(r(),h("tr",{key:Ee,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Ode,[R(m(re.post_title)+" ",1),J[7]||(J[7]=o("br",null,null,-1)),R(" "+m(re.name),1)]),o("td",Pde,[o("div",Hde,[o("span",Nde,m(re.primaryValue)+m(" vs "+re.comparisonValue)+" "+m(A(u)("Units")),1),o("div",Kde,[o("div",{class:"dual-bar-segment primary-segment",style:ra({width:`${O(re.primaryValue,re.comparisonValue).primaryWidth}%`}),onMouseenter:ye=>z(ye,G(re.primaryValue,S.value)),onMouseleave:ue},null,44,Gde),o("div",{class:"dual-bar-segment comparison-segment",style:ra({width:`${O(re.primaryValue,re.comparisonValue).comparisonWidth}%`}),onMouseenter:ye=>z(ye,G(re.comparisonValue,$.value)),onMouseleave:ue},null,44,zde)])])]),o("td",jde,[o("div",{class:de(["growth-pill",L(re.growthRate)])},m(re.growthRate>0?"+":"")+m(re.growthRate)+"% ",3)])]))),128)),M.value.length===0?(r(),h("tr",qde,[o("td",Yde,[o("span",Wde,m(A(u)("No comparison data available")),1)])])):x("",!0)])])])])):p.value&&Q.value.length>0?(r(),h("div",Jde,[o("div",Xde,[o("div",Zde,[J[8]||(J[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",eue,m(S.value),1)])]),o("div",tue,[o("table",aue,[o("thead",lue,[o("tr",null,[o("th",sue,m(A(u)("Product")),1),o("th",nue,m(A(u)("Sales")),1)])]),o("tbody",null,[(r(!0),h(P,null,te(Q.value,(re,Ee)=>(r(),h("tr",{key:Ee,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",oue,[R(m(re.post_title)+" ",1),J[9]||(J[9]=o("br",null,null,-1)),R(" "+m(re.name),1)]),o("td",iue,[o("div",rue,[o("span",{class:"bar-label",onMouseenter:ye=>z(ye,G(re.value,$.value)),onMouseleave:ue},m(re.value)+" "+m(A(Io)("Unit","Units",re.value)),41,due),o("div",uue,[o("div",{class:"single-bar-segment",style:ra({width:`${I(re.value)}%`}),onMouseenter:ye=>z(ye,G(re.value,$.value)),onMouseleave:ue},null,44,cue)])])])]))),128)),Q.value.length===0?(r(),h("tr",Aue,[o("td",pue,[o("span",fue,m(A(u)("No data available for this period")),1)])])):x("",!0)])])])])):(r(),h("div",mue,[o("div",hue,[J[10]||(J[10]=o("svg",{class:"w-10 h-10 text-gray-300 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),o("p",_ue,m(A(u)("Please select a time period to view sales data")),1)])])),n(fe,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Z.value,"onUpdate:visible":J[4]||(J[4]=re=>Z.value=re),content:ne.value,"virtual-ref":ce.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},gue=nt(vue,[["__scopeId","data-v-ab75a225"]]),yue={class:"fct-revenue-report-page"},bue={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{Bl.getProductReportData({params:{...p.params,groupKey:c.value}}),Bl.getTopSoldProducts(p)},l=p=>{c.value!==p&&(c.value=p,a(i))},s=t.reportFilter,i=s.applicableFilters,c=T("default");return Ie(()=>{s.addListener("product-report",a),a(i)}),Bt(()=>{s.removeListener("product-report",!1)}),(p,f)=>(r(),E(Ot,{permission:"reports/view"},{default:d(()=>[o("div",yue,[n(ol,{title:A(u)("Products")},null,8,["title"]),n(_de,{reportFilter:A(s)},null,8,["reportFilter"]),n(cde,{chartData:A(Bl).data.currentMetrics,compareData:A(Bl).data.previousMetrics,appliedGroupKey:c.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!A(Bl).data.summary.gross_sale,loading:A(Bl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),n(Sd,{data:A(Bl).data.topSoldProducts,loading:A(Bl).data.isBusy},null,8,["data","loading"]),n(gue,{reportFilter:A(s)},null,8,["reportFilter"])])]),_:1}))}},wue={class:"fct-overview-chart-wrap"},Cue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},kue={__name:"OverviewChart",props:{data:{type:Object,required:!0},dataKey:{type:String,required:!0},labelSet:{type:String,default:"monthly"},dateRange:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=T(null),l=T(null),s=T("bar"),i=T(null),c=Te.colors,p=T(Te.isDark()),f=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=K(()=>{try{return Object.keys(t.data).map(D=>({label:D,value:t.data[D][t.dataKey]||0}))}catch($){return i.value=`Error processing data: ${$.message}`,[]}}),y=K(()=>g.value.length?t.dateRange?g.value.map($=>{try{const[D,F]=$.label.split("-");return lt(`${D}-${F}-01`).locale(Zl()).format(Ll("month_year"))}catch{return $.label}}):g.value.map($=>$.label):[]),v=K(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(D=>D.value),color:f.value,yAxisIndex:0}].map(({title:D,data:F,color:B,yAxisIndex:U})=>S(D,s.value,F,B,U)):[]);let w=null;const k=()=>{if(a.value&&w===null)try{w=na(a.value),b()}catch($){i.value=`Error initializing chart: ${$.message}`}},b=()=>{if(!w||i.value)return;p.value=Te.isDark();const $={title:{text:"",left:"center"},legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,c.report.dark_cyan_blue_16,c.report.light_gray_cyan_blue,s.value),confine:!0,position:wl,formatter:D=>{let F=D[0].name;const B=p.value?"#ffffff":"#565865";return D.forEach(U=>{const Q=za(U.value);F+=`<div> | |
| 248 | + ${U.marker} | |
| 249 | + <span style="color: ${B};">${U.seriesName}</span> | |
| 250 | + <span style="float: right; margin-left: 20px; color: ${B};"> | |
| 251 | + ${Q} | |
| 247 | 252 | </span> |
| 248 | - </div>`,pe&&(H+="</div>")}),H}},grid:{show:!1},xAxis:{type:"category",data:Q,splitNumber:L.value.splitNumber,axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12,interval:L.value.interval},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",axisLabel:{color:p.value?"#ffffff":"#000000",fontSize:12},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};w.setOption(E,{notMerge:!0,replaceMerge:["series"]})},S=()=>{i.value=!i.value,i.value&&w?w.setOption({dataZoom:[{type:"slider",show:!0,xAxisIndex:[0],start:1,end:100},{type:"slider",show:!0,yAxisIndex:[0],left:"95%",start:1,end:100},{type:"inside",xAxisIndex:[0],start:1,end:100},{type:"inside",yAxisIndex:[0],start:1,end:100}]}):w&&U()},M=Q=>{va.onChange("revenue","revenue_chart",Q),s.value!==Q&&(i.value=!1,s.value=Q,U())};Ce([()=>a.chartData,_],()=>{Se(()=>{U()})},{deep:!0}),Ce(()=>Ml.data.product,()=>{Se(()=>{U()})},{deep:!0}),Ce(()=>a.isEmpty,Q=>{Q||x()}),Ce(()=>a.loading,Q=>{Q||x()});const I=()=>{w&&w.resize()},T=()=>{p.value=Te.isDark(),Se(()=>{U()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",T),window.addEventListener("resize",I),setTimeout(()=>{x()},100)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",T,!1),window.removeEventListener("resize",I),w&&(w.dispose(),w=null)}),(Q,E)=>{const D=B("el-tooltip"),H=B("el-option"),P=B("el-select"),G=B("el-skeleton");return r(),h("div",qoe,[n(xe,{id:"chartContainer"},{default:d(()=>[n(Ve,{title_size:"small",border_bottom:""},ta({title:d(()=>[o("div",Yoe,[o("h5",Woe,f(A(u)("Product Report Chart")),1),n(D,{"popper-class":"fct-tooltip",content:F.value,placement:"top"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 h-4 cursor-pointer",name:"InformationFill"})]),_:1},8,["content"])])]),_:2},[!e.isEmpty&&!e.loading?{name:"action",fn:d(()=>[o("div",Xoe,[n(P,{class:"el-select--x-small",modelValue:_.value,"onUpdate:modelValue":E[0]||(E[0]=J=>_.value=J),onChange:v},{default:d(()=>[(r(),h(O,null,ae(g,J=>n(H,{key:J.value,label:A(u)(J.label),value:J.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),o("div",Joe,[n(Rl,{activeType:s.value,types:{line:"LineChart",bar:"BarChart"},onChange:M},null,8,["activeType"]),n(Xe,{tag:"button",size:"small",title:A(u)("Zoom Chart"),onClick:S,class:de(i.value?"primary":"")},{default:d(()=>[n(ee,{name:"SearchAdd"})]),_:1},8,["title","class"]),n(ka,{targetRef:l.value},null,8,["targetRef"])])]),key:"0"}:void 0]),1024),n(ke,{class:"px-0"},{default:d(()=>[e.loading?(r(),$(G,{key:0,animated:"",rows:8,class:"p-5"})):(r(),h(O,{key:1},[e.isEmpty?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[e.isEmpty?k("",!0):(r(),h("div",{key:0,class:"fct-chart-wrap fct-revenue-line-chart",ref_key:"chartRef",ref:l},null,512)),o("div",Zoe,[o("div",eie,[o("div",tie,[n(ee,{name:"ArrowUp",class:"arrow-up"}),o("span",aie,f(A(u)("Data")),1)]),o("div",lie,[o("span",sie,f(A(u)("Timeline")),1),n(ee,{name:"ArrowRight",class:"arrow-right"})])])])],64))],64))]),_:1})]),_:1})])}}},oie=lt(nie,[["__scopeId","data-v-259e83ce"]]);class iie extends sl{constructor(){super(...arguments);Oe(this,"data",{summary:{},previousSummary:{},fluctuations:{},isBusy:!0,currentMetrics:[],previousMetrics:[],chartData:[],topSoldProducts:[]})}get controllerKey(){return"ProductReportController"}makeRequest(a,l,s,i){this.data.isBusy=!0,typeof l!="object"&&(l={});const c=ce.get(`reports/${a}`,l);return this.resolvePromiseResponse(c,s,i),c}resolvePromiseResponse(a,l=null,s=null){a.then(i=>{s==null||l==null?Object.assign(this.data,i):this.data[s]=i[l]}).catch(i=>{}).finally(()=>{this.data.isBusy=!1})}getReportData(a={}){return this.makeRequest("net-revenue",a,"data","revenueReport")}getReportByGroup(a={}){return this.makeRequest("net-revenue-by-group",a,"data","netRevenueByGroup")}getProductReportData(a={}){return this.makeRequest("product-report",a)}getSummary(a={}){return this.makeRequest("product-report-summary",a)}getTopSoldProducts(a={}){return this.makeRequest("fetch-top-sold-products",a,"topSoldProducts","topSoldProducts")}}const yl=iie.init(),rie={class:"summary-item-inner"},die={class:"value"},uie={class:"inner-value"},cie={class:"title"},Aie={__name:"Summary",props:{reportFilter:{type:Object}},setup(e){e.reportFilter;const a=[{title:"Units Sold",key:"units_sold",info:u("The total number of units sold in this period.")},{title:"Gross Sale",key:"gross_sale",hasCurrency:!0,info:u("The total sales you had in this period.")},{title:"Refunds",key:"total_refunds",hasCurrency:!0,liability:!0,info:u("Refunds made in this period. This is deducted from gross sales to calculate revenue.")},{title:"Revenue",key:"net_sale",hasCurrency:!0,info:u("Gross sales less refunds, taxes, shipping, fees.")}],l=K(()=>yl.data.isBusy),s=K(()=>a.map(p=>({key:p.key,title:p.title,value:yl.data.summary[p.key]||0,fluctuation:yl.data.fluctuations[p.key]||0,info:p.info,liability:p.liability||!1,hasCurrency:p.hasCurrency||!1}))),i=K(()=>a.filter(p=>p.hasCurrency).map(p=>p.key)),c=p=>i.value.includes(p.key)?xl(p.value,p.liability):ia(p.value);return(p,m)=>{const _=B("el-tooltip");return l.value?(r(),$(Ll,{key:0,loading:l.value,count:s.value.length},null,8,["loading","count"])):(r(),h("div",{key:1,class:de(["fct-report-order-summary",l.value?"":"summary-col-4"])},[(r(!0),h(O,null,ae(s.value,(g,y)=>(r(),h("div",{class:"summary-item",key:y},[o("div",rie,[o("div",die,[o("div",uie,[n(Is,{amount:c(g),title:g.title},null,8,["amount","title"])]),n(ml,{fluctuation:g.fluctuation,amount:A(yl).data.previousSummary[g.key],"is-liability":g.liability,"has-currency":g.hasCurrency},null,8,["fluctuation","amount","is-liability","has-currency"])]),o("div",cie,[R(f(A(u)(g.title))+" ",1),n(_,{content:g.info,placement:"top","popper-class":"fct-tooltip",effect:"dark"},{default:d(()=>[n(ee,{class:"text-gray-500 w-4 flex-shrink-0",name:"InformationFill"})]),_:2},1032,["content"])])])]))),128))],2))}}},pie={class:"fct-product-performance-chart"},fie={class:"mb-6 flex flex-col sm:flex-row gap-6 items-start sm:items-center"},mie={class:"flex items-center gap-3 flex-wrap"},hie={class:"selector-group"},_ie={class:"vs-pill inline-flex items-center justify-center px-2 h-6 bg-gray-100 rounded-[12px] font-xs font-medium text-uppercase dark:bg-primary-500"},vie={class:"selector-group"},gie={key:0,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},yie={class:"text-xs font-medium text-gray-500"},bie={key:1,class:"comparison-mode ml-auto inline-flex items-center h-6 px-2.5 bg-gray-50 rounded-[12px] dark:bg-primary-500"},wie={class:"text-xs font-medium text-gray-500"},Cie={key:0,class:"comparison-results"},Bie={class:"legend flex items-center gap-4 mb-4"},kie={class:"flex items-center"},xie={class:"text-xs text-gray-600"},Sie={class:"flex items-center"},Fie={class:"text-xs text-gray-600"},$ie={class:"comparison-table"},Eie={class:"w-full"},Uie={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Iie={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Qie={class:"w-[40%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Die={class:"w-[10%] text-right font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},Vie={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},Tie={class:"py-3"},Mie={class:"dual-bar-container"},Lie={class:"bar-label"},Rie={class:"dual-bar-wrapper"},Oie=["onMouseenter"],Hie=["onMouseenter"],Pie={class:"py-3 text-right"},Nie={key:0},Kie={colspan:"3",class:"py-4 text-center text-gray-500"},Gie={class:"text-sm"},jie={key:1,class:"current-period-data"},zie={class:"legend flex items-center gap-4 mb-4"},qie={class:"flex items-center"},Yie={class:"text-xs text-gray-600"},Wie={class:"current-period-table"},Xie={class:"w-full"},Jie={class:"sticky top-0 z-10 bg-gray-50 dark:bg-primary-500"},Zie={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},ere={class:"w-[50%] text-left font-medium text-system-dark border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400 px-2.5 py-2 text-uppercase dark:text-gray-50"},tre={class:"py-3 product-name font-medium max-w-[200px] truncate text-sm text-system-dark dark:text-gray-50"},are={class:"py-3"},lre={class:"single-bar-container"},sre=["onMouseenter"],nre={class:"single-bar-wrapper"},ore=["onMouseenter"],ire={key:0},rre={colspan:"2",class:"py-4 text-center text-gray-500"},dre={class:"text-sm"},ure={key:2,class:"no-comparison-message"},cre={class:"flex flex-col items-center justify-center text-center py-8"},Are={class:"text-gray-500 text-sm"},pre={__name:"ProductTopChart",props:{reportFilter:{type:Object,required:!0}},setup(e){vf(q=>({38870964:a.value?"#1C2732":"#F9FAFB","38e9f3a8":P.value,"71ec137a":G.value,"2fc09a58":J.value}));const t=e,a=V(Te.isDark()),l=V(!0);Qe(()=>{i(),t.reportFilter.addListener("product-top-chart",()=>{i()}),window.addEventListener("onFluentCartThemeChange",function(){a.value=Te.isDark()})}),V({});const s=V({}),i=()=>{l.value=!0;const q=t.reportFilter.applicableFilters;ce.get("reports/product-performance",q).then(X=>{s.value=X.productPerformance,C(),L(!0)}).finally(()=>l.value=!1)},c=K(()=>!(Array.isArray(s.value)?s.value:Object.values(s.value)).length),p=V(""),m=V(""),_=V(""),g=V(""),y=q=>q.sort((X,ie)=>at(X.value).diff(at(ie.value))),v=V([]),C=()=>{const q=new Set;Object.keys(s.value).forEach(X=>{const ie=X.split("-")[0];q.add(ie)}),v.value=Array.from(q).sort()},b=q=>{if(!q)return[];const X=[];return Object.keys(s.value).forEach(ie=>{ie.startsWith(q)&&X.push({value:ie,label:at(ie).format("MMMM")})}),y(X)},w=K(()=>{if(!p.value||!_.value)return!1;const q=!!m.value,X=!!g.value;return!q&&!X?p.value!==_.value:q&&X?m.value!==g.value:!0}),x=K(()=>m.value?at(m.value).format("MMM YYYY"):p.value),F=K(()=>g.value?at(g.value).format("MMM YYYY"):_.value),L=(q=!1)=>{const X=v.value;if(X.length){if(!p.value||q){p.value=X[0];const ie=b(p.value);ie.length&&(m.value=ie[0].value)}if(!_.value||q){_.value=X[X.length-1];const ie=b(_.value);ie.length&&(g.value=ie[ie.length-1].value)}}},U=q=>s.value[q]||[],S=q=>{const X={};Object.entries(s.value).forEach(([ge,fe])=>{ge.startsWith(q)&&fe.forEach(he=>{X[he.name]||(X[he.variation_id]={...he,value:0}),X[he.variation_id].value+=he.value})});const ie=[];return Object.values(X).forEach(ge=>{ie.push(ge)}),ie},M=(q,X)=>X?U(X):(S(q),S(q)),I=K(()=>p.value?[...M(p.value,m.value)].sort((X,ie)=>ie.value-X.value):[]),T=K(()=>I.value.length?Math.max(...I.value.map(q=>q.value))*1.1:100),Q=q=>q===0||T.value===0?0:q/T.value*100,E=K(()=>{if(!w.value)return[];const q=M(p.value,m.value),X=M(_.value,g.value),ie=new Set;return q.forEach(he=>ie.add(he.variation_id)),X.forEach(he=>ie.add(he.variation_id)),Array.from(ie).map(he=>{const le=q.find(qe=>qe.variation_id===he),me=(le==null?void 0:le.value)||0,Ue=X.find(qe=>qe.variation_id===he),et=(Ue==null?void 0:Ue.value)||0;let be=0;return me>0?be=(et-me)/me*100:et>0&&(be=100),{name:(le==null?void 0:le.name)||(Ue==null?void 0:Ue.name)||"",post_title:(le==null?void 0:le.post_title)||(Ue==null?void 0:Ue.post_title)||"",primaryValue:me,comparisonValue:et,growthRate:parseFloat(be.toFixed(1))}}).sort((he,le)=>Math.abs(le.growthRate)-Math.abs(he.growthRate))}),D=(q,X)=>{if(q===0&&X===0)return{primaryWidth:0,comparisonWidth:0};const ie=q+X,ge=q/ie*100,fe=X/ie*100;return{primaryWidth:ge,comparisonWidth:fe}},H=q=>q>0?"positive":q<0?"negative":"neutral",P=K(()=>a.value?Te.colors.report.dark_cyan_blue_16:Te.colors.report.light_gray),G=K(()=>a.value?Te.colors.report.dark_cyan_blue_36:Te.colors.report.light_gray_cyan_blue),J=K(()=>a.value?"#ffffff":Te.colors.system.mid),oe=(q,X)=>`${q} ${Bo("unit","units",q)} sold in ${X}`,Z=V(!1),W=V(""),pe=V(null);function N(q,X){pe.value=q.currentTarget,W.value=X,setTimeout(()=>{Z.value=!0},150)}function j(){Z.value=!1}return(q,X)=>{const ie=B("el-skeleton"),ge=B("el-option"),fe=B("el-select"),he=B("el-tooltip");return r(),h("div",pie,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Product Performance Comparison"),title_size:"small",border_bottom:""},null,8,["title"]),n(ke,{class:"pt-6"},{default:d(()=>[l.value?(r(),$(ie,{key:0,animated:"",rows:8})):(r(),h(O,{key:1},[c.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h(O,{key:0},[o("div",fie,[o("div",mie,[o("div",hie,[n(fe,{modelValue:p.value,"onUpdate:modelValue":X[0]||(X[0]=le=>p.value=le),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(O,null,ae(v.value,le=>(r(),$(ge,{key:le,label:le,value:le},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fe,{modelValue:m.value,"onUpdate:modelValue":X[1]||(X[1]=le=>m.value=le),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!p.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(O,null,ae(b(p.value),le=>(r(),$(ge,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),o("div",_ie,f(A(u)("vs")),1),o("div",vie,[n(fe,{modelValue:_.value,"onUpdate:modelValue":X[2]||(X[2]=le=>_.value=le),placeholder:A(u)("Year"),size:"small",class:"year-select","popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(O,null,ae(v.value,le=>(r(),$(ge,{key:le,label:le,value:le},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),n(fe,{modelValue:g.value,"onUpdate:modelValue":X[3]||(X[3]=le=>g.value=le),placeholder:A(u)("Month"),size:"small",clearable:"",class:"month-select",disabled:!_.value,"popper-class":"minimal-select"},{default:d(()=>[(r(!0),h(O,null,ae(b(_.value),le=>(r(),$(ge,{key:le.value,label:le.label,value:le.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])])]),w.value?(r(),h("div",gie,[o("span",yie,f(A(u)("Comparing %s with %s",x.value,F.value)),1)])):p.value?(r(),h("div",bie,[o("span",wie,f(A(u)("Viewing %s",x.value)),1)])):k("",!0)]),w.value?(r(),h("div",Cie,[o("div",Bie,[o("div",kie,[X[5]||(X[5]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",xie,f(x.value),1)]),o("div",Sie,[X[6]||(X[6]=o("div",{class:"w-3 h-3 comparison-legend rounded-sm mr-1.5"},null,-1)),o("span",Fie,f(F.value),1)])]),o("div",$ie,[o("table",Eie,[o("thead",Uie,[o("tr",null,[o("th",Iie,f(A(u)("Product")),1),o("th",Qie,f(A(u)("Sales")),1),o("th",Die,f(A(u)("Change")),1)])]),o("tbody",null,[(r(!0),h(O,null,ae(E.value,(le,me)=>(r(),h("tr",{key:me,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",Vie,[R(f(le.post_title)+" ",1),X[7]||(X[7]=o("br",null,null,-1)),R(" "+f(le.name),1)]),o("td",Tie,[o("div",Mie,[o("span",Lie,f(le.primaryValue)+f(" vs "+le.comparisonValue)+" "+f(A(u)("Units")),1),o("div",Rie,[o("div",{class:"dual-bar-segment primary-segment",style:na({width:`${D(le.primaryValue,le.comparisonValue).primaryWidth}%`}),onMouseenter:Ue=>N(Ue,oe(le.primaryValue,x.value)),onMouseleave:j},null,44,Oie),o("div",{class:"dual-bar-segment comparison-segment",style:na({width:`${D(le.primaryValue,le.comparisonValue).comparisonWidth}%`}),onMouseenter:Ue=>N(Ue,oe(le.comparisonValue,F.value)),onMouseleave:j},null,44,Hie)])])]),o("td",Pie,[o("div",{class:de(["growth-pill",H(le.growthRate)])},f(le.growthRate>0?"+":"")+f(le.growthRate)+"% ",3)])]))),128)),E.value.length===0?(r(),h("tr",Nie,[o("td",Kie,[o("span",Gie,f(A(u)("No comparison data available")),1)])])):k("",!0)])])])])):p.value&&I.value.length>0?(r(),h("div",jie,[o("div",zie,[o("div",qie,[X[8]||(X[8]=o("div",{class:"w-3 h-3 primary-legend rounded-sm mr-1.5"},null,-1)),o("span",Yie,f(x.value),1)])]),o("div",Wie,[o("table",Xie,[o("thead",Jie,[o("tr",null,[o("th",Zie,f(A(u)("Product")),1),o("th",ere,f(A(u)("Sales")),1)])]),o("tbody",null,[(r(!0),h(O,null,ae(I.value,(le,me)=>(r(),h("tr",{key:me,class:"product-row border-0 border-b-[1px] border-solid border-gray-divider dark:border-dark-400"},[o("td",tre,[R(f(le.post_title)+" ",1),X[9]||(X[9]=o("br",null,null,-1)),R(" "+f(le.name),1)]),o("td",are,[o("div",lre,[o("span",{class:"bar-label",onMouseenter:Ue=>N(Ue,oe(le.value,F.value)),onMouseleave:j},f(le.value)+" "+f(A(Bo)("Unit","Units",le.value)),41,sre),o("div",nre,[o("div",{class:"single-bar-segment",style:na({width:`${Q(le.value)}%`}),onMouseenter:Ue=>N(Ue,oe(le.value,F.value)),onMouseleave:j},null,44,ore)])])])]))),128)),I.value.length===0?(r(),h("tr",ire,[o("td",rre,[o("span",dre,f(A(u)("No data available for this period")),1)])])):k("",!0)])])])])):(r(),h("div",ure,[o("div",cre,[X[10]||(X[10]=o("svg",{class:"w-10 h-10 text-gray-300 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),o("p",Are,f(A(u)("Please select a time period to view sales data")),1)])])),n(he,{ref:"sharedTooltip","popper-class":"fct-tooltip",visible:Z.value,"onUpdate:visible":X[4]||(X[4]=le=>Z.value=le),content:W.value,"virtual-ref":pe.value,"virtual-triggering":"",placement:"top"},null,8,["visible","content","virtual-ref"])],64))],64))]),_:1})]),_:1})])}}},fre=lt(pre,[["__scopeId","data-v-5cf85c06"]]),mre={class:"fct-revenue-report-page"},hre={__name:"ProductReport",props:{reportFilter:{type:Object,required:!0}},setup(e){const t=e,a=p=>{yl.getProductReportData({params:{...p.params,groupKey:c.value}}),yl.getTopSoldProducts(p)},l=p=>{c.value!==p&&(c.value=p,a(i))},s=t.reportFilter,i=s.applicableFilters,c=V("default");return Qe(()=>{s.addListener("product-report",a),a(i)}),Ct(()=>{s.removeListener("product-report",!1)}),(p,m)=>(r(),$(Pt,{permission:"reports/view"},{default:d(()=>[o("div",mre,[n(ll,{title:A(u)("Products")},null,8,["title"]),n(Aie,{reportFilter:A(s)},null,8,["reportFilter"]),n(oie,{chartData:A(yl).data.currentMetrics,compareData:A(yl).data.previousMetrics,appliedGroupKey:c.value,reportFilter:t.reportFilter,onFilterData:l,"is-empty":!A(yl).data.summary.gross_sale,loading:A(yl).data.isBusy},null,8,["chartData","compareData","appliedGroupKey","reportFilter","is-empty","loading"]),n(hd,{data:A(yl).data.topSoldProducts,loading:A(yl).data.isBusy},null,8,["data","loading"]),n(fre,{reportFilter:A(s)},null,8,["reportFilter"])])]),_:1}))}},_re={class:"fct-overview-chart-wrap"},vre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},gre={__name:"OverviewChart",props:{data:{type:Object,required:!0},dataKey:{type:String,required:!0},labelSet:{type:String,default:"monthly"},dateRange:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=V(null),l=V(null),s=V("bar"),i=V(null),c=Te.colors,p=V(Te.isDark()),m=K(()=>p.value?c.blue[500]+"52":c.blue[300]),_={current:u("Current"),prev:u("Previous"),yoy_growth:u("YoY Growth")},g=K(()=>{try{return Object.keys(t.data).map(L=>({label:L,value:t.data[L][t.dataKey]||0}))}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),y=K(()=>g.value.length?t.dateRange?g.value.map(F=>{try{const[L,U]=F.label.split("-");return new Date(L,U-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return F.label}}):g.value.map(F=>F.label):[]),v=K(()=>g.value.length?[{title:_[t.dataKey]||t.dataKey,data:g.value.map(L=>L.value),color:m.value,yAxisIndex:0}].map(({title:L,data:U,color:S,yAxisIndex:M})=>x(L,s.value,U,S,M)):[]);let C=null;const b=()=>{if(a.value&&C===null)try{C=Jt(a.value),w()}catch(F){i.value=`Error initializing chart: ${F.message}`}},w=()=>{if(!C||i.value)return;p.value=Te.isDark();const F={title:{text:"",left:"center"},legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:L=>{let U=L[0].name;const S=p.value?"#ffffff":"#565865";return L.forEach(M=>{const I=Je.formatScaled(M.value);U+=`<div> | |
| 249 | - ${M.marker} | |
| 250 | - <span style="color: ${S};">${M.seriesName}</span> | |
| 251 | - <span style="float: right; margin-left: 20px; color: ${S};"> | |
| 252 | - ${I} | |
| 253 | + </div>`}),F}},xAxis:{type:"category",data:y.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:D=>`${ft.formatScaledChart(D)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};try{w.setOption($,{notMerge:!0,replaceMerge:["series"]})}catch(D){i.value=`Error updating chart: ${D.message}`}},S=($,D,F,B,U)=>({name:$,type:D,barMaxWidth:t.barMaxWidth,areaStyle:D==="line"?{}:void 0,data:F,smooth:!0,color:B,lineStyle:{width:2},yAxisIndex:U,emphasis:{itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{xe(b)},{deep:!0}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),w&&(w.dispose(),w=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),xe(k)}),($,D)=>(r(),h("div",wue,[n(Se,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(ke,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",Cue,m(i.value),1)):x("",!0),e.isEmpty?(r(),E(Ct,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},wo=nt(kue,[["__scopeId","data-v-2c76289f"]]),Bue={class:"fct-gross-volume-chart-wrap"},xue={key:0,class:"error-message",style:{color:"red",padding:"10px"}},Sue={__name:"GrossVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""},currentKey:{type:String,default:"current"},prevKey:{type:String,default:"prev"},labelKey:{type:String,default:"yoy_growth"},isDate:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=T(null),l=T(null),s=T("bar"),i=T(null),c=Te.colors,p=T(Te.isDark()),f={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},_=K(()=>{if(!t.data||typeof t.data!="object")return i.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(D=>{const F=t.data[D];return{label:D,current:F[t.currentKey]?parseInt(F[t.currentKey]):0,prev:F[t.prevKey]?parseInt(F[t.prevKey]):0,growth:F[t.labelKey]?parseFloat(F[t.labelKey]):0}})}catch($){return i.value=`Error processing data: ${$.message}`,[]}}),g=K(()=>_.value.length?_.value.map($=>{if(t.isDate)try{const[D,F]=$.label.split("-");return lt(`${D}-${F}-01`).locale(Zl()).format(Ll("month_year"))}catch{return $.label}else return $.label}):[]),y=K(()=>_.value.length?[{title:f[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?c.report.blue_dark_mode:c.report.blue},{title:f[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?c.blue[500]+"52":c.blue[300]}].map(({title:$,dataKey:D,type:F,color:B})=>S($,F,_.value.map(U=>U[D]),B)):[]),v=K(()=>_.value.length?_.value.map(D=>D.growth):[]);let w=null;const k=()=>{if(a.value&&w===null)try{w=na(a.value),b()}catch($){i.value=`Error initializing chart: ${$.message}`}},b=()=>{if(!w||i.value)return;p.value=Te.isDark();const $={legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:Ql(p.value,c.report.dark_cyan_blue_16,c.report.light_gray_cyan_blue),confine:!0,position:wl,formatter:D=>{let F=D[0].name;const B=p.value?"#ffffff":"#565865",U=v.value[D[0].dataIndex];D.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("YoY Growth"),value:isNaN(U)?"N/A":U.toFixed(2)+"%"});const Q=p.value?c.report.dark_cyan_blue_16:c.report.light_gray_blue;return D.forEach(function(V,I){const M=I===D.length-1,O=M?V.value:za(V.value);M?F+=`<div style="border-top: 1px solid ${Q}; margin-top: 5px; padding-top: 5px;">`:F+="<div>",F+=` | |
| 254 | + ${V.marker} | |
| 255 | + <span style="color: ${B};">${V.seriesName}</span> | |
| 256 | + <span style="float: right; margin-left: 20px; color: ${B};"> | |
| 257 | + ${O} | |
| 253 | 258 | </span> |
| 254 | - </div>`}),U}},xAxis:{type:"category",data:y.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:L=>`${Je.formatScaledChart(L)}`},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}}],series:v.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};try{C.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(L){i.value=`Error updating chart: ${L.message}`}},x=(F,L,U,S,M)=>({name:F,type:L,barMaxWidth:t.barMaxWidth,areaStyle:L==="line"?{}:void 0,data:U,smooth:!0,color:S,lineStyle:{width:2},yAxisIndex:M,emphasis:{itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return Ce([()=>t.data,()=>t.dataKey,()=>t.labelSet,s],()=>{Se(w)},{deep:!0}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),C&&(C.dispose(),C=null)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),Se(b)}),(F,L)=>(r(),h("div",_re,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(ke,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",vre,f(i.value),1)):k("",!0),e.isEmpty?(r(),$(_t,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-overview-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},po=lt(gre,[["__scopeId","data-v-c9fd4c06"]]),yre={class:"fct-gross-volume-chart-wrap"},bre={key:0,class:"error-message",style:{color:"red",padding:"10px"}},wre={__name:"GrossVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""},currentKey:{type:String,default:"current"},prevKey:{type:String,default:"prev"},labelKey:{type:String,default:"yoy_growth"},isDate:{type:Boolean,default:!1},barMaxWidth:{type:Number,default:30},isEmpty:{type:Boolean,default:!1}},setup(e){const t=e,a=V(null),l=V(null),s=V("bar"),i=V(null),c=Te.colors,p=V(Te.isDark()),m={current:u("Current"),prev:u("Previous"),prev_year:u("Previous"),yoy_growth:u("YoY Growth")},_=K(()=>{if(!t.data||typeof t.data!="object")return i.value="Invalid or missing data prop",[];try{return Object.keys(t.data).map(L=>{const U=t.data[L];return{label:L,current:U[t.currentKey]?parseInt(U[t.currentKey]):0,prev:U[t.prevKey]?parseInt(U[t.prevKey]):0,growth:U[t.labelKey]?parseFloat(U[t.labelKey]):0}})}catch(F){return i.value=`Error processing data: ${F.message}`,[]}}),g=K(()=>_.value.length?_.value.map(F=>{if(t.isDate)try{const[L,U]=F.label.split("-");return new Date(L,U-1).toLocaleString("default",{month:"short",year:"numeric"})}catch{return F.label}else return F.label}):[]),y=K(()=>_.value.length?[{title:m[t.currentKey]||t.currentKey,dataKey:"current",type:"line",color:p.value?c.report.blue_dark_mode:c.report.blue},{title:m[t.prevKey]||t.prevKey,dataKey:"prev",type:"bar",color:p.value?c.blue[500]+"52":c.blue[300]}].map(({title:F,dataKey:L,type:U,color:S})=>x(F,U,_.value.map(M=>M[L]),S)):[]),v=K(()=>_.value.length?_.value.map(L=>L.growth):[]);let C=null;const b=()=>{if(a.value&&C===null)try{C=Jt(a.value),w()}catch(F){i.value=`Error initializing chart: ${F.message}`}},w=()=>{if(!C||i.value)return;p.value=Te.isDark();const F={legend:{show:!1,top:"5%",icon:"circle",itemWidth:8,itemHeight:8,itemGap:30,textStyle:{color:p.value?"#ffffff":"#696778"}},tooltip:{trigger:"axis",backgroundColor:p.value?"#253241":"#ffffff",borderColor:p.value?"#2C3C4E":"#c0c4ca",borderWidth:1,textStyle:{color:p.value?"#ffffff":"#565865"},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:p.value?c.report.dark_cyan_blue_16:c.report.light_gray_cyan_blue}},formatter:L=>{let U=L[0].name;const S=p.value?"#ffffff":"#565865",M=v.value[L[0].dataIndex];L.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("YoY Growth"),value:isNaN(M)?"N/A":M.toFixed(2)+"%"});const I=p.value?c.report.dark_cyan_blue_16:c.report.light_gray_blue;return L.forEach(function(T,Q){const E=Q===L.length-1,D=E?T.value:Je.formatScaled(T.value);E?U+=`<div style="border-top: 1px solid ${I}; margin-top: 5px; padding-top: 5px;">`:U+="<div>",U+=` | |
| 255 | - ${T.marker} | |
| 256 | - <span style="color: ${S};">${T.seriesName}</span> | |
| 257 | - <span style="float: right; margin-left: 20px; color: ${S};"> | |
| 258 | - ${D} | |
| 259 | + </div>`}),F}},xAxis:{type:"category",data:g.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",name:u("Volume (%s)",ft.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:D=>ft.formatScaledChart(D)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:u("YoY Growth (%)"),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(D=>!isNaN(D)),0)-5,max:Math.max(...v.value.filter(D=>!isNaN(D)),0)+5}],series:y.value};try{w.setOption($,{notMerge:!0,replaceMerge:["series"]})}catch(D){i.value=`Error updating chart: ${D.message}`}},S=($,D,F,B,U=0)=>({name:$,type:D,barMaxWidth:t.barMaxWidth,areaStyle:D==="line"?null:void 0,data:F,smooth:D==="line",color:B,lineStyle:D==="line"?{width:2}:void 0,yAxisIndex:U,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return be([()=>t.data,s],()=>{xe(b)},{deep:!0}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",b,!1),w&&(w.dispose(),w=null)}),Ie(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",b),xe(k)}),($,D)=>(r(),h("div",Bue,[n(Se,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ve,{title:A(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>D[0]||(D[0]=[])),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",xue,m(i.value),1)):x("",!0),e.isEmpty?(r(),E(Ct,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},Cc=nt(Sue,[["__scopeId","data-v-a0726f58"]]),Fue={class:"fct-country-volume-chart-wrap"},$ue={class:"fct-btn-group sm"},Eue=.05,Uue={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=T(null),l=T(null);let s=null;const i=T("bar");T("");const c=T(Te.isDark()),p=K(()=>c.value?["#8FC0F5","#4E90E8","#2E6BC4","#1E4C90","#143562"]:["#9CC9FA","#3E9DF6","#1573D5","#0B57A3","#083C73"]),f=F=>{const B=F.replace("#",""),U=parseInt(B.substring(0,2),16),Q=parseInt(B.substring(2,4),16),V=parseInt(B.substring(4,6),16);return(U*299+Q*587+V*114)/1e3>150?"#0B3A66":"#ffffff"},_=K(()=>{const F=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!F.length||!F.every(B=>!!B)}),g=Te.colors,y=K(()=>{const F=t.data.by_month||{};return Object.keys(F).sort().map(U=>{const Q=F[U],V=Object.values(Q).reduce((M,O)=>M+O,0),I=Object.entries(Q).sort((M,O)=>M[1]-O[1]).reduce((M,[O,L])=>({...M,[O]:L}),{});return{label:U,countries:I,total:V}})}),v=K(()=>y.value.length?y.value.map(F=>{try{const[B,U]=F.label.split("-");return lt(new Date(B,U-1)).locale(Zl()).format(Ll("month_year"))}catch{return F.label}}):[]),w=K(()=>{const F={};Object.values(t.data.by_month||{}).forEach(Q=>{Object.entries(Q).forEach(([V,I])=>{F[V]=(F[V]||0)+I})}),Object.entries(t.data.by_countries||{}).forEach(([Q,V])=>{F[Q]=V});const B=p.value,U=B[B.length-1];return Object.keys(F).sort((Q,V)=>F[V]-F[Q]).reduce((Q,V,I)=>(Q[V]=B[I]||U,Q),{})}),k=K(()=>y.value.reduce((F,B)=>Math.max(F,B.total),0)),b=K(()=>{const F=t.data.by_month||{},B=new Set;Object.values(F).forEach(V=>{Object.keys(V).forEach(I=>B.add(I))});const U=p.value,Q=k.value;return Array.from(B).reverse().map(V=>{const I=w.value[V]||U[U.length-1],M=f(I),O=y.value.map(L=>{const H=L.countries[V]||0,j=Q>0&&H/Q>=Eue;return{value:H/100,label:{show:H>0&&j,position:"inside",formatter:V,color:M,fontSize:10,fontWeight:"bold"}}});return{name:V,type:i.value,stack:"total",data:O,itemStyle:{color:I},lineStyle:{color:I}}})}),S=()=>{if(!a.value)return;s=na(a.value);const F={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",textStyle:{color:c.value?g.gray[25]:g.system.mid},borderColor:c.value?"#2C3C4E":"#c0c4ca",axisPointer:Ql(c.value,g.report.dark_cyan_blue_16,g.report.light_gray_cyan_blue,i.value),borderWidth:1,confine:!0,position:wl,formatter:B=>{const U=c.value?"#ffffff":"#565865",Q=c.value?g.report.dark_cyan_blue_16:g.report.light_gray_blue,V=y.value[B[0].dataIndex].total;let I=B[0].axisValue;return B.filter(M=>M.value>0).sort((M,O)=>O.value-M.value).forEach(M=>{const O=za(M.value*100);I+=` | |
| 260 | + <div> | |
| 261 | + ${M.marker} | |
| 262 | + <span style="color: ${U};">${Qs(M.seriesName)}</span> | |
| 263 | + <span style="float: right; margin-left: 20px; color: ${U};"> | |
| 264 | + ${O} | |
| 259 | 265 | </span> |
| 260 | - </div>`}),U}},xAxis:{type:"category",data:g.value,axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value?"#253241":"#D6DAE1"}}},yAxis:[{type:"value",position:"left",name:u("Volume (%s)",Je.currencySign),axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:L=>Je.formatScaledChart(L)},splitLine:{show:!0,lineStyle:{color:p.value?"#253241":"#D6DAE1",type:"dashed"}}},{type:"value",position:"right",name:"YoY Growth (%)",axisLabel:{color:p.value?"#ffffff":"#696778",fontSize:12,formatter:"{value}%"},splitLine:{show:!1},min:Math.min(...v.value.filter(L=>!isNaN(L)),0)-5,max:Math.max(...v.value.filter(L=>!isNaN(L)),0)+5}],series:y.value};try{C.setOption(F,{notMerge:!0,replaceMerge:["series"]})}catch(L){i.value=`Error updating chart: ${L.message}`}},x=(F,L,U,S,M=0)=>({name:F,type:L,barMaxWidth:t.barMaxWidth,areaStyle:L==="line"?null:void 0,data:U,smooth:L==="line",color:S,lineStyle:L==="line"?{width:2}:void 0,yAxisIndex:M,emphasis:{scale:2,itemStyle:{color:p.value?c.blue[800]:c.blue[400]}}});return Ce([()=>t.data,s],()=>{Se(w)},{deep:!0}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",w,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1),C&&(C.dispose(),C=null)}),Qe(()=>{window.addEventListener("onFluentCartThemeChange",w),window.addEventListener("fluentCartCurrencyChange",w),Se(b)}),(F,L)=>(r(),h("div",yre,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ve,{title:A(u)(e.title),title_size:"small",border_bottom:""},{action:d(()=>L[0]||(L[0]=[])),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[i.value?(r(),h("div",bre,f(i.value),1)):k("",!0),e.isEmpty?(r(),$(_t,{key:2,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:1,class:"fct-chart-wrap fct-gross-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},sc=lt(wre,[["__scopeId","data-v-f7c41726"]]),Cre={class:"fct-country-volume-chart-wrap"},Bre={class:"fct-btn-group sm"},kre={__name:"CountryVolumeChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=V(null),l=V(null);let s=null;const i=V("bar");V("");const c=V(Te.isDark()),p=K(()=>[c.value?"#032647":"#3e9df6",c.value?"#04315b":"#1589f4",c.value?"#053c70":"#0a73d5",c.value?"#064784":"#0968c1",c.value?"#075298":"#085dad"]),m=K(()=>{const x=Array.isArray(t.data.by_countries)?t.data.by_countries:Object.values(t.data.by_countries);return!x.length||!x.every(F=>!!F)}),_=Te.colors,g=K(()=>{const x=t.data.by_month||{};return Object.keys(x).sort().map(L=>{const U=x[L],S=Object.values(U).reduce((I,T)=>I+T,0),M=Object.entries(U).sort((I,T)=>I[1]-T[1]).reduce((I,[T,Q])=>({...I,[T]:Q}),{});return{label:L,countries:M,total:S}})}),y=K(()=>g.value.length?g.value.map(x=>{try{const[F,L]=x.label.split("-");return at(new Date(F,L-1)).format("MMM YYYY")}catch{return x.label}}):[]),v=K(()=>{const x=t.data.by_month||{},F=Object.keys(x).sort(),L=new Set;return Object.values(x).forEach(U=>{Object.keys(U).forEach(S=>L.add(S))}),Array.from(L).reverse().map(U=>{let S;const M=g.value.map((I,T)=>{const Q=x[F[T]],D=Object.entries(Q).sort((G,J)=>J[1]-G[1]).map(([G])=>G).indexOf(U),H=I.countries[U]||0,P=D<5?D:4;return!S&&P>=0&&(S=p.value[P]||p.value[4]),{value:H/100,label:{show:H>0,position:"inside",formatter:U,color:(c.value,"#fff"),fontSize:10,fontWeight:"bold"}}});return{name:U,type:i.value,stack:"total",data:M,itemStyle:{color:S},lineStyle:{color:S}}})}),C=()=>{if(!a.value)return;s=Jt(a.value);const x={backgroundColor:"transparent",tooltip:{trigger:"axis",backgroundColor:c.value?"#253241":"#ffffff",textStyle:{color:c.value?_.gray[25]:_.system.mid},borderColor:c.value?"#2C3C4E":"#c0c4ca",axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:c.value?_.report.dark_cyan_blue_16:_.report.light_gray_cyan_blue}},borderWidth:1,formatter:F=>{let L=F[0].axisValue;const U=c.value?"#ffffff":"#565865",S=g.value[F[0].dataIndex].total;F=F.sort((I,T)=>T.value-I.value).filter(I=>I.value>0),F.push({marker:'<span style="display:inline-block; width:10px; height:10px; border-radius:50%; background-color:#FFA500; margin-right:5px;"></span>',seriesName:u("Total"),value:S/100});const M=c.value?_.report.dark_cyan_blue_16:_.report.light_gray_blue;return F.forEach(function(I,T){const Q=T===F.length-1;if(!Q&&I.value===0)return;const E=Je.scaled(I.value);Q?L+=`<div style="border-top: 1px solid ${M}; margin-top: 5px; padding-top: 5px;">`:L+="<div>",L+=` | |
| 261 | - ${I.marker} | |
| 262 | - <span style="color: ${U};">${I.seriesName}</span> | |
| 263 | - <span style="float: right; margin-left: 20px; color: ${U};"> | |
| 264 | - ${E} | |
| 266 | + </div>`}),I+=` | |
| 267 | + <div style="border-top: 1px solid ${Q}; margin-top: 5px; padding-top: 5px;"> | |
| 268 | + <span style="color: ${U}; font-weight: 600;">${u("Total")}</span> | |
| 269 | + <span style="float: right; margin-left: 20px; color: ${U}; font-weight: 600;"> | |
| 270 | + ${za(V)} | |
| 265 | 271 | </span> |
| 266 | - </div>`}),L}},xAxis:{type:"category",data:y.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:u("Volume (%s)",Je.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:F=>Je.formatScaled(F*100)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:v.value};s.setOption(x)},b=()=>{c.value=Te.isDark(),Se(()=>{C()})},w=()=>{s&&(s.dispose(),s=null),C()};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",b),window.addEventListener("fluentCartCurrencyChange",w),Se(C)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),Ce(()=>c.value,()=>{s&&(s.dispose(),C())}),Ce(()=>t.data,()=>{s&&C()}),(x,F)=>(r(),h("div",Cre,[n(xe,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ve,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[o("div",Bre,[n(rm,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[m.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},nc=lt(kre,[["__scopeId","data-v-89fa1969"]]),xre={class:"fct-card-header-title is-small"},oc={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Te.colors.report,l=V(Te.isDark()),s=V(null),i=V("line"),c=V(t.data),p=K(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),m=K(()=>Object.values(c.value).every(w=>w===0)),_=K(()=>Object.keys(c.value)),g=K(()=>[{name:u("Current"),type:i.value,data:Object.values(c.value),smooth:!0,color:l.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{s.value&&!y&&(y=Jt(s.value),C())},C=()=>{if(!y)return;const w={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:p.value.bgColor,borderColor:p.value.borderColor,borderWidth:1,textStyle:{color:p.value.textColor},axisPointer:{type:"line",lineStyle:{type:"solid",width:2,color:l.value?a.dark_cyan_blue_16:a.light_gray_blue}},formatter:x=>{let F=x[0].name;const L=l.value?"#ffffff":"#565865";return x.forEach(U=>{const S=Je.formatScaled(U.value);F+=`<div> | |
| 267 | - ${U.marker} | |
| 268 | - <span style="color: ${L};">${U.seriesName}</span> | |
| 269 | - <span style="float: right; margin-left: 20px; color: ${L};"> | |
| 270 | - ${S} | |
| 272 | + </div>`,I}},xAxis:{type:"category",data:v.value,axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12},axisLine:{lineStyle:{color:c.value?"#253241":"#D6DAE1"}}},yAxis:{type:"value",position:"left",name:u("Volume (%s)",ft.currencySign),axisLabel:{color:c.value?"#ffffff":"#696778",fontSize:12,formatter:B=>ft.formatScaled(B*100)},splitLine:{show:!0,lineStyle:{color:c.value?"#253241":"#D6DAE1",type:"dashed"}}},series:b.value};s.setOption(F)},$=()=>{c.value=Te.isDark(),xe(()=>{S()})},D=()=>{s&&(s.dispose(),s=null),S()};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",$),window.addEventListener("fluentCartCurrencyChange",D),xe(S)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",$,!1),window.removeEventListener("fluentCartCurrencyChange",D,!1)}),be(()=>c.value,()=>{s&&(s.dispose(),S())}),be(()=>t.data,()=>{s&&S()}),(F,B)=>(r(),h("div",Fue,[n(Se,{id:"chartContainer",ref_key:"cardRef",ref:l},{default:d(()=>[n(Ve,{title:e.title,title_size:"small",border_bottom:""},{action:d(()=>[o("div",$ue,[n(Jm,{targetRef:a.value},null,8,["targetRef"])])]),_:1},8,["title"]),n(ke,{class:"p-0"},{default:d(()=>[_.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap fct-country-volume-chart",ref_key:"chartRef",ref:a,style:{height:"400px"}},null,512))]),_:1})]),_:1},512)]))}},kc=nt(Uue,[["__scopeId","data-v-c6534652"]]),Iue={class:"fct-card-header-title is-small"},Bc={__name:"CountryNetChart",props:{data:{type:Object,required:!0},title:{type:String,default:""}},setup(e){const t=e,a=Te.colors.report,l=T(Te.isDark()),s=T(null),i=T("line"),c=T(t.data),p=K(()=>({textColor:l.value?"#ffffff":"#696778",borderColor:l.value?"#2C3C4E":"#c0c4ca",splitLineColor:l.value?"#253241":"#D6DAE1",bgColor:l.value?"#2d3748":"#ffffff"})),f=K(()=>Object.values(c.value).every(b=>b===0)),_=K(()=>Object.keys(c.value)),g=K(()=>[{name:u("Current"),type:i.value,data:Object.values(c.value),smooth:!0,color:l.value?a.purple_dark_mode:a.purple,lineStyle:{width:2},barMaxWidth:30}]);let y=null;const v=()=>{s.value&&!y&&(y=na(s.value),w())},w=()=>{if(!y)return;const b={legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:p.value.bgColor,borderColor:p.value.borderColor,borderWidth:1,textStyle:{color:p.value.textColor},axisPointer:Ql(l.value,a.dark_cyan_blue_16,a.light_gray_blue,i.value),confine:!0,position:wl,formatter:S=>{let $=Qs(S[0].name);const D=l.value?"#ffffff":"#565865";return S.forEach(F=>{const B=za(F.value);$+=`<div> | |
| 273 | + ${F.marker} | |
| 274 | + <span style="color: ${D};">${F.seriesName}</span> | |
| 275 | + <span style="float: right; margin-left: 20px; color: ${D};"> | |
| 276 | + ${B} | |
| 271 | 277 | </span> |
| 272 | - </div>`}),F}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12,formatter:x=>Je.formatScaled(x)},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};y.setOption(w,{notMerge:!0,replaceMerge:["series"]})};Ce([()=>c.value,i,()=>l.value],()=>{Se(C)},{deep:!0});const b=()=>{l.value=Te.isDark(),Se(()=>{C()})};return Qe(()=>{window.addEventListener("onFluentCartThemeChange",b,!1),window.addEventListener("fluentCartCurrencyChange",C),Se(v)}),Ct(()=>{window.removeEventListener("onFluentCartThemeChange",b,!1),window.removeEventListener("fluentCartCurrencyChange",C,!1)}),(w,x)=>(r(),$(xe,null,{default:d(()=>[e.title!==""?(r(),$(Ve,{key:0,border_bottom:!0},{title:d(()=>[o("h3",xre,f(e.title),1)]),_:1})):k("",!0),n(ke,null,{default:d(()=>[m.value?(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:s},null,512))]),_:1})]),_:1}))}},Sre={class:"fct-overview-report-loader-wrap"},Fre={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},$re={class:"fct-card-header-title is-small"},Ere={class:"flex gap-2 mt-1"},Ure={class:"py-6"},Ire={class:"grid grid-cols-1"},Qre={class:"fct-card-header-title is-small"},Dre={class:"py-6"},Vre={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Tre={class:"fct-card-header-title is-small"},Mre={class:"flex gap-2 mt-1"},Lre={class:"py-6"},Rre={class:"grid grid-cols-1"},Ore={class:"fct-card-header-title is-small"},Hre={class:"py-6"},Pre={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Nre={class:"fct-card-header-title is-small"},Kre={class:"py-6"},Gre={__name:"OverviewLoading",setup(e){const t=[{title:u("Gross Summary"),key:"gross_summary"},{title:u("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:u("Net Revenue"),key:"net_revenue"},{title:u("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],l=[{title:u("Top Country Gross Volume"),key:"top_country_gross"},{title:u("Top Country Net Volume"),key:"top_country_net"}],s=[{title:u("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:u("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(i,c)=>{const p=B("el-skeleton-item"),m=B("el-skeleton");return r(),h("div",Sre,[o("div",Fre,[(r(),h(O,null,ae(t,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",$re,f(_.title),1),o("div",Ere,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Ure,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Ire,[(r(),h(O,null,ae(2,_=>o("div",{key:_},[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Ve,{border_bottom:!0},{title:d(()=>[o("h2",Qre,f(A(u)("Gross Volume Breakdown")),1)]),_:1}),o("div",Dre,[n(m,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",Vre,[(r(),h(O,null,ae(a,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",Tre,f(_.title),1),o("div",Mre,[n(m,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Lre,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Rre,[(r(),h(O,null,ae(l,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h2",Ore,f(_.title),1)]),_:2},1024),o("div",Hre,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Pre,[(r(),h(O,null,ae(s,(_,g)=>o("div",{key:g},[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",Nre,f(_.title),1)]),_:2},1024),o("div",Kre,[n(m,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},jre={class:"overview-summary-report-inline"},zre={class:"inner-value"},qre={__name:"Summary",props:{title:{type:String},current:{type:[String,Number],required:!0},previous:{type:[String,Number],required:!0},fluctuation:{type:[String,Number],required:!0}},setup(e){return(t,a)=>(r(),h("div",jre,[o("div",zre,[n(Is,{amount:A(Je).formatScaled(e.current),title:A(u)(e.title)},null,8,["amount","title"])]),n(ml,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:A(u)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},fo=lt(qre,[["__scopeId","data-v-b394c9f1"]]),Yre={class:"report-overview-page"},Wre={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},Xre={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Jre={class:"fct-card-header-title is-small"},Zre={class:"fct-card-header-title is-small"},ede={class:"grid grid-cols-1"},tde=["innerHTML"],ade=["innerHTML"],lde={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},sde={class:"fct-card-header-title is-small"},nde={class:"fct-card-header-title is-small"},ode={class:"grid gap-4 grid-cols-1"},ide={class:"grid gap-4 grid-cols-1"},rde={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},dde={__name:"Overview",setup(e){const t=V({}),a=V(!0),l=V({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),s=()=>{ce.get("reports/overview").then(p=>{t.value=p.data,i()}).catch(p=>{}).finally(()=>{a.value=!1})},i=()=>{l.value.gross_revenue_quarterly=c(t.value.gross_revenue_quarterly,"current","prev_year"),l.value.net_revenue_quarterly=c(t.value.net_revenue_quarterly,"current","prev_year")},c=(p,m="current",_="prev")=>{const g=rt.sum(p,"*."+m),y=rt.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return K(()=>{var p,m;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((m=t.value.gross_summary)==null?void 0:m.yoy_growth)===null?"warning":"success"}),Qe(()=>{s()}),(p,m)=>(r(),h("div",Yre,[o("div",Wre,[n(ee,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+f(A(u)("Last %s Months",A(u)(12))),1)]),a.value?(r(),$(Gre,{key:0})):(r(),h(O,{key:1},[o("div",Xre,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h3",Jre,f(A(u)("Gross Summary")),1),n(fo,{current:t.value.gross_summary.total,previous:t.value.gross_summary.total_prev,fluctuation:t.value.gross_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),n(po,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h3",Zre,f(A(u)("Gross Revenue Quarterly")),1),n(fo,{current:l.value.gross_revenue_quarterly.current,previous:l.value.gross_revenue_quarterly.prev,fluctuation:l.value.gross_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),n(po,{data:t.value.gross_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!l.value.gross_revenue_quarterly.current},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",ede,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(Je).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,tde),n(sc,{title:"Gross Volume Breakdown",data:t.value.gross_revenue,dataKey:"current","is-date":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(Je).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,ade),n(sc,{title:A(u)("Gross Revenue Breakdown"),data:t.value.gross_revenue_quarterly,dataKey:"current",prevKey:"prev_year",labelKey:"yy_growth","bar-max-width":80,"is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1})]),o("div",lde,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",sde,f(A(u)("Net Revenue")),1),n(fo,{title:"Net Revenue",current:t.value.net_summary.total,previous:t.value.net_summary.total_prev,fluctuation:t.value.net_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),n(po,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",nde,f(A(u)("Net Revenue Quarterly")),1),n(fo,{title:"Net Revenue Quarterly",current:l.value.net_revenue_quarterly.current,previous:l.value.net_revenue_quarterly.prev,fluctuation:l.value.net_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),n(po,{data:t.value.net_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",ode,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(nc,{data:t.value.top_country_gross,title:A(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",ide,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(nc,{data:t.value.top_country_net,title:A(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",rde,[n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>{var _;return[n(oc,{data:(_=t.value.top_country_gross)==null?void 0:_.by_countries,title:A(u)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(ke,null,{default:d(()=>{var _;return[n(oc,{data:(_=t.value.top_country_net)==null?void 0:_.by_countries,title:A(u)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},ude={class:"setting-wrap"},cde={class:"setting-wrap-inner"},Ade={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},pde={class:"grid gap-3 mb-6"},fde={class:"grid gap-3 mb-6"},mde={class:"grid gap-3 mb-6"},hde={class:"grid gap-3"},_de={class:"payment-method-list fct-content-card-list"},vde={class:"flex items-start gap-3"},gde={class:"grid gap-2 flex-1"},yde={key:0,class:"fct-content-card-list-head stripe"},bde=["src","alt"],wde=["src","alt"],Cde={class:"block font-semibold text-system-dark dark:text-system-light"},Bde={class:"fct-content-card-list-content"},kde={class:"fct-content-card-list-action flex items-center gap-2"},xde={key:0},Sde=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=Bp(),{form:a}=t.data,l=fs(),s=V([]),i=V([]),c=V(!0),p=V(!1),m=V(!0),_=V({}),g=V(!1),y=V({}),v=V(!1),C=V(""),b=V(""),w=K(()=>Object.keys(y.value).length>0),x=()=>{p.value=!0;let I=a.values;ce.post("settings/modules",{...I}).then(T=>{z.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(T=>{if(T&&T.message)return z.error(T);_.value=T}).finally(()=>{p.value=!1,m.value=!1,c.value=!1})},F=()=>{c.value=!0,ce.get("settings/modules",{}).then(I=>{var E,D;a.setSchema(I.fields).setDefaults(I.settings).initForm(),s.value=I.settings,i.value=I.fields,m.value=!1,p.value=!1;const T=((D=(E=I.fields)==null?void 0:E.modules_settings)==null?void 0:D.schema)||[];let Q=!1;Array.isArray(T)?Q=T.length>0:Q=Object.keys(T).length>0,g.value=Q}).finally(()=>{c.value=!1})},L=()=>{v.value=!0,ce.get("settings/modules/plugin-addons",{}).then(I=>{y.value=I.addons||{}}).catch(I=>{z.error(I)}).finally(()=>{v.value=!1})},U=ze.get("app_config.isProActive"),S=(I,T)=>{if(!U){window.open(I.repo_link,"_blank","noopener,noreferrer");return}C.value=T,ce.post("settings/modules/plugin-addons/install",{plugin_slug:I.plugin_slug,source_type:I.source_type||"wordpress",source_link:I.source_link||"",asset_path:I.asset_path||""}).then(Q=>{Q.action==="copy"&&Q.url?(Yl.copy(Q.url,{successMessage:u("Download link copied to your clipboard")}),window.open(Q.url,"_blank","noopener,noreferrer")):Q.action==="reload"?(z.success(Q.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):z.success(Q.message||u("Addon installed successfully"))}).catch(Q=>{z.error(Q)}).finally(()=>{C.value=""})},M=(I,T)=>{b.value=T,ce.post("settings/modules/plugin-addons/activate",{plugin_file:I.plugin_file}).then(Q=>{z.success(Q.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(Q=>{z.error(Q)}).finally(()=>{b.value=""})};return Qe(()=>{F(),L()}),l.onSave(x),(I,T)=>{const Q=B("el-skeleton-item"),E=B("el-skeleton"),D=B("el-form"),H=B("el-button"),P=B("el-icon"),G=B("router-link");return r(),h("div",ude,[n(Ea,{heading:A(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",cde,[n(Ua),m.value?(r(),h("div",Ade,[n(E,{loading:m.value,animated:""},{template:d(()=>[o("div",pde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",fde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",mde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})]),o("div",hde,[n(Q,{variant:"p",class:"w-[20%]"}),n(Q,{variant:"p"})])]),_:1},8,["loading"])])):k("",!0),m.value?k("",!0):(r(),h(O,{key:1},[A(a).isReady?(r(),$(D,{key:0},{default:d(()=>[g.value?(r(),$(vi,{key:0,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:x,submitButtonText:A(u)("Save Settings"),loading:p.value,onOnChange:T[0]||(T[0]=J=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):w.value?k("",!0):(r(),$(xe,{key:1},{default:d(()=>[n(Ve,{title:A(u)("Features & addon"),border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[n(_t,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:A(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):k("",!0),w.value?(r(),$(xe,{key:1,class:"mt-6"},{default:d(()=>[n(Ve,{title:A(u)("Plugin Addons"),border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[o("div",_de,[(r(!0),h(O,null,ae(y.value,(J,oe)=>(r(),h("div",{key:oe,class:"fct-content-card-list-item"},[o("div",vde,[o("div",gde,[J.logo?(r(),h("div",yde,[o("img",{class:de({"dark:hidden":J.dark_logo}),src:J.logo,alt:J.title},null,10,bde),J.dark_logo?(r(),h("img",{key:0,src:J.dark_logo,alt:J.title,class:"hidden dark:block"},null,8,wde)):k("",!0),o("span",Cde,f(J.title),1),J.is_active?(r(),$(Aa,{key:1,status:"active",text:A(u)("Active")},null,8,["text"])):k("",!0)])):k("",!0),o("div",Bde,[o("p",null,f(J.description),1)])]),o("div",kde,[J.upcoming?(r(),h("div",xde,f(A(u)("Coming Soon")),1)):(r(),h(O,{key:1},[J.is_installed?J.is_installed&&!J.is_active&&(A(U)||J.source_type!=="github")?(r(),$(H,{key:1,type:"success",size:"small",loading:b.value===oe,disabled:b.value===oe,onClick:Z=>M(J,oe)},{default:d(()=>[R(f(A(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):k("",!0):(r(),$(H,{key:0,type:"primary",size:"small",loading:C.value===oe,disabled:C.value===oe,onClick:Z=>S(J,oe)},{default:d(()=>[R(f(A(U)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),J.is_active&&oe==="fluent-pdf"?(r(),$(G,{key:2,to:{path:"/settings/pdf-template"}},{default:d(()=>[n(P,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:d(()=>[n(A(Vc))]),_:1})]),_:1})):k("",!0)],64))])])]))),128))])]),_:1})]),_:1})):k("",!0)],64))])])}}}),Fde=lt(Sde,[["__scopeId","data-v-68277391"]]),$de={class:"form-note"},Ede={class:"form-note"},Ude={class:"form-note"},Ide={class:"form-note"},Qde={class:"el-form-item__label"},Dde={class:"h-[297px] w-full relative"},Vde={class:"mt-2 mb-2"},Tde={class:"form-note"},Mde={class:"fct-powered-by-email-footer-checkbox mb-4 pb-4 border-[1px] border-l-0 border-t-0 border-r-0 border-solid border-gray-outline dark:border-dark-400"},Lde={class:"setting-html-wrapper"},Rde={class:"setting-label"},Ode={class:"form-note"},Hde={class:"setting-fields-inner w-full"},Pde={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton"),i=B("el-form-item"),c=B("el-col"),p=B("el-row");return r(),$(ke,null,{default:d(()=>[n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9 gap-2"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=o("br",null,null,-1)),o("div",null,[o("div",$de,[o("p",null,f(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Ede,[o("p",null,f(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This | |
| 273 | -email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",Ude,[o("p",null,f(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Ide,[o("p",null,f(A(u)(`If someone replies to your notification email, this is where you would like to | |
| 274 | -receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[o("div",Qde,f(A(u)("Email Footer")),1),o("div",Dde,[n(s,{animated:"",rows:7})]),o("div",Vde,[o("div",Tde,[o("p",null,f(A(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for | |
| 275 | -compliance.`)),1)])]),o("div",Mde,[n(s,{animated:"",class:"h-5"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[n(i,null,{default:d(()=>[n(p,{gutter:15,class:"w-full"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[o("div",Lde,[o("span",Rde,f(A(u)("Admin Email Address")),1),o("div",Ode,[o("p",null,f(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(c,{lg:12},{default:d(()=>[o("div",Hde,[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},Nde={class:"setting-wrap"},Kde={class:"setting-wrap-inner"},Gde={class:"form-note"},jde={class:"form-note"},zde={class:"form-note"},qde={class:"form-note"},Yde={class:"el-form-item__label"},Wde={class:"mt-2 mb-2"},Xde={class:"form-note"},Jde={class:"fct-powered-by-email-footer-checkbox"},Zde={class:"setting-html-wrapper"},eue={class:"setting-label"},tue={class:"form-note"},aue={class:"setting-fields-inner w-full"},lue={class:"setting-save-action"},sue={__name:"MailingSettings",setup(e){const t=V({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=ze.get("app_config.isProActive"),l=V(!1),s=V({}),i=V({}),c=()=>{l.value=!0,ce.get("email-notification/get-settings").then(m=>{var _,g,y,v,C,b,w;t.value={from_name:(_=m.data)==null?void 0:_.from_name,from_email:(g=m.data)==null?void 0:g.from_email,reply_to_name:(y=m.data)==null?void 0:y.reply_to_name,reply_to_email:(v=m.data)==null?void 0:v.reply_to_email,email_footer:(C=m.data)==null?void 0:C.email_footer,admin_email:(b=m.data)==null?void 0:b.admin_email,show_email_footer:((w=m.data)==null?void 0:w.show_email_footer)||"yes"},i.value=m.shortcodes}).catch(m=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,s.value={},ce.post("email-notification/save-settings",t.value).then(m=>{z.success(m.message)}).catch(m=>{m.status_code===422&&m.data?s.value=m.data:m.message?z.error(m.message):(z.error(u("Something went wrong")),s.value=m)}).finally(()=>{l.value=!1})};return Qe(()=>{c()}),(m,_)=>{const g=B("el-input"),y=B("el-form-item"),v=B("el-col"),C=B("el-row"),b=B("el-tooltip"),w=B("el-checkbox"),x=B("el-button");return r(),h("div",Nde,[n(Ea,{heading:A(u)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",Kde,[n(Ua),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Email Configuration"),text:A(u)("Set your from name, email, and email footer. These configurations will be used to send emails from %s.","FluentCart"),border_bottom:""},null,8,["title","text"]),l.value?(r(),$(Pde,{key:0})):(r(),$(ke,{key:1},{default:d(()=>[n(C,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_name,"onUpdate:modelValue":_[0]||(_[0]=F=>t.value.from_name=F)},null,8,["modelValue"]),_[9]||(_[9]=o("br",null,null,-1)),o("div",null,[n(fl,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",Gde,[o("p",null,f(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_email,"onUpdate:modelValue":_[1]||(_[1]=F=>t.value.from_email=F)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",jde,[o("p",null,f(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This | |
| 276 | -email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(C,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=F=>t.value.reply_to_name=F)},null,8,["modelValue"]),o("div",zde,[o("p",null,f(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=F=>t.value.reply_to_email=F)},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",qde,[o("p",null,f(A(u)(`If someone replies to your notification email, this is where you would like to | |
| 277 | -receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(C,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[o("div",Yde,f(A(u)("Email Footer")),1),n(Wl,{"short-codes":i.value,modelValue:t.value.email_footer,"onUpdate:modelValue":_[4]||(_[4]=F=>t.value.email_footer=F),onUpdate:_[5]||(_[5]=F=>{t.value.email_footer=F})},null,8,["short-codes","modelValue"]),o("div",Wde,[n(fl,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",Xde,[o("p",null,f(A(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for | |
| 278 | -compliance.`)),1)])]),o("div",Jde,[n(w,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=F=>t.value.show_email_footer=F),"true-value":"yes","false-value":"no",disabled:!A(a)},{default:d(()=>[R(f(A(u)("Enable powered by FluentCart in the email footer"))+" ",1),A(a)?k("",!0):(r(),$(b,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:d(()=>[R(f(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(ee,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),n(C,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[n(y,null,{default:d(()=>[n(C,{gutter:15,class:"w-full"},{default:d(()=>[n(v,{lg:12},{default:d(()=>[o("div",Zde,[o("span",eue,f(A(u)("Admin Email Address")),1),o("div",tue,[o("p",null,f(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(v,{lg:12},{default:d(()=>[o("div",aue,[n(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=F=>t.value.admin_email=F)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",lue,[n(x,{type:"primary",onClick:_[8]||(_[8]=F=>p()),loading:l.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},nue={class:"setting-wrap"},oue={class:"setting-wrap-inner"},iue={class:"form-note"},rue={class:"form-note"},due={class:"form-note",style:{"padding-top":"6px"}},uue={class:"form-note"},cue={class:"setting-save-action"},ic="{{wp.admin_email}}",Aue={__name:"StoreDigestSettings",setup(e){const t=V({recipients:"{{wp.admin_email}}",send_when_empty:"no",daily:{enabled:"no",send_hour:8},weekly:{enabled:"no",send_hour:8,send_dow:1},monthly:{enabled:"no",send_hour:8}}),a=V(!1),l=V({}),s=V(""),i=[{key:"daily",label:u("Daily digest"),desc:u("Yesterday's performance, sent every morning.")},{key:"weekly",label:u("Weekly digest"),desc:u("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:u("Monthly digest"),desc:u("The previous calendar month, sent on the 1st.")}],c=u("Comma-separate multiple addresses. %1$s resolves to the site admin email.",ic),p=K(()=>{const v=[];for(let C=0;C<24;C++)v.push({value:C,label:String(C).padStart(2,"0")+":00"});return v}),m=[{value:1,label:u("Monday")},{value:2,label:u("Tuesday")},{value:3,label:u("Wednesday")},{value:4,label:u("Thursday")},{value:5,label:u("Friday")},{value:6,label:u("Saturday")},{value:7,label:u("Sunday")}],_=()=>{a.value=!0,ce.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},g=()=>{a.value=!0,l.value={},ce.post("email-notification/digest-settings",t.value).then(v=>{z.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?z.error(v.message):z.error(u("Something went wrong"))}).finally(()=>{a.value=!1})},y=v=>{s.value=v,ce.post("email-notification/digest-settings/send-test",{frequency:v}).then(C=>{z.success(C.message)}).catch(C=>{z.error(C.message||u("Could not send the test email."))}).finally(()=>{s.value=""})};return Qe(()=>{_()}),(v,C)=>{const b=B("el-input"),w=B("el-form-item"),x=B("el-col"),F=B("el-checkbox"),L=B("el-row"),U=B("el-switch"),S=B("el-option"),M=B("el-select"),I=B("el-button");return r(),h("div",nue,[n(Ea,{heading:A(u)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",oue,[n(Ua),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Recipients & General"),text:A(u)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),n(ke,null,{default:d(()=>[n(L,{gutter:15},{default:d(()=>[n(x,{lg:12},{default:d(()=>[n(w,{label:A(u)("Recipient email addresses"),"label-position":"top"},{default:d(()=>[n(b,{modelValue:t.value.recipients,"onUpdate:modelValue":C[0]||(C[0]=T=>t.value.recipients=T),placeholder:ic},null,8,["modelValue"]),o("div",null,[n(fl,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",iue,[o("p",null,f(A(c)),1)])])]),_:1},8,["label"])]),_:1}),n(x,{lg:12},{default:d(()=>[n(w,{label:A(u)("Empty periods"),"label-position":"top"},{default:d(()=>[n(F,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":C[1]||(C[1]=T=>t.value.send_when_empty=T),"true-value":"yes","false-value":"no"},{default:d(()=>[R(f(A(u)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",rue,[o("p",null,f(A(u)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(r(),h(O,null,ae(i,T=>n(xe,{key:T.key,class:"fct-mt-4"},{default:d(()=>[n(Ve,{title:T.label,text:T.desc,border_bottom:""},null,8,["title","text"]),n(ke,null,{default:d(()=>[n(L,{gutter:15,align:"middle"},{default:d(()=>[n(x,{lg:6},{default:d(()=>[n(w,{label:A(u)("Enable"),"label-position":"top"},{default:d(()=>[n(U,{modelValue:t.value[T.key].enabled,"onUpdate:modelValue":Q=>t.value[T.key].enabled=Q,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(x,{lg:6},{default:d(()=>[n(w,{label:A(u)("Send time"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:t.value[T.key].send_hour,"onUpdate:modelValue":Q=>t.value[T.key].send_hour=Q,class:"w-full"},{default:d(()=>[(r(!0),h(O,null,ae(p.value,Q=>(r(),$(S,{key:Q.value,label:Q.label,value:Q.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),T.key==="weekly"?(r(),$(x,{key:0,lg:6},{default:d(()=>[n(w,{label:A(u)("Day of week"),"label-position":"top"},{default:d(()=>[n(M,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":C[2]||(C[2]=Q=>t.value.weekly.send_dow=Q),class:"w-full"},{default:d(()=>[(r(),h(O,null,ae(m,Q=>n(S,{key:Q.value,label:Q.label,value:Q.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):k("",!0),T.key==="monthly"?(r(),$(x,{key:1,lg:6},{default:d(()=>[n(w,{label:A(u)("Send day"),"label-position":"top"},{default:d(()=>[o("div",due,[o("p",null,f(A(u)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):k("",!0),n(x,{lg:6},{default:d(()=>[n(w,{label:" ","label-position":"top"},{default:d(()=>[n(I,{loading:s.value===T.key,onClick:Q=>y(T.key)},{default:d(()=>[R(f(A(u)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",uue,[o("p",null,f(A(u)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",cue,[n(I,{type:"primary",onClick:C[3]||(C[3]=T=>g()),loading:a.value},{default:d(()=>[R(f(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},pue={};function fue(e,t){const a=B("router-view");return r(),h("div",null,[n(a)])}const mue=lt(pue,[["render",fue]]),hue={},_ue={class:"fct-setting-form-row"},vue={class:"w-[300px]"},gue={class:"flex-grow flex-shrink flex-basis-0 self-center"},yue={class:"fct-setting-form-row"},bue={class:"w-[300px]"},wue={class:"flex-grow flex-shrink flex-basis-0 self-center"},Cue={class:"fct-setting-form-row"},Bue={class:"w-[300px]"},kue={class:"flex-grow flex-shrink flex-basis-0 self-center"};function xue(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),h("div",null,[o("div",_ue,[o("div",vue,[n(l,{animated:"",class:"max-w-[70%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-[80%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"}),n(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),o("div",gue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",yue,[o("div",bue,[n(l,{animated:"",class:"max-w-[60%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",wue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",Cue,[o("div",Bue,[n(l,{animated:"",class:"max-w-[50%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",kue,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const Sue=lt(hue,[["render",xue]]),Fue={name:"TaxConfigurations",components:{TaxConfigurationsLoader:Sue,CardContainer:xe,CardBody:ke,CardHeader:Ve,LabelHint:ca,SettingsHeader:Ea,AdminNotice:Ua,Animation:_a},data(){return{settings:{enable_tax:"no",tax_inclusion:"included",tax_calculation_basis:"shipping",tax_rounding:"item",checkout_tax_breakdown_display:"both",price_suffix_included:"",price_suffix_excluded:"",eu_vat_settings:{require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[]}},tax_settings_changed:!1,saving:!1,loading:!1,categories:[],fetchingCategories:!1,keyboardShortcuts:null}},computed:{handlePriceMode(){return this.settings.eu_vat_settings.local_reverse_charge=="yes"}},mounted(){this.bindSaveShortcut(),this.getSettings(),this.fetchCategories()},beforeUnmount(){this.unbindSaveShortcut()},methods:{translate:u,saveSettings(){this.saving||this.loading||(this.saving=!0,this.$post("tax/configuration/settings",{settings:this.settings}).then(e=>{this.handleSuccess(e.message),this.tax_settings_changed=!0,ze.mergeConfig({is_tax_enabled:this.settings.enable_tax==="yes"})}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message),this.saving=!1}).finally(()=>{this.saving=!1}))},getSettings(){this.loading=!0,this.$get("tax/configuration/settings").then(e=>{if(this.settings=e.settings,this.settings.eu_vat_settings={require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[],...this.settings.eu_vat_settings||{}},this.settings.checkout_tax_breakdown_display||(this.settings.checkout_tax_breakdown_display="both"),!Array.isArray(this.settings.eu_vat_settings.vat_reverse_excluded_categories))this.settings.eu_vat_settings.vat_reverse_excluded_categories=[];else{let t=this.settings.eu_vat_settings.vat_reverse_excluded_categories.map(a=>a.toString());this.settings.eu_vat_settings.vat_reverse_excluded_categories=t}}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},fetchCategories(){this.categories.length>0||(this.fetchingCategories=!0,this.$get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms||[]}).catch(()=>{}).finally(()=>{this.fetchingCategories=!1}))},bindSaveShortcut(){this.keyboardShortcuts=ps(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},$ue={class:"setting-wrap"},Eue={class:"setting-wrap-inner"},Uue={class:"fct-setting-form-row"},Iue={class:"fct-setting-form-content flex gap-3.5 flex-1"},Que={class:"fct-inline-tip"},Due={key:1},Vue={class:"fct-setting-form-row"},Tue={class:"fct-setting-form-content"},Mue={class:"fct-inline-tip"},Lue={class:"fct-setting-form-fields self-center"},Rue={class:"fct-inline-tip mt-2"},Oue={class:"fct-setting-form-row"},Hue={class:"fct-setting-form-content"},Pue={class:"fct-inline-tip"},Nue={class:"fct-setting-form-fields self-center"},Kue={class:"flex flex-col"},Gue={class:"price-mode-label"},jue={class:"price-mode-text"},zue={class:"flex flex-col"},que={class:"price-mode-label"},Yue={class:"price-mode-text"},Wue={class:"fct-setting-form-row"},Xue={class:"fct-setting-form-content"},Jue={class:"fct-inline-tip"},Zue={class:"fct-setting-form-fields self-center"},ece={class:"fct-setting-form-row"},tce={class:"fct-setting-form-content"},ace={class:"fct-inline-tip"},lce={class:"fct-setting-form-fields self-center"},sce={class:"fct-setting-form-row"},nce={class:"fct-setting-form-content"},oce={class:"fct-inline-tip"},ice={class:"fct-setting-form-fields self-center"},rce={class:"fct-setting-form-row"},dce={class:"fct-setting-form-content"},uce={class:"fct-inline-tip"},cce={class:"fct-setting-form-fields self-center"},Ace={class:"fct-setting-form-row"},pce={class:"fct-setting-form-content"},fce={class:"fct-inline-tip"},mce={class:"fct-setting-form-fields"},hce={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},_ce={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},vce={class:"fct-inline-tip"},gce={class:"fct-vat-excluded-categories"},yce={class:"fct-inline-tip"};function bce(e,t,a,l,s,i){const c=B("SettingsHeader"),p=B("AdminNotice"),m=B("el-switch"),_=B("LabelHint"),g=B("TaxConfigurationsLoader"),y=B("el-radio"),v=B("el-radio-group"),C=B("el-option"),b=B("el-select"),w=B("el-input"),x=B("Animation"),F=B("CardBody"),L=B("CardContainer"),U=Va("loading");return r(),h("div",$ue,[n(c,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",Eue,[n(p),n(L,null,{default:d(()=>[n(F,null,{default:d(()=>[o("div",Uue,[o("div",Iue,[n(m,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=S=>s.settings.enable_tax=S),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",Que,f(s.settings.enable_tax==="yes"?i.translate("This store is now collecting tax."):i.translate("This store is not collecting tax.")),1)])])]),n(x,{visible:s.settings.enable_tax==="yes",accordion:""},{default:d(()=>[s.loading?(r(),$(g,{key:0})):k("",!0),s.loading?k("",!0):(r(),h("div",Due,[o("div",Vue,[o("div",Tue,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",Mue,f(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",Lue,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=S=>s.settings.tax_inclusion=S)},{default:d(()=>[n(y,{value:"included"},{default:d(()=>[R(f(i.translate("Included")),1)]),_:1}),n(y,{value:"excluded"},{default:d(()=>[R(f(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",Rue,f(i.translate("Shipping tax always follows the store-level tax mode (Included or Excluded). Product-specific tax settings do not apply to shipping.")),1)])]),o("div",Oue,[o("div",Hue,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",Pue,f(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",Nue,[n(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=S=>s.settings.eu_vat_settings.reverse_charge_price_mode=S),class:"fct-reverse-charge-price-mode"},{default:d(()=>[n(y,{value:"fixed"},{default:d(()=>[o("div",Kue,[o("span",Gue,f(i.translate("Fixed")),1),o("span",jue,f(i.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),n(y,{value:"dynamic"},{default:d(()=>[o("div",zue,[o("span",que,f(i.translate("Dynamic")),1),o("span",Yue,f(i.translate("VAT is stripped from the price on reverse charge. Customer pays the net (ex-VAT) amount.")),1)])]),_:1})]),_:1},8,["modelValue"])])]),o("div",Wue,[o("div",Xue,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",Jue,f(i.translate("Determine the location used for tax calculations.")),1)]),o("div",Zue,[n(b,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=S=>s.settings.tax_calculation_basis=S),clearable:""},{default:d(()=>[n(C,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),n(C,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),n(C,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",ece,[o("div",tce,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",ace,f(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",lce,[n(w,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=S=>s.settings.price_suffix_included=S),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",sce,[o("div",nce,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",oce,f(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",ice,[n(w,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=S=>s.settings.price_suffix_excluded=S),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",rce,[o("div",dce,[n(_,{title:i.translate("Checkout Tax Breakdown Display")},null,8,["title"]),o("p",uce,f(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",cce,[n(b,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=S=>s.settings.checkout_tax_breakdown_display=S)},{default:d(()=>[n(C,{value:"both",label:i.translate("Item label and tooltip")},null,8,["label"]),n(C,{value:"label",label:i.translate("Item label only")},null,8,["label"]),n(C,{value:"tooltip",label:i.translate("Tooltip only")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",Ace,[o("div",pce,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",fce,f(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",mce,[o("div",hce,[o("div",_ce,[n(m,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[7]||(t[7]=S=>s.settings.eu_vat_settings.local_reverse_charge=S),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",vce,f(i.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),n(x,{visible:i.handlePriceMode,accordion:""},{default:d(()=>[o("div",gce,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",yce,f(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),jt((r(),$(b,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[8]||(t[8]=S=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=S),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:d(()=>[(r(!0),h(O,null,ae(s.categories,S=>(r(),$(C,{key:S.value||S.term_id,label:S.label||S.name,value:S.value||S.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[U,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const wce=lt(Fue,[["render",bce]]),Cce={class:"fct-tax-rates-wrap-loader px-5"},Bce={__name:"TaxRatesLoader",setup(e){const t=V(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const s=B("el-skeleton-item"),i=B("el-skeleton");return r(),h("div",Cce,[(r(!0),h(O,null,ae(t.value,(c,p)=>(r(),h("div",{key:p,class:"flex items-center justify-between border-[1px] border-solid border-gray-divider dark:border-dark-400 rounded h-12 pr-4 pl-6 mb-4"},[n(i,{animated:"",style:na({width:c}),class:"h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),n(i,{animated:"",class:"w-[100px] h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},kce={class:"setting-wrap"},xce={class:"setting-wrap-inner"},Sce={class:"fct-all-tax-classes-page"},Fce={class:"flex items-center justify-end gap-4"},$ce={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},Ece={class:"inline-flex items-center gap-2"},Uce={class:"inline-flex items-center gap-2"},Ice=["src","alt"],Qce={key:0,class:"text-gray-400 dark:text-gray-300"},Dce={key:1,class:"text-success-500"},Vce={key:2,class:"text-system-mid dark:text-gray-300"},Tce={key:3,class:"text-gray-400 dark:text-gray-300"},Mce={key:1,class:"text-gray-400"},Lce={__name:"TaxRates",setup(e){const t=V({}),a=V([]),l=V({}),s=V({}),i=K(()=>!!ze.get("is_tax_enabled")),c=V(!1),p=V({}),m={};let _=0;const g=V(""),y=V(!1),v={XI:"gb"},C=Q=>(v[Q]||Q).toLowerCase(),b=K(()=>{const Q=new Set;for(const E of a.value)for(const D of E.countries||[])Q.add(D.country_code);return Q}),w=Q=>!Q||!Object.prototype.hasOwnProperty.call(s.value,Q)?!0:s.value[Q],x=Q=>!Q||!Q.vat?!1:Q.rates&&typeof Q.rates=="object"&&Object.keys(Q.rates).length?Object.values(Q.rates).some(E=>E&&parseFloat(E.rate)>0):parseFloat(Q.rate)>0,F=K(()=>{const Q=l.value||{},E=Array.isArray(Q.country_registrations)?Q.country_registrations:[],D=Q.method||"",H=E.some(x);if(D==="oss")return!!Q.oss_country;if(D==="home"){const P=Q.home_country||"",G=E.find(J=>J.country===P);if(P&&G&&x(G))return!0}return D==="specific"?!!Q.home_country:H}),L=K(()=>{const Q=l.value||{},E=Array.isArray(Q.country_registrations)?Q.country_registrations:[],D=Q.method||"";return D==="oss"?!!Q.oss_country:D==="home"?!!Q.home_country&&E.some(H=>H.country===Q.home_country):D==="specific"?!!Q.home_country:E.some(x)}),U=K(()=>{const Q=[],E=Object.values(t.value||{});for(const P of E)if(P.group_code==="EU")Q.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:L.value,enabled:w("EU"),collecting:L.value&&F.value&&w("EU")});else for(const G of P.countries||[]){const J=b.value.has(G.country_code),oe=w(G.country_code);Q.push({country_code:G.country_code,country_name:G.country_name,isEU:!1,group_code:P.group_code,hasConfig:J,enabled:oe,collecting:J&&oe})}const D=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],H=new Set(D);return Q.sort((P,G)=>{if(P.hasConfig!==G.hasConfig)return P.hasConfig?-1:1;const J=H.has(P.country_code),oe=H.has(G.country_code);return J&&oe?D.indexOf(P.country_code)-D.indexOf(G.country_code):J?-1:oe?1:P.country_name.localeCompare(G.country_name)}),Q}),S=K(()=>{const Q=g.value.trim().toLowerCase();return U.value.filter(E=>y.value&&(!i.value||!E.collecting)?!1:Q?E.country_name.toLowerCase().includes(Q)||E.country_code.toLowerCase().includes(Q):!0)}),M=K(()=>{if(!i.value)return!1;const Q=U.value.filter(D=>D.enabled).length,E=U.value.filter(D=>!D.enabled).length;return Q>0&&E>0}),I=()=>{c.value=!0,Promise.all([ce.get("tax/configuration/rates"),ce.get("tax/rates"),ce.get("tax/configuration/settings")]).then(([Q,E,D])=>{var H;t.value=Q.tax_rates,a.value=E.tax_rates,s.value=E.country_enabled_map||{},l.value=((H=D.settings)==null?void 0:H.eu_vat_settings)||{}}).catch(Q=>{}).finally(()=>{c.value=!1})},T=(Q,E)=>{const D=w(Q.country_code),H=++_;m[Q.country_code]=H,s.value={...s.value,[Q.country_code]:E},p.value={...p.value,[Q.country_code]:!0},ce.post("tax/country-status/"+Q.country_code,{enabled:E?1:0}).then(P=>{m[Q.country_code]===H&&(z.success(P.message),s.value={...s.value,[Q.country_code]:P.enabled})}).catch(P=>{var G;m[Q.country_code]===H&&(s.value={...s.value,[Q.country_code]:D},z.error(((G=P==null?void 0:P.data)==null?void 0:G.message)||u("Failed to update tax status")))}).finally(()=>{if(m[Q.country_code]===H){const P={...p.value};delete P[Q.country_code],p.value=P}})};return Qe(()=>{I()}),(Q,E)=>{const D=B("el-checkbox"),H=B("el-input"),P=B("el-table-column"),G=B("el-switch"),J=B("el-table");return r(),h("div",kce,[n(Ea,{heading:A(u)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",xce,[n(Ua),o("div",Sce,[n(xe,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Tax Regions"),text:A(u)("Manage tax rates for different regions")},{action:d(()=>[o("div",Fce,[M.value?(r(),$(D,{key:0,modelValue:y.value,"onUpdate:modelValue":E[0]||(E[0]=oe=>y.value=oe)},{default:d(()=>[R(f(A(u)("Collecting Tax")),1)]),_:1},8,["modelValue"])):k("",!0),n(H,{modelValue:g.value,"onUpdate:modelValue":E[1]||(E[1]=oe=>g.value=oe),class:"w-[200px]",placeholder:A(u)("Search regions..."),size:"small",clearable:""},{prefix:d(()=>[n(ee,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[!c.value&&!i.value?(r(),h("div",$ce,[n(Za,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):k("",!0),c.value?(r(),$(Bce,{key:1})):(r(),$(J,{key:2,data:S.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:d(()=>[n(P,{label:A(u)("Region"),"min-width":"300"},{default:d(({row:oe})=>[oe.isEU?(r(),$(wa,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:d(()=>[o("div",Ece,[E[2]||(E[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+f(oe.country_name),1)])]),_:2},1024)):(r(),$(wa,{key:1,to:{name:"tax-rates-country-single",params:{country:oe.country_code,group:oe.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:d(()=>[o("div",Uce,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${C(oe.country_code)}.png`,alt:oe.country_code},null,8,Ice),R(" "+f(oe.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(P,{label:A(u)("Collecting"),width:"200"},{default:d(({row:oe})=>[i.value?oe.collecting?(r(),h("span",Dce,f(A(u)("Collecting tax")),1)):oe.hasConfig&&!oe.enabled?(r(),h("span",Vce,f(A(u)("Disabled")),1)):(r(),h("span",Tce,"—")):(r(),h("span",Qce,"—"))]),_:1},8,["label"]),n(P,{label:A(u)("Enabled"),width:"140",align:"center"},{default:d(({row:oe})=>[oe.hasConfig?(r(),$(G,{key:0,"model-value":i.value?oe.enabled:!1,loading:!!p.value[oe.country_code],disabled:!i.value,onChange:Z=>T(oe,Z)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",Mce,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},Rce={class:"fct-base-taxes"},Oce={class:"fct-tax-class-tabs"},Hce={class:"fct-tax-class-tabs__list"},Pce={class:"fct-base-taxes__header"},Nce={class:"fct-base-taxes__header-label"},Kce={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},Gce={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},jce={class:"fct-base-taxes__state-fields"},zce={class:"fct-base-taxes__region-name"},qce={class:"fct-base-taxes__state-fields"},Yce={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const s=B("el-skeleton-item"),i=B("el-skeleton");return r(),h("div",null,[o("div",Rce,[o("div",Oce,[o("div",Hce,[(r(),h(O,null,ae(3,c=>o("div",{key:c,class:"fct-tax-class-tabs__tab"},[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-5 h-5"})]),_:1})])]),o("div",Pce,[o("span",Nce,f(A(u)("Regions")),1)]),o("div",Kce,[o("div",Gce,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",jce,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),l[0]||(l[0]=o("div",{class:"fct-base-taxes__field-compound"},null,-1))])]),l[1]||(l[1]=o("div",{class:"fct-base-taxes__divider"},null,-1)),(r(),h(O,null,ae(t,c=>o("div",{key:c,class:"fct-base-taxes__state-row"},[o("div",zce,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",qce,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},Wce={class:"fct-tax-class-tabs"},Xce={class:"fct-tax-class-tabs__list"},Jce=["onClick"],Zce=["title","onClick"],eAe=["disabled"],tAe={class:"fct-tax-class-tabs__search"},Op={__name:"TaxClassTabs",props:{classes:{type:Array,default:()=>[]},activeId:{type:[Number,String],default:null},maxClasses:{type:Number,default:6},creating:{type:Boolean,default:!1},search:{type:String,default:""}},emits:["switch","delete","add","update:search"],setup(e,{emit:t}){const a=e,l=t,s=K(()=>[...a.classes].sort((i,c)=>i.slug==="standard"&&c.slug!=="standard"?-1:i.slug!=="standard"&&c.slug==="standard"?1:0));return(i,c)=>{const p=B("el-dropdown-item"),m=B("el-dropdown-menu"),_=B("el-dropdown"),g=B("el-input");return r(),h("div",Wce,[o("div",Xce,[(r(!0),h(O,null,ae(s.value,y=>(r(),h("button",{key:y.id,class:de(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==y.id}]),onClick:v=>l("switch",y)},[R(f(y.title)+" ",1),y.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:A(u)("Delete tax class"),onClick:Ne(v=>l("delete",y),["stop"])},[n(ee,{name:"Close"})],8,Zce)):k("",!0)],10,Jce))),128)),e.classes.length<e.maxClasses?(r(),$(_,{key:0,trigger:"click",disabled:e.creating,onCommand:c[0]||(c[0]=y=>l("add",y)),"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(m,null,{default:d(()=>[e.classes.find(y=>y.slug==="reduced")?k("",!0):(r(),$(p,{key:0,command:"reduced"},{default:d(()=>[R(f(A(u)("Reduced")),1)]),_:1})),e.classes.find(y=>y.slug==="zero")?k("",!0):(r(),$(p,{key:1,command:"zero"},{default:d(()=>[R(f(A(u)("Zero")),1)]),_:1})),n(p,{command:"custom"},{default:d(()=>[R(f(A(u)("Custom Class...")),1)]),_:1})]),_:1})]),default:d(()=>[o("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[n(ee,{name:"Plus"})],8,eAe)]),_:1},8,["disabled"])):k("",!0)]),o("div",tAe,[n(g,{"model-value":e.search,placeholder:A(u)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":c[1]||(c[1]=y=>l("update:search",y)),onClear:c[2]||(c[2]=y=>l("update:search",""))},{prefix:d(()=>[n(ee,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),Ca(i.$slots,"search-actions")])])}}},aAe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,kd=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||aAe(e),lAe=({classes:e=[],previousIds:t=new Set,createdSlug:a=null})=>{if(a){const l=e.find(s=>s.slug===a);if(l)return l}return e.find(l=>!t.has(l.id))||null},Po=async({payload:e,createdSlug:t=null,currentClasses:a=[],reloadClasses:l})=>{const s=new Set((a||[]).map(p=>p.id)),i=await ce.post("tax/classes",e),c=await l();return{response:i,classes:c,createdClass:lAe({classes:c,previousIds:s,createdSlug:t})}},Hp=async({classId:e,currentActiveId:t=null,reloadClasses:a})=>{const l=await ce.delete("tax/classes/"+e),s=await a();return{response:l,classes:s,nextActiveClass:kd({classes:s,activeId:t})}};function Ws(e){return e==null||e===""?"":String(e)}const sAe={class:"setting-wrap"},nAe={class:"setting-wrap-inner"},oAe={class:"fct-single-tax-rates-country-single-page"},iAe={class:"fct-single-tax-rates-country-single"},rAe={class:"single-page-header flex items-center justify-between"},dAe={key:0,class:"flex items-center gap-2"},uAe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},cAe={class:"mt-3 flex justify-end"},AAe={key:1,class:"fct-base-taxes"},pAe={class:"fct-btn-group mt-4 justify-end sm"},fAe={class:"fct-tax-rates-country-view"},mAe={key:0},hAe={key:1},_Ae={key:0},vAe={key:1},gAe={class:"fct-btn-group sm justify-end"},rc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=V(!1),l=V([]),s=V(""),i=K(()=>!!ze.get("is_tax_enabled")),c=V([]),p=V(null),m=V("standard"),_=V(!1),g=V(null),y=V(6),v=V(!1),C=V(""),b=V({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),w=V({rate:0,name:""}),x=V([]),F=V({}),L=V(""),U=K(()=>{const Y=L.value.trim().toLowerCase();return Y?x.value.filter(se=>se.stateName&&se.stateName.toLowerCase().includes(Y)):x.value}),S=K(()=>t.group==="EU"),M=K(()=>[b.value,...U.value]),I=V([]),T=V(!1),Q=V([]),E=V([]),D=V(!1),H=V(new Set),P=V(0),G=V([]),J=V(!1),oe=V(!1),Z=V(!1),W=V({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:"",tax_rate:0,override_state_tax:!0,class_id:0,id:"",previous_id:""}),pe=K(()=>{const Y=b.value.rate||0;return[{label:u("added to")+` ${Y}% `+u("federal tax"),is_compound:"0",for_order:0},{label:u("instead of")+` ${Y}% `+u("federal tax"),is_compound:"0",for_order:1},{label:u("compounded on top of")+` ${Y}% `+u("federal tax"),is_compound:"1",for_order:0}]}),N=Y=>String(Y.is_compound)==="1"?"1_0":Y.for_order==1?"0_1":"0_0",j=(Y,se)=>{const[ye,Re]=se.split("_");Y.is_compound=ye,Y.for_order=parseInt(Re)},q=Y=>Y&&Y.replace(/\s*\(Standard\)\s*/gi,"").trim(),X=V(!1),ie=V({}),ge=V(!1),fe=V(""),he=V(""),le=V(""),me=V(!1),Ue=V(!1),et=V(!0),be=V(!1),qe=V(!1),gt=V(!1),Ze=K(()=>u("Toggle tax collection for %1$s",s.value||t.country)),Fe=()=>ce.get("tax/classes").then(Y=>{c.value=Y.classes||[],y.value=Y.max_classes||6,g.value=Y.next_builtin||null;const se=kd({classes:c.value,activeId:p.value});return se&&(p.value=se.id,m.value=se.slug),c.value}).catch(Y=>c.value),Ee=(Y="")=>{if(!Y)return b.value.name||"Tax";const se=x.value.find(ye=>ye.state===Y);return se!=null&&se.name?se.name:b.value.name||"Tax"},Pe=Y=>{b.value={...Y.federalRate},w.value={...Y.federalOriginal},x.value=Y.stateRows.map(se=>({...se})),F.value={...Y.stateOriginals}},Me=()=>({federalRate:{...b.value},federalOriginal:{...w.value},stateRows:x.value.map(Y=>({...Y})),stateOriginals:{...F.value}}),ht=()=>{p.value&&(ie.value[p.value]=Me())},At=async Y=>{ht(),p.value=Y.id,m.value=Y.slug,ie.value[Y.id]?(Pe(ie.value[Y.id]),await ve()):await $e()},Mt=Y=>{if(Y==="custom"){C.value="",v.value=!0;return}_.value=!0,Po({payload:{slug:Y},createdSlug:Y,currentClasses:c.value,reloadClasses:Fe}).then(({response:se,createdClass:ye})=>{if(z.success(se.message),ye)return At(ye)}).catch(se=>{var ye;z.error(((ye=se==null?void 0:se.data)==null?void 0:ye.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Ft=()=>{if(!C.value.trim()){z.error(u("Please enter a class name"));return}_.value=!0,Po({payload:{title:C.value.trim()},currentClasses:c.value,reloadClasses:Fe}).then(({response:Y,createdClass:se})=>{if(z.success(Y.message),v.value=!1,se)return At(se)}).catch(Y=>{var se;z.error(((se=Y==null?void 0:Y.data)==null?void 0:se.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},$t=Y=>{const se=p.value===Y.id;il(u("All rates for this class will be deleted. Products using it will default to Standard."),u("Delete")+" "+Y.title+"?",{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Hp({classId:Y.id,currentActiveId:p.value,reloadClasses:Fe}).then(({response:ye,nextActiveClass:Re})=>{if(delete ie.value[Y.id],z.success(ye.message),Re)return se&&(p.value=null),At(Re)}).catch(ye=>{var Re;z.error(((Re=ye==null?void 0:ye.data)==null?void 0:Re.message)||"Failed to delete tax class")})}).catch(()=>{})},ct=()=>ce.get("address-info/get-country-info",{country_code:t.country}).then(Y=>{l.value=Y.states||[],s.value=Y.country_name||t.country}).catch(Y=>{z.error(u("Failed to load country data. Please refresh the page."))}),Ut=()=>S.value?(he.value="",le.value="",Promise.resolve()):(me.value=!0,ce.get("tax/country-tax-id/"+t.country).then(Y=>{var ye;const se=((ye=Y==null?void 0:Y.tax_data)==null?void 0:ye.tax_id)||"";he.value=se,le.value=se}).catch(Y=>{var se;z.error(((se=Y==null?void 0:Y.data)==null?void 0:se.message)||u("Failed to load tax ID"))}).finally(()=>{me.value=!1})),St=({hydrateClassData:Y=!0}={})=>ce.get("tax/rates/country/rates/"+t.country).then(se=>{const ye=se.tax_rates||[],Re=ye.filter(je=>je.for_shipping!==null),tt=p.value?ye.filter(je=>Number(je.class_id)===Number(p.value)):ye;Q.value=tt.filter(je=>!je.city&&!je.postcode).map(je=>({name:je.name,value:je.id,state:je.state||""}));const dt=ra(tt);return gt.value=ye.length>0,Y&&(Pe(dt),ht(),et.value=!!se.tax_enabled,qe.value=!0),{allRates:ye,shippingOverrides:Re,classEntry:dt}}).catch(se=>(z.error(u("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Dt=()=>ce.get("tax/product-overrides/"+t.country).then(Y=>Y.overrides||[]).catch(()=>[]),Et=()=>{G.value.length>0||(J.value=!0,ce.get("products/fetch-term").then(Y=>{const se=Y.taxonomies&&Y.taxonomies["product-categories"]?Y.taxonomies["product-categories"].terms||[]:[];G.value=se.map(ye=>({...ye,value:Ws(ye.value)}))}).catch(()=>{}).finally(()=>{J.value=!1}))};let It=0;const Ht=Y=>{const se=++It;return!Y||Number(Y)===Number(p.value)?(E.value=Q.value.slice(),D.value=!1,Promise.resolve()):(D.value=!0,E.value=[],ce.get("tax/rates/country/rates/"+t.country,{class_id:Y}).then(ye=>{if(se!==It)return;const Re=ye.tax_rates||[];E.value=Re.filter(tt=>!tt.city&&!tt.postcode).map(tt=>({name:tt.name,value:tt.id,state:tt.state||""}))}).catch(()=>{se===It&&(E.value=[],z.error(u("Failed to load tax rates for the selected tax class")))}).finally(()=>{se===It&&(D.value=!1)}))},Bt=(Y,se)=>{var Re,tt;const ye=[];for(const dt of Y){const je=dt.state?((Re=l.value.find(we=>we.value===dt.state))==null?void 0:Re.name)||dt.state:s.value||t.country,ne=Ee(dt.state||""),Ae=c.value.find(we=>Number(we.id)===Number(dt.class_id));ye.push({id:dt.id,type:"shipping",label:ne,tax_label:ne,category_name:"",location:je,city:dt.city||"",postcode:dt.postcode||"",rate:dt.for_shipping,class_id:Number(dt.class_id)||0,class_label:Ae?Ae.title:"",_raw:dt})}for(const dt of se){const je=dt.meta_value||dt,ne=je.state||"",Ae=ne?((tt=l.value.find(Ye=>Ye.value===ne))==null?void 0:tt.name)||ne:s.value||t.country,we=Number(dt.class_id)||0,Be=we?c.value.find(Ye=>Number(Ye.id)===we):null;ye.push({id:dt.id,type:"products",label:je.category_name||"",tax_label:je.tax_label||"",category_name:je.category_name||"",location:Ae,city:je.city||"",postcode:je.postcode||"",rate:je.rate,class_id:we,class_label:Be?Be.title:"",_raw:dt})}I.value=ye},ra=Y=>{const se=we=>(!we.state||we.state==="")&&(!we.city||we.city==="")&&(!we.postcode||we.postcode===""),ye=Y.find(se),Re=Y.filter(we=>we.state&&we.state!==""&&(!we.city||we.city==="")&&(!we.postcode||we.postcode===""));let tt,dt;if(ye){const we=q(ye.name)||"Tax";tt={...ye,name:we},dt={rate:ye.rate,name:we}}else tt={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},dt={rate:0,name:"Tax"};const je={};for(const we of Re)je[we.state]=we;const ne=[],Ae={};for(const we of l.value){const Be=je[we.value];if(Be){const Ye=q(Be.name)||"State Tax";ne.push({id:Be.id,state:we.value,stateName:we.name,rate:Be.rate,name:Ye,is_compound:String(Be.is_compound||"0"),for_order:Be.for_order||0}),Ae[we.value]={rate:Be.rate,name:Ye,is_compound:String(Be.is_compound||"0"),for_order:Be.for_order||0}}else ne.push({id:null,state:we.value,stateName:we.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),Ae[we.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:tt,federalOriginal:dt,stateRows:ne,stateOriginals:Ae}},ve=async()=>{const[{shippingOverrides:Y},se]=await Promise.all([St({hydrateClassData:!1}),Dt()]);Bt(Y,se)},$e=async()=>{a.value=!0;try{const[{shippingOverrides:Y},se]=await Promise.all([St(),Dt()]);Bt(Y,se)}finally{a.value=!1}},ot=async()=>{a.value=!0;try{await Promise.all([Fe(),ct(),Ut()]),await $e()}finally{a.value=!1}},vt=()=>{S.value||Ue.value||me.value||(Ue.value=!0,ce.post("tax/country-tax-id/"+t.country,{tax_id:he.value||""}).then(Y=>{le.value=he.value||"",z.success(Y.message||u("Tax ID has been saved successfully"))}).catch(Y=>{var se;z.error(((se=Y==null?void 0:Y.data)==null?void 0:se.message)||u("Failed to save tax ID"))}).finally(()=>{Ue.value=!1}))},yt=Y=>{if(be.value)return;const se=et.value;et.value=Y,be.value=!0,ce.post("tax/country-status/"+t.country,{enabled:Y?1:0}).then(ye=>{et.value=ye.enabled,z.success(ye.message)}).catch(ye=>{var Re;et.value=se,z.error(((Re=ye==null?void 0:ye.data)==null?void 0:Re.message)||u("Failed to update tax status"))}).finally(()=>{be.value=!1})},Nt=async()=>{try{await il(u("This will overwrite your current rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"})}catch{return}ge.value=!0;try{const se=(await ce.get("tax/configuration/rates")).tax_rates||{};let ye=[];for(const ne in se){const Ae=se[ne];for(const we of Ae.countries||[])if(we.country_code===t.country){ye=we.rates||[];break}if(ye.length)break}if(!ye.length){z.error(u("No preset rates found for this country"));return}const Re=ye.find(ne=>(!ne.state||ne.state==="")&&ne.type==="standard"),tt=ye.filter(ne=>ne.state&&ne.state!==""&&ne.type==="standard"),dt=[];Re&&Re.rate>0&&(b.value.rate=Re.rate,b.value.name=q(Re.name||"")||u("Tax"),dt.push(ft()));const je=[];for(const ne of tt){const Ae=x.value.find(we=>we.state===ne.state);Ae&&(Ae.rate=ne.rate,Ae.name=q(ne.name)||u("State Tax"),Ae.is_compound=ne.compound?"1":"0",je.push(Zt(Ae)))}await Promise.all([...dt,...je]),ht(),await ve(),z.success(u("Tax rates have been reset to defaults"))}catch{z.error(u("Failed to reset tax rates"))}finally{ge.value=!1}},ft=()=>{const Y={country:t.country,state:"",rate:b.value.rate,name:b.value.name||"Tax",is_compound:b.value.is_compound||"0",for_order:b.value.for_order||0,group:t.group,class_id:p.value||""};return(b.value.id?ce.put("tax/country/rate/"+b.value.id,Y):ce.post("tax/country/rate",Y)).then(ye=>{ye.tax_rate&&(b.value.id=ye.tax_rate.id),w.value={rate:b.value.rate,name:b.value.name}})},Zt=Y=>{const se={country:t.country,state:Y.state,rate:Y.rate,name:Y.name,is_compound:Y.is_compound,for_order:Y.for_order,group:t.group,class_id:p.value||""};return(Y.id?ce.put("tax/country/rate/"+Y.id,se):ce.post("tax/country/rate",se)).then(Re=>{Re.tax_rate&&(Y.id=Re.tax_rate.id),F.value[Y.state]={rate:Y.rate,name:Y.name,is_compound:String(Y.is_compound),for_order:Y.for_order}})},pa=async()=>{X.value=!0;try{const Y=[];(String(b.value.rate)!==String(w.value.rate)||b.value.name!==w.value.name)&&Y.push(ft());for(const ye of x.value){const Re=F.value[ye.state];(!Re||String(ye.rate)!==String(Re.rate)||ye.name!==Re.name||String(ye.is_compound)!==String(Re.is_compound)||ye.for_order!=Re.for_order)&&Y.push(Zt(ye))}await Promise.all(Y),ht(),await ve(),z.success(u("Tax rates saved"))}catch{z.error(u("Failed to save rates"))}finally{X.value=!1}},Kt=()=>{H.value=new Set,P.value=0},aa=()=>{const Y=Ee();Z.value=!1,W.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:Y,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},fe.value=Y,E.value=Q.value.slice(),T.value=!0,Et()},Ma=Y=>{if(Z.value=!0,Et(),Y.type==="shipping"){const se=Y._raw.state||"",ye=Ee(se),Re=Number(Y._raw.class_id)||Number(p.value)||0;W.value={type:"shipping",original_type:"shipping",original_id:Y.id,category_id:"",category_name:"",state:se||"__country__",city:Y._raw.city||"",postcode:Y._raw.postcode||"",tax_label:ye,tax_rate:Y.rate,override_state_tax:!0,class_id:Re,id:Y.id,previous_id:Y.id},fe.value=ye,P.value=Re,Ht(Re);const tt=Y._raw.city||"",dt=Y._raw.postcode||"",je=new Set;for(const ne of I.value)ne.type==="shipping"&&(ne._raw.state||"")===se&&(ne._raw.city||"")===tt&&(ne._raw.postcode||"")===dt&&je.add(Number(ne.class_id));H.value=je}else{const se=Y._raw.meta_value||Y._raw,ye=se.state||"",Re=Ee(ye),tt=Y.tax_label||Re;W.value={type:"products",original_type:"products",original_id:Y.id,category_id:Ws(se.category_id),category_name:Y.category_name,state:ye||"__country__",tax_label:tt,tax_rate:Y.rate,override_state_tax:se.override_state_tax==="yes",city:se.city||"",postcode:se.postcode||"",class_id:Y.class_id||0,id:Y.id,previous_id:""},fe.value=Re}T.value=!0},Fl=K(()=>{const Y=[{label:s.value||t.country,value:"__country__"}];for(const se of l.value)Y.push({label:se.name,value:se.value});return Y}),ul=K(()=>{if(!E.value.length)return Fl.value;const Y=new Set(E.value.map(se=>se.state||""));return Fl.value.filter(se=>{const ye=se.value==="__country__"?"":se.value;return Y.has(ye)})}),da=Y=>{const se=Ws(Y),ye=G.value.find(Re=>Re.value===se);ye&&(W.value.category_name=ye.label)},_e=Y=>{il(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const se=Y.type==="shipping"?"tax/rates/country/override/"+Y.id:"tax/product-overrides/"+Y.id;ce.delete(se).then(ye=>{z.success(ye.message),I.value=I.value.filter(Re=>!(Re.id===Y.id&&Re.type===Y.type))}).catch(ye=>{var Re;z.error(((Re=ye==null?void 0:ye.data)==null?void 0:Re.message)||u("Failed to delete override"))})}).catch(()=>{})},qa=async()=>{var se;const Y=W.value.state==="__country__"?"":W.value.state;if(W.value.type==="products"&&!W.value.category_id){z.error(u("Please select a category"));return}if(W.value.type==="shipping"){if(!W.value.class_id){z.error(u("Please select a tax class"));return}if(D.value){z.error(u("Please wait for the province rates to finish loading"));return}const ye=E.value.find(Re=>(Re.state||"")===Y);W.value.id=ye?ye.value:0}oe.value=!0;try{let ye;if(W.value.type==="products"){const Re=W.value.state==="__country__"?"":W.value.state;ye=await ce.post("tax/product-overrides",{id:Z.value&&W.value.original_type==="products"?W.value.original_id:"",source_type:W.value.original_type,source_id:W.value.original_id,country:t.country,state:Re,category_id:W.value.category_id,category_name:W.value.category_name,tax_label:W.value.tax_label,rate:W.value.tax_rate,override_state_tax:W.value.override_state_tax===!0?"yes":"no",city:W.value.city||"",postcode:W.value.postcode||"",class_id:W.value.class_id||0})}else ye=await ce.post("tax/rates/country/override",{id:W.value.id,country:t.country,state:Y,previous_id:Z.value&&W.value.original_type==="shipping"?W.value.previous_id:"",source_type:W.value.original_type,source_id:W.value.original_id,class_id:W.value.class_id||p.value||"",override_tax_rate:W.value.tax_rate,city:W.value.city||"",postcode:W.value.postcode||""});z.success(ye.message),T.value=!1,await ve()}catch(ye){const Re=((se=ye==null?void 0:ye.data)==null?void 0:se.message)||(ye==null?void 0:ye.message)||"Failed to save override";z.error(Re)}finally{oe.value=!1}};return Ce(()=>W.value.type,Y=>{Y==="shipping"&&(W.value.class_id||(W.value.class_id=p.value||0),Ht(W.value.class_id))}),Ce(()=>W.value.class_id,Y=>{W.value.type!=="shipping"||!T.value||Ht(Y).then(()=>{const se=W.value.state==="__country__"?"":W.value.state,ye=E.value.map(Re=>Re.state||"");se!==""&&!ye.includes(se)&&(W.value.state="__country__")})}),Ce(()=>W.value.state,Y=>{if(!T.value||W.value.type!=="products"||Z.value)return;const se=Ee(Y==="__country__"?"":Y);(!W.value.tax_label||W.value.tax_label===fe.value)&&(W.value.tax_label=se),fe.value=se}),Qe(()=>{ot()}),(Y,se)=>{const ye=B("el-breadcrumb-item"),Re=B("el-breadcrumb"),tt=B("el-switch"),dt=B("el-skeleton"),je=B("el-input"),ne=B("el-form-item"),Ae=B("el-form"),we=B("el-button"),Be=B("el-table-column"),Ye=B("el-option"),bt=B("el-select"),wt=B("el-table"),te=B("el-tag"),st=B("el-radio"),Rt=B("el-radio-group"),La=B("el-checkbox"),He=B("el-dialog");return r(),h("div",sAe,[o("div",nAe,[o("div",oAe,[o("div",iAe,[o("div",rAe,[n(Re,{class:"mb-0","separator-icon":A(rl)},{default:d(()=>[e.group==="EU"?(r(),$(ye,{key:0,to:{name:"eu"}},{default:d(()=>[R(f(A(u)("Tax Regions")),1)]),_:1})):(r(),$(ye,{key:1,to:{name:"tax_rates"}},{default:d(()=>[R(f(A(u)("Tax Regions")),1)]),_:1})),n(ye,null,{default:d(()=>[R(f(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),qe.value&>.value?(r(),h("div",dAe,[i.value?(r(),h("span",{key:0,class:de(["text-sm",et.value?"text-success-500":"text-system-mid dark:text-gray-300"])},f(et.value?A(u)("Collecting tax"):A(u)("Disabled")),3)):k("",!0),n(tt,{"model-value":i.value?et.value:!1,loading:be.value,disabled:!i.value,"aria-label":Ze.value,onChange:yt},null,8,["model-value","loading","disabled","aria-label"])])):k("",!0)]),!a.value&&!i.value?(r(),h("div",uAe,[n(Za,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):k("",!0),S.value?k("",!0):(r(),$(xe,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[me.value?(r(),$(dt,{key:0,animated:"",rows:2})):(r(),$(Ae,{key:1,"label-position":"top"},{default:d(()=>[n(ne,{label:A(u)("VAT/GST/Tax Number"),class:"mb-0"},{default:d(()=>[n(je,{modelValue:he.value,"onUpdate:modelValue":se[0]||(se[0]=Ie=>he.value=Ie),placeholder:A(u)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",cAe,[n(we,{type:"primary",size:"small",loading:Ue.value,disabled:me.value||Ue.value||he.value===le.value,onClick:vt},{default:d(()=>[R(f(A(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Base taxes")},null,8,["title"]),n(ke,null,{default:d(()=>[n(Za,{type:"info"},{content:d(()=>[o("span",null,f(A(u)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+f(A(u)("button to add tax classes.")),1)]),_:1}),a.value?(r(),$(Yce,{key:0})):(r(),h("div",AAe,[n(Op,{classes:c.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:L.value,onSwitch:At,onDelete:$t,onAdd:Mt,"onUpdate:search":se[1]||(se[1]=Ie=>L.value=Ie)},null,8,["classes","active-id","max-classes","creating","search"]),n(wt,{data:M.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:d(()=>[n(Be,{label:A(u)("Region")},{default:d(({row:Ie})=>[o("span",{class:de(["fct-base-taxes__region-name",Ie.state?"":"fct-base-taxes__region-name--federal"])},f(Ie.state?Ie.stateName:s.value||e.country),3)]),_:1},8,["label"]),n(Be,{label:A(u)("Rate"),width:"130"},{default:d(({row:Ie})=>[n(je,{modelValue:Ie.rate,"onUpdate:modelValue":re=>Ie.rate=re,size:"small",type:"number",step:"0.01",min:"0"},{suffix:d(()=>se[21]||(se[21]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(Be,{label:A(u)("Tax Label"),width:"200"},{default:d(({row:Ie})=>[n(je,{modelValue:Ie.name,"onUpdate:modelValue":re=>Ie.name=re,size:"small",placeholder:A(u)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),x.value.length>0?(r(),$(Be,{key:0,label:A(u)("Compound"),width:"310"},{default:d(({row:Ie})=>[Ie.state?(r(),$(bt,{key:0,"model-value":N(Ie),size:"small",style:{width:"100%"},onChange:re=>j(Ie,re)},{default:d(()=>[n(Ye,{value:"0_0",label:pe.value[0].label},null,8,["label"]),n(Ye,{value:"0_1",label:pe.value[1].label},null,8,["label"]),n(Ye,{value:"1_0",label:pe.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):k("",!0)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"]),o("div",pAe,[m.value==="standard"?(r(),$(we,{key:0,loading:ge.value,size:"small",onClick:Nt,type:"danger",soft:""},{default:d(()=>[R(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):k("",!0),n(we,{type:"primary",size:"small",loading:X.value,onClick:pa},{default:d(()=>[R(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(we,{size:"small",onClick:aa},{default:d(()=>[R(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[o("div",fAe,[n(wt,{data:I.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n(Be,{label:A(u)("Type"),width:"110"},{default:d(({row:Ie})=>[n(te,{type:Ie.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(f(Ie.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(Be,{label:A(u)("Category")},{default:d(({row:Ie})=>[R(f(Ie.category_name||"—"),1)]),_:1},8,["label"]),n(Be,{label:A(u)("Tax Label")},{default:d(({row:Ie})=>[R(f(Ie.tax_label||"—"),1)]),_:1},8,["label"]),n(Be,{label:A(u)("Location")},{default:d(({row:Ie})=>[R(f(Ie.location),1)]),_:1},8,["label"]),n(Be,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:Ie})=>[Ie.type==="products"?(r(),h("span",mAe,f(Ie.class_label||A(u)("All")),1)):(r(),h("span",hAe,f(Ie.class_label||"—"),1))]),_:1},8,["label"]),n(Be,{label:A(u)("City / Postcode")},{default:d(({row:Ie})=>[Ie.city||Ie.postcode?(r(),h("span",_Ae,f([Ie.city,Ie.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",vAe,"—"))]),_:1},8,["label"]),n(Be,{label:A(u)("Rate"),width:"100"},{default:d(({row:Ie})=>[R(f(Ie.rate)+"% ",1)]),_:1},8,["label"]),n(Be,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:Ie})=>[o("div",gAe,[n(Xe,{tag:"button",size:"small",onClick:re=>Ma(Ie)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(Xe,{tag:"button",size:"small",onClick:re=>_e(Ie),bg:"danger",outline:""},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(He,{modelValue:T.value,"onUpdate:modelValue":se[17]||(se[17]=Ie=>T.value=Ie),title:(Z.value?A(u)("Edit tax override for"):A(u)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:Kt},{footer:d(()=>[n(we,{onClick:se[16]||(se[16]=Ie=>T.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(we,{type:"primary",loading:oe.value,onClick:qa},{default:d(()=>[R(f(Z.value?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(Ae,{"label-position":"top",model:W.value},{default:d(()=>[n(ne,{label:A(u)("Override type")},{default:d(()=>[n(Rt,{modelValue:W.value.type,"onUpdate:modelValue":se[2]||(se[2]=Ie=>W.value.type=Ie)},{default:d(()=>[n(st,{value:"products"},{default:d(()=>[R(f(A(u)("Products")),1)]),_:1}),n(st,{value:"shipping"},{default:d(()=>[R(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),W.value.type==="products"?(r(),h(O,{key:0},[n(ne,{label:A(u)("Category")},{default:d(()=>[n(bt,{modelValue:W.value.category_id,"onUpdate:modelValue":se[3]||(se[3]=Ie=>W.value.category_id=Ie),filterable:"",placeholder:A(u)("Select a category"),loading:J.value,style:{width:"100%"},onChange:da},{default:d(()=>[(r(!0),h(O,null,ae(G.value,Ie=>(r(),$(Ye,{key:Ie.value,label:Ie.label,value:Ie.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(ne,{label:A(u)("Tax Class")},{default:d(()=>[n(bt,{modelValue:W.value.class_id,"onUpdate:modelValue":se[4]||(se[4]=Ie=>W.value.class_id=Ie),style:{width:"100%"}},{default:d(()=>[n(Ye,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(O,null,ae(c.value,Ie=>(r(),$(Ye,{key:Ie.id,value:Number(Ie.id),label:Ie.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(ne,{label:A(u)("Tax label")},{default:d(()=>[n(je,{modelValue:W.value.tax_label,"onUpdate:modelValue":se[5]||(se[5]=Ie=>W.value.tax_label=Ie),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("Location")},{default:d(()=>[n(bt,{modelValue:W.value.state,"onUpdate:modelValue":se[6]||(se[6]=Ie=>W.value.state=Ie),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(Fl.value,Ie=>(r(),$(Ye,{key:Ie.value,label:Ie.label,value:Ie.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("City (optional)")},{default:d(()=>[n(je,{modelValue:W.value.city,"onUpdate:modelValue":se[7]||(se[7]=Ie=>W.value.city=Ie),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(je,{modelValue:W.value.postcode,"onUpdate:modelValue":se[8]||(se[8]=Ie=>W.value.postcode=Ie),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(je,{modelValue:W.value.tax_rate,"onUpdate:modelValue":se[9]||(se[9]=Ie=>W.value.tax_rate=Ie),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),x.value.length>0?(r(),$(ne,{key:0},{default:d(()=>[n(La,{modelValue:W.value.override_state_tax,"onUpdate:modelValue":se[10]||(se[10]=Ie=>W.value.override_state_tax=Ie)},{default:d(()=>[R(f(A(u)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):k("",!0)],64)):(r(),h(O,{key:1},[n(ne,{label:A(u)("Tax Class")},{default:d(()=>[n(bt,{modelValue:W.value.class_id,"onUpdate:modelValue":se[11]||(se[11]=Ie=>W.value.class_id=Ie),style:{width:"100%"},loading:D.value},{default:d(()=>[(r(!0),h(O,null,ae(c.value,Ie=>(r(),$(Ye,{key:Ie.id,value:Number(Ie.id),label:Ie.title,disabled:Z.value&&Number(Ie.id)!==Number(P.value)&&H.value.has(Number(Ie.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(ne,{label:A(u)("Location")},{default:d(()=>[n(bt,{modelValue:W.value.state,"onUpdate:modelValue":se[12]||(se[12]=Ie=>W.value.state=Ie),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(ul.value,Ie=>(r(),$(Ye,{key:Ie.value,label:Ie.label,value:Ie.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("City (optional)")},{default:d(()=>[n(je,{modelValue:W.value.city,"onUpdate:modelValue":se[13]||(se[13]=Ie=>W.value.city=Ie),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(je,{modelValue:W.value.postcode,"onUpdate:modelValue":se[14]||(se[14]=Ie=>W.value.postcode=Ie),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(ne,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(je,{modelValue:W.value.tax_rate,"onUpdate:modelValue":se[15]||(se[15]=Ie=>W.value.tax_rate=Ie),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])]),n(He,{modelValue:v.value,"onUpdate:modelValue":se[20]||(se[20]=Ie=>v.value=Ie),title:A(u)("Create Custom Tax Class"),"append-to-body":!0},{footer:d(()=>[n(we,{onClick:se[19]||(se[19]=Ie=>v.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(we,{type:"primary",loading:_.value,onClick:Ft},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(Ae,{onSubmit:Ne(Ft,["prevent"]),"label-position":"top"},{default:d(()=>[n(ne,{label:A(u)("Class Name")},{default:d(()=>[n(je,{modelValue:C.value,"onUpdate:modelValue":se[18]||(se[18]=Ie=>C.value=Ie),placeholder:A(u)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])])])}}};class yAe extends Fs{getTabs(){return{all:u("All"),filed:u("Filed"),not_filed:u("Not Filed")}}getToggleableColumns(){return[{label:"ID",value:"id"},{label:"Order ID",value:"order_id"},{label:"Zip Code",value:"postcode"},{label:"Tax Rate",value:"rate"},{label:"Filed",value:"filed_at"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Tax Country"),value:"country"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"taxes"}parseResponse(t){return t.taxes}getTableName(){return"taxes_table"}with(){return["tax_rate","order:id,currency"]}scopes(){return["validOrder"]}}function bAe(e){return yAe.init(e)}const wAe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),CAe=e=>{const t=Object.keys(e[0]),l=[t.map(wAe).join(",")];return e.forEach(s=>{const i=t.map(c=>{let p=s[c];return typeof p=="object"&&(p=JSON.stringify(p)),typeof p=="string"&&(p=`"${p.replace(/"/g,'""')}"`),p});l.push(i.join(","))}),l.join(` | |
| 279 | -`)},BAe=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=CAe(e),i=new Blob([s],{type:"text/csv"}),c=document.createElement("a"),p=()=>{window.removeEventListener("focus",p),a()};window.addEventListener("focus",p),c.href=URL.createObjectURL(i),c.download=t,c.click(),URL.revokeObjectURL(c.href),setTimeout(()=>{a()},200)}catch(s){l(s)}}),kAe={class:"table-cell"},xAe={class:"table-cell"},SAe={class:"table-cell"},FAe={class:"table-cell"},$Ae={class:"table-cell"},EAe={class:"table-cell"},UAe={class:"table-cell"},IAe={class:"table-cell"},QAe={class:"table-cell"},DAe={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=B("el-table-column"),c=B("el-skeleton-item"),p=B("el-skeleton"),m=B("el-table");return r(),$(m,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(i,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),$(i,{key:0,width:100,label:A(u)("ID")},{default:d(()=>[o("div",kAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),e.taxTable.isColumnVisible("order_id")?(r(),$(i,{key:1,label:A(u)("Order ID"),width:100},{default:d(()=>[o("div",xAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(i,{label:A(u)("Tax Country"),width:120},{default:d(()=>[o("div",SAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"]),n(i,{label:A(u)("Tax Region"),width:120},{default:d(()=>[o("div",FAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),$(i,{key:2,label:A(u)("Zip Code"),width:120},{default:d(()=>[o("div",$Ae,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(i,{label:A(u)("Tax Name"),width:120},{default:d(()=>[o("div",EAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),$(i,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(()=>[o("div",UAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(i,{label:A(u)("Sale Taxes"),width:120},{default:d(()=>[o("div",IAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),$(i,{key:4,label:A(u)("Filed"),width:120},{default:d(()=>[o("div",QAe,[n(p,{animated:""},{template:d(()=>[n(c,{varient:"p"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},VAe={class:"table-cell"},TAe={class:"table-cell"},MAe={class:"table-cell"},LAe={class:"table-cell"},RAe={class:"table-cell"},OAe={class:"table-cell"},HAe={class:"table-cell"},PAe={class:"table-cell"},NAe={class:"table-cell"},KAe={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=B("el-skeleton-item"),c=B("el-skeleton"),p=B("el-table-column"),m=B("el-table");return r(),$(m,{data:A(a),class:"w-full compact-table responsive full-compact"},{default:d(()=>[n(p,{width:100,label:A(u)("ID")},{default:d(()=>[o("div",VAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),$(p,{key:0,label:A(u)("Title"),width:250},{default:d(()=>[o("div",TAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(p,{label:A(u)("Code"),width:200},{default:d(()=>[o("div",MAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Amount"),width:120},{default:d(()=>[o("div",LAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Usage"),width:150},{default:d(()=>[o("div",RAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),$(p,{key:1,label:A(u)("Stackable"),width:120},{default:d(()=>[o("div",OAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):k("",!0),n(p,{label:A(u)("Status"),width:120},{default:d(()=>[o("div",HAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Expiry Date"),width:120},{default:d(()=>[o("div",PAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),$(p,{key:2,label:A(u)("Actions"),width:100,align:"right"},{default:d(()=>[o("div",NAe,[n(c,{animated:""},{template:d(()=>[n(i,{varient:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])}}},GAe={class:"fct-taxes-page fct-layout-width"},jAe={key:1},zAe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},qAe={class:"fct-tax-filing-wrap"},YAe={class:"fct-tax-filing-summary"},WAe={class:"summary-item"},XAe={class:"summary-label"},JAe={class:"summary-value"},ZAe={class:"summary-item"},epe={class:"summary-label"},tpe={class:"summary-value"},ape={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},lpe={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},spe={class:"dialog-footer"},npe={class:"fct-tax-filing-success-wrap"},ope={class:"fct-tax-filling-success-icon"},ipe={class:"dialog-footer"},rpe={__name:"Taxes",setup(e){const t=Object.fromEntries(Ef.map(S=>[S.value,S.label])),a=S=>t[S]||S;zt().ctx;const l=bAe(),s=V(!1),i=V(!1),c=V(!1),p=V([]),m=K(()=>l.getTableData().map(S=>{var M,I,T,Q,E,D,H,P,G,J,oe;return{id:S.id,order_id:S.order_id,country:a(((M=S.tax_rate)==null?void 0:M.country)??((I=S.meta)==null?void 0:I.tax_country)??""),state:((T=S.tax_rate)==null?void 0:T.formatted_state)??((Q=S.tax_rate)==null?void 0:Q.state)??"",postcode:((E=S.tax_rate)==null?void 0:E.postcode)??"",name:((D=S.tax_rate)==null?void 0:D.name)??((H=S.meta)==null?void 0:H.label)??"",reverse_charge:!!((P=S.meta)!=null&&P.reverse_charge_applied),rate:((G=S.tax_rate)==null?void 0:G.rate)??((J=S.meta)==null?void 0:J.rate_percent)??"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),currency:((oe=S.order)==null?void 0:oe.currency)||"",total_tax:String(parseFloat((S.total_tax/100).toFixed(2))),filed_at:S.filed_at?"Yes":"No"}})),_=()=>{s.value=!0,i.value=!1},g=()=>{s.value=!1,i.value=!0},y=async()=>{try{await BAe(F.value),g()}catch{}},v=()=>{i.value=!1},C=()=>{const S=F.value.map(M=>M.id);ce.post(l.getFetchUrl(),{ids:S}).then(M=>{z.success(M.message),l.fetch()}).catch(M=>{z.error(M)}).finally(()=>{v()})},b=S=>{p.value=S,c.value=S.length>0},w=S=>{F.value=S},x=V(null),F=V([]),L=K(()=>{const S=F.value.reduce((I,T)=>I+parseFloat(T.total_tax||0),0),M=[...new Set(F.value.map(I=>I.order_id))];return{totalTax:Je.formatNumber(Math.round(S*100),!1),totalOrders:M.length,items:F.value}}),U=()=>{Se(()=>{F.value=[...p.value],p.value.forEach(S=>{x.value.toggleRowSelection(S,!0)})})};return(S,M)=>{const I=B("el-button"),T=B("el-tooltip"),Q=B("el-table-column"),E=B("router-link"),D=B("el-tag"),H=B("el-table"),P=B("el-dialog");return r(),h("div",GAe,[n(ll,{title:A(u)("Taxes")},{action:d(()=>[c.value?(r(),$(I,{key:1,type:"primary",onClick:_,disabled:!c.value},{default:d(()=>[R(f(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),$(T,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:A(u)("Please select the taxes you want to file"),placement:"top-start"},{default:d(()=>[n(I,{type:"primary",disabled:!c.value},{default:d(()=>[R(f(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),n($s,{table:A(l),"has-mobile-slot":!1},{default:d(()=>[A(l).isLoading()?(r(),$(DAe,{key:0,taxTable:A(l),"next-page-count":A(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",jAe,[n(H,{class:"w-full",data:m.value,onSelectionChange:b},{empty:d(()=>[n(_t,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(Q,{type:"selection",width:45}),A(l).isColumnVisible("id")?(r(),$(Q,{key:0,label:A(u)("ID"),width:100},{default:d(G=>[o("span",null,"#"+f(A(u)(G.row.id)),1)]),_:1},8,["label"])):k("",!0),A(l).isColumnVisible("order_id")?(r(),$(Q,{key:1,label:A(u)("Order ID"),"min-width":100},{default:d(G=>[o("span",zAe,[n(E,{class:"link",to:{name:"view_order",params:{order_id:G.row.order_id}}},{default:d(()=>[R(" #"+f(G.row.order_id),1)]),_:2},1032,["to"]),G.row.reverse_charge?(r(),$(D,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(f(A(u)("Reverse Charge")),1)]),_:1})):k("",!0)])]),_:1},8,["label"])):k("",!0),n(Q,{label:A(u)("Tax Country"),width:120},{default:d(G=>[o("span",null,f(G.row.country),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Tax Region"),width:120},{default:d(G=>[o("span",null,f(G.row.state),1)]),_:1},8,["label"]),A(l).isColumnVisible("postcode")?(r(),$(Q,{key:2,label:A(u)("Zip Code"),width:120},{default:d(G=>[o("span",null,f(G.row.postcode),1)]),_:1},8,["label"])):k("",!0),n(Q,{label:A(u)("Tax Name"),width:120},{default:d(G=>[o("span",null,f(G.row.name),1)]),_:1},8,["label"]),A(l).isColumnVisible("rate")?(r(),$(Q,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(G=>[o("span",null,f(G.row.rate)+"%",1)]),_:1},8,["label"])):k("",!0),n(Q,{label:A(u)("Sale Taxes"),width:120},{default:d(G=>[o("span",null,f(A(Je).formatForOrder(G.row.total_tax_cents,G.row.currency)),1)]),_:1},8,["label"]),A(l).isColumnVisible("filed_at")?(r(),$(Q,{key:4,label:A(u)("Filed"),width:120},{default:d(G=>[o("span",null,f(G.row.filed_at),1)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(P,{modelValue:s.value,"onUpdate:modelValue":M[1]||(M[1]=G=>s.value=G),title:A(u)("Tax Filing"),onOpen:U,class:"fct-tax-filling-modal"},{footer:d(()=>[o("div",spe,[n(I,{onClick:M[0]||(M[0]=()=>{s.value=!1})},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:y},{default:d(()=>[n(ee,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+f(A(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[o("div",qAe,[o("div",YAe,[o("div",WAe,[o("span",XAe,f(A(u)("Taxable Amount")),1),o("span",JAe,f(L.value.totalTax),1)]),o("div",ZAe,[o("span",epe,f(A(u)("Total Orders")),1),o("span",tpe,f(A(u)(L.value.totalOrders)),1)])]),o("div",ape,[n(H,{ref_key:"selectedTaxesTableRef",ref:x,data:p.value,onSelectionChange:w},{empty:d(()=>[n(_t,{icon:"Empty/ListView",text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(Q,{type:"selection",width:45}),n(Q,{label:A(u)("ID"),width:100},{default:d(G=>[o("span",null,f(G.row.id),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Order ID"),"min-width":100},{default:d(G=>[o("span",lpe,[o("span",null,f(G.row.order_id),1),G.row.reverse_charge?(r(),$(D,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(f(A(u)("Reverse Charge")),1)]),_:1})):k("",!0)])]),_:1},8,["label"]),n(Q,{width:120,label:A(u)("Tax Country")},{default:d(G=>[o("span",null,f(G.row.country),1)]),_:1},8,["label"]),n(Q,{width:120,label:A(u)("Tax Region")},{default:d(G=>[o("span",null,f(G.row.state),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Zip Code"),width:120},{default:d(G=>[o("span",null,f(G.row.postcode),1)]),_:1},8,["label"]),n(Q,{width:120,label:A(u)("Tax Name")},{default:d(G=>[o("span",null,f(G.row.name),1)]),_:1},8,["label"]),n(Q,{label:A(u)("Tax Rate"),width:120},{default:d(G=>[o("span",null,f(G.row.rate)+"%",1)]),_:1},8,["label"]),n(Q,{width:150,label:A(u)("Sale Taxes")},{default:d(G=>[o("span",null,f(A(Je).formatForOrder(G.row.total_tax_cents,G.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(P,{modelValue:i.value,"onUpdate:modelValue":M[2]||(M[2]=G=>i.value=G),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[o("div",ipe,[n(I,{onClick:v},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",onClick:C},{default:d(()=>[R(f(A(u)("Mark as Filed")),1)]),_:1})])]),default:d(()=>[o("div",npe,[o("div",ope,[n(ee,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,f(A(u)("Don't Forget to Save Your Tax File")),1),o("p",null,f(A(u)("You're about to mark this tax report as filed.")),1),o("p",null,[R(f(A(u)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),o("a",{onClick:Ne(y,["prevent"]),class:"cursor-pointer"},f(A(u)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},dpe={class:"fct-card fct-card-border fct-vat-card"},upe={class:"fct-card-body"},cpe={class:"fct-vat-card-header"},Ape={class:"fct-vat-card-title"},ppe={class:"fct-card fct-card-border fct-vat-card mt-5"},fpe={class:"fct-card-body"},mpe={class:"fct-vat-card-header"},hpe={class:"fct-vat-card-title"},_pe={class:"fct-tax-rates-country-view"},vpe={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},gpe={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},ype={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",dpe,[o("div",upe,[o("div",cpe,[o("div",Ape,[o("h3",null,f(A(u)("Collect VAT cross-border")),1)])]),l[0]||(l[0]=o("div",{class:"fct-vat-card-body"},[o("div",{class:"fct-sk w-[200px] h-3 rounded-xs"}),o("div",{class:"fct-sk w-full h-3 rounded-xs mt-3"})],-1))])]),o("div",ppe,[o("div",fpe,[o("div",mpe,[o("div",hpe,[o("h3",null,f(A(u)("Tax overrides")),1)])]),o("div",_pe,[o("div",vpe,[o("div",gpe,[(r(),h(O,null,ae(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(O,null,ae(t,s=>o("div",{key:"override-row-"+s,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},l[1]||(l[1]=[xn('<div class="fct-sk w-16 h-6 rounded-full"></div><div class="fct-sk w-28 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-12 h-3.5 rounded-xs"></div><div class="fct-sk w-4 h-4 rounded-xs justify-self-end"></div>',6)]))),64))])])])])]))}},bpe={class:"fct-modal-body"},wpe={class:"fct-radio-option-fields"},Cpe={class:"form-note"},Bpe={class:"fct-radio-option-fields"},kpe={class:"fct-radio-option-fields-desc"},xpe={class:"form-note"},Spe={key:0,class:"fct-info-box mt-3"},Fpe={class:"text-xs text-system-mid"},$pe={class:"fct-radio-option-fields"},Epe={class:"fct-radio-option-fields-desc"},Upe={__name:"EUVatCrossBorderModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},currentForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=V({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=V(!1);Ce(()=>a.modelValue,_=>{if(_){const g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",C=a.currentForm||{};s.value={method:C.method||"oss",oss_country:C.oss_country||y,oss_vat:C.oss_vat||v,home_country:C.home_country||y,home_vat:C.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function c(_){const g=a.countries.find(y=>y.value===_);return g?parseFloat(g.default_rate||0):0}function p(){return a.initialRegistrations.some(_=>_.country===s.value.home_country)}function m(){if(!s.value.method){z.error(u("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){z.error(u("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){z.error(u("Select your country of registration"));return}i.value=!0,(s.value.method==="home"&&!p()?ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.home_country,vat:s.value.home_vat,rate:c(s.value.home_country)}):Promise.resolve()).then(()=>ce.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(g=>{z.success(g.message),l("saved",{method:s.value.method,oss_country:s.value.oss_country,oss_vat:s.value.oss_vat,home_country:s.value.home_country,home_country_vat:s.value.home_vat}),l("update:modelValue",!1)}).catch(g=>{var y;z.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{i.value=!1})}return(_,g)=>{const y=B("el-radio"),v=B("el-option"),C=B("el-select"),b=B("el-form-item"),w=B("el-input"),x=B("el-radio-group"),F=B("el-form"),L=B("el-button"),U=B("el-dialog");return r(),$(U,{"model-value":e.modelValue,title:A(u)("Collect across the EU"),width:"760px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":g[9]||(g[9]=S=>l("update:modelValue",S))},{footer:d(()=>[n(L,{onClick:g[8]||(g[8]=S=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(L,{type:"primary",onClick:m,loading:i.value},{default:d(()=>[R(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",bpe,[n(F,{"label-position":"top"},{default:d(()=>[n(x,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=S=>s.value.method=S),class:"fct-cross-border-radios"},{default:d(()=>[o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=S=>s.value.method="oss")},[n(y,{value:"oss"},{default:d(()=>[R(f(A(u)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="oss"},{default:d(()=>[o("div",wpe,[n(b,{label:A(u)("Country of OSS registration")},{default:d(()=>[n(C,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=S=>s.value.oss_country=S),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(O,null,ae(e.countries,S=>(r(),$(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(b,{label:A(u)("VAT number")},{default:d(()=>[n(w,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=S=>s.value.oss_vat=S),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Cpe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:g[5]||(g[5]=S=>s.value.method="home")},[n(y,{value:"home"},{default:d(()=>[R(f(A(u)("Collect using your home country registration")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="home"},{default:d(()=>[o("div",Bpe,[o("p",kpe,f(A(u)("Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year")),1),n(b,{label:A(u)("Country of registration")},{default:d(()=>[n(C,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=S=>s.value.home_country=S),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(O,null,ae(e.countries,S=>(r(),$(v,{key:S.value,label:S.label,value:S.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(b,{label:A(u)("VAT number")},{default:d(()=>[n(w,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=S=>s.value.home_vat=S),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",xpe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?k("",!0):(r(),h("div",Spe,[n(ee,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",Fpe,f(A(u)("You haven't added a home country registration. The information you add here will be used to create one for you.")),1)]))])]),_:1},8,["visible"])],2),o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:g[6]||(g[6]=S=>s.value.method="specific")},[n(y,{value:"specific"},{default:d(()=>[R(f(A(u)("Collect using specific country registrations")),1)]),_:1}),n(_a,{accordion:"",visible:s.value.method==="specific"},{default:d(()=>[o("div",$pe,[o("p",Epe,f(A(u)("Register in each EU country where you are required to collect VAT. Manage your registrations in the country list below.")),1)])]),_:1},8,["visible"])],2)]),_:1},8,["modelValue"])]),_:1})])]),_:1},8,["model-value","title"])}}},Ipe={key:0,class:"fct-country-registrations-list mt-4"},Qpe={class:"fct-home-country-header"},Dpe=["src","alt"],Vpe={class:"fct-vat-country-name"},Tpe={key:0,class:"fct-collecting-badge"},Mpe={class:"fct-home-country-body"},Lpe={class:"fct-vat-home-field"},Rpe={class:"fct-vat-home-field__label"},Ope={class:"fct-reg-rates-section"},Hpe={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},Ppe={class:"fct-reg-rates-row fct-reg-rates-header"},Npe={class:"fct-reg-rates-cell-label"},Kpe={class:"fct-reg-rates-cell-label"},Gpe={key:1,class:"fct-reg-class-name"},jpe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},zpe={class:"fct-reg-rates-cell-input"},qpe={class:"fct-reg-rates-cell-action"},Ype=["title","onClick"],Wpe={key:0,class:"fct-reg-add-class px-5"},Xpe={type:"button",class:"fct-reg-add-class-btn"},Jpe={class:"fct-vat-home-actions"},Zpe={__name:"EUVatHomeCountryRegistration",props:{countries:{type:Array,default:()=>[]},homeCountry:{type:String,default:""},homeVat:{type:String,default:""},taxClasses:{type:Array,default:()=>[]},registrations:{type:Array,default:()=>[]}},emits:["save-home","class-changed"],setup(e,{emit:t}){const a=e,l=t,s=V({country:"",vat:"",rates:{}}),i=V([]),c=V(!1),p=V(""),m=K(()=>a.homeCountry&&a.countries.find(I=>I.value===a.homeCountry)||null),_=K(()=>a.homeCountry&&a.registrations.find(I=>I.country===a.homeCountry)||null),g=K(()=>{const I=_.value;return!I||!I.vat?!1:I.rates&&typeof I.rates=="object"&&Object.keys(I.rates).length?Object.values(I.rates).some(function(T){return T&&parseFloat(T.rate)>0}):parseFloat(I.rate)>0}),y=K(()=>[...a.taxClasses,...i.value]),v=K(()=>y.value.length?y.value:[{slug:"standard",title:u("Standard")}]),C=K(()=>{if(y.value.length>=6)return[];const I=y.value.map(Q=>Q.slug).filter(Boolean),T=[];return I.includes("reduced")||T.push({command:"reduced",label:u("Reduced")}),I.includes("zero")||T.push({command:"zero",label:u("Zero")}),T.push({command:"custom",label:u("Custom Class...")}),T});Ce([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const I=_.value,T={};a.taxClasses.forEach(Q=>{var P;const E=(P=I==null?void 0:I.rates)==null?void 0:P[Q.slug],D=Q.slug==="standard"?(I==null?void 0:I.rate)??"":"",H=Q.slug==="standard"?(I==null?void 0:I.tax_label)??"":"";E&&typeof E=="object"?T[Q.slug]={rate:E.rate??"",label:E.label??""}:T[Q.slug]={rate:E??D,label:H}}),i.value.forEach(Q=>{const E=b(Q);T[E]=s.value.rates[E]||{rate:"",label:""}}),T.standard||(T.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(I==null?void 0:I.vat)||a.homeVat||"",rates:T}},{immediate:!0});function b(I){return I.tempKey||I.slug}function w(I){if(I==="custom"){p.value="",c.value=!0;return}const T=I==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:I,title:T,tempKey:I}),s.value.rates[I]={rate:"",label:""}}function x(){if(!p.value.trim())return;const I=p.value.trim(),T="_new_"+i.value.length;i.value.push({slug:null,title:I,tempKey:T,isNew:!1}),s.value.rates[T]={rate:"",label:""},c.value=!1,p.value=""}function F(){const I="_new_"+i.value.length;i.value.push({slug:null,title:"",tempKey:I,isNew:!0}),s.value.rates[I]={rate:"",label:""}}function L(I){return I.slug?I.title||I.slug:I.title&&I.title.trim()?I.title.trim():u("Custom")}function U(I){const T=I.slug?{slug:I.slug}:{title:L(I)};return ce.post("tax/classes",T).then(Q=>{const E=(Q==null?void 0:Q.class)||{},D=E.slug||I.slug;if(!D)throw new Error(u("Tax class creation returned an invalid response"));return!I.slug&&s.value.rates[I.tempKey]!==void 0&&(s.value.rates[D]=s.value.rates[I.tempKey],delete s.value.rates[I.tempKey]),I.slug=D,I.title=E.title||I.title,E}).catch(Q=>{var D;const E=((D=Q==null?void 0:Q.data)==null?void 0:D.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",E,L(I)))})}function S(I){const T=b(I);if(i.value.some(E=>b(E)===T)){i.value=i.value.filter(E=>b(E)!==T),delete s.value.rates[T];return}il(u('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',I.title),u("Delete Tax Class"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("tax/classes/"+I.id).then(()=>{l("class-changed")}).catch(E=>{var D;z.error(((D=E==null?void 0:E.data)==null?void 0:D.message)||u("Failed to delete tax class"))})}).catch(()=>{})}function M(){const I=i.value.map(U);Promise.all(I).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(T=>{z.error((T==null?void 0:T.message)||u("Failed to create tax class"))})}return(I,T)=>{const Q=B("el-input"),E=B("el-dropdown-item"),D=B("el-dropdown-menu"),H=B("el-dropdown"),P=B("el-button"),G=B("el-form-item"),J=B("el-form"),oe=B("el-dialog");return m.value?(r(),h("div",Ipe,[o("div",Qpe,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:m.value.label,class:"fct-flag-icon"},null,8,Dpe),o("span",Vpe,f(m.value.label),1),g.value?(r(),h("span",Tpe,[T[4]||(T[4]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+f(A(u)("Collecting")),1)])):k("",!0)]),o("div",Mpe,[o("div",Lpe,[o("label",Rpe,f(A(u)("VAT number")),1),n(Q,{modelValue:s.value.vat,"onUpdate:modelValue":T[0]||(T[0]=Z=>s.value.vat=Z),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",Ope,[o("div",Hpe,[o("div",Ppe,[o("div",Npe,f(A(u)("Tax Classes")),1),T[5]||(T[5]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),T[6]||(T[6]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),T[7]||(T[7]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(O,null,ae(v.value,Z=>(r(),h("div",{key:b(Z),class:"fct-reg-rates-row"},[o("div",Kpe,[Z.isNew?(r(),$(Q,{key:0,modelValue:Z.title,"onUpdate:modelValue":W=>Z.title=W,size:"small",placeholder:A(u)("Class name"),class:"fct-reg-class-name-input"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(r(),h("span",Gpe,f(Z.title),1))]),o("div",jpe,[n(Q,{modelValue:s.value.rates[b(Z)].rate,"onUpdate:modelValue":W=>s.value.rates[b(Z)].rate=W,type:"number",step:"0.01",min:"0",size:"small"},{suffix:d(()=>T[8]||(T[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",zpe,[n(Q,{modelValue:s.value.rates[b(Z)].label,"onUpdate:modelValue":W=>s.value.rates[b(Z)].label=W,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",qpe,[Z.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:A(u)("Delete class"),onClick:W=>S(Z)},[n(ee,{name:"Delete"})],8,Ype)):k("",!0)])]))),128))]),C.value.length?(r(),h("div",Wpe,[C.value.length===1&&C.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:F},[n(ee,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add class")),1)])):(r(),$(H,{key:1,trigger:"click",onCommand:w,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(D,null,{default:d(()=>[(r(!0),h(O,null,ae(C.value,Z=>(r(),$(E,{key:Z.command,command:Z.command},{default:d(()=>[R(f(Z.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",Xpe,[n(ee,{name:"Plus",class:"w-3 h-3"}),R(" "+f(A(u)("Add class")),1)])]),_:1}))])):k("",!0)]),o("div",Jpe,[n(P,{type:"primary",size:"small",onClick:M},{default:d(()=>[R(f(A(u)("Save VAT")),1)]),_:1})])]),n(oe,{modelValue:c.value,"onUpdate:modelValue":T[3]||(T[3]=Z=>c.value=Z),title:A(u)("Create Tax Class"),width:"400px","append-to-body":!0},{footer:d(()=>[n(P,{onClick:T[2]||(T[2]=Z=>c.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(P,{type:"primary",onClick:x},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1})]),default:d(()=>[n(J,{onSubmit:Ne(x,["prevent"])},{default:d(()=>[n(G,{label:A(u)("Class Name")},{default:d(()=>[n(Q,{modelValue:p.value,"onUpdate:modelValue":T[1]||(T[1]=Z=>p.value=Z),placeholder:A(u)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])])):k("",!0)}}},efe={class:"fct-modal-body fct-country-reg-modal"},tfe={class:"fct-country-reg-text"},afe={class:"form-note"},lfe={class:"fct-reg-rates-table"},sfe={class:"fct-reg-rates-row fct-reg-rates-header"},nfe={class:"fct-reg-rates-cell-label"},ofe={class:"fct-reg-rates-cell-label"},ife={key:1,class:"fct-reg-class-name"},rfe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},dfe={class:"fct-reg-rates-cell-input"},ufe={key:1,class:"fct-reg-rates-row"},cfe={class:"fct-reg-rates-cell-label"},Afe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},pfe={class:"fct-reg-rates-cell-input"},ffe={key:0,class:"fct-reg-add-class"},mfe={type:"button",class:"fct-reg-add-class-btn"},hfe={__name:"EUVatRegistrationModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({country:"",vat:"",rates:{},isEdit:!1})},registeredCountries:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=V({country:"",vat:"",rates:{},isEdit:!1}),i=V([]),c=V(!1),p=V(!1),m=V(""),_=K(()=>[...a.taxClasses,...i.value]),g=K(()=>{if(_.value.length>=6)return[];const S=_.value.map(I=>I.slug).filter(Boolean),M=[];return S.includes("reduced")||M.push({command:"reduced",label:u("Reduced")}),S.includes("zero")||M.push({command:"zero",label:u("Zero")}),M.push({command:"custom",label:u("Custom Class...")}),M}),y=K(()=>s.value.isEdit?a.countries:a.countries.filter(S=>!a.registeredCountries.includes(S.value)));Ce(()=>a.modelValue,S=>{if(S){const M=a.initialForm||{},I=M.rates?JSON.parse(JSON.stringify(M.rates)):{};a.taxClasses.forEach(T=>{I[T.slug]||(I[T.slug]={rate:"",label:""})}),I.standard||(I.standard={rate:"",label:""}),s.value={country:M.country||"",vat:M.vat||"",rates:I,isEdit:M.isEdit||!1},i.value=[]}});function v(S){return S.tempKey||S.slug}function C(S){const M=a.countries.find(I=>I.value===S);if(M&&M.default_rate){const I=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},I,{rate:M.default_rate})})}}function b(S){if(S==="custom"){m.value="",p.value=!0;return}const M=S==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:S,title:M,tempKey:S}),s.value.rates[S]={rate:"",label:""}}function w(){if(!m.value.trim())return;const S=m.value.trim(),M="_new_"+i.value.length;i.value.push({slug:null,title:S,tempKey:M,isNew:!1}),s.value.rates[M]={rate:"",label:""},p.value=!1,m.value=""}function x(){const S="_new_"+i.value.length;i.value.push({slug:null,title:"",tempKey:S,isNew:!0}),s.value.rates[S]={rate:"",label:""}}function F(S){return S.slug?S.title||S.slug:S.title&&S.title.trim()?S.title.trim():u("Custom")}function L(S){const M=S.slug?{slug:S.slug}:{title:F(S)};return ce.post("tax/classes",M).then(I=>{const T=(I==null?void 0:I.class)||{},Q=T.slug||S.slug;if(!Q)throw new Error(u("Tax class creation returned an invalid response"));return!S.slug&&s.value.rates[S.tempKey]!==void 0&&(s.value.rates[Q]=s.value.rates[S.tempKey],delete s.value.rates[S.tempKey]),S.slug=Q,S.title=T.title||S.title,T}).catch(I=>{var Q;const T=((Q=I==null?void 0:I.data)==null?void 0:Q.message)||u("Failed to create tax class");throw new Error(`${T}: ${F(S)}`)})}function U(){if(!s.value.country){z.error(u("Select a registration country"));return}const S=s.value.rates;if(!Object.values(S).some(T=>parseFloat(T.rate)>0)){z.error(u("At least one tax rate must be greater than 0%"));return}c.value=!0;const I=i.value.map(L);Promise.all(I).then(()=>ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(T=>{z.success(T.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(T=>{var Q;z.error((T==null?void 0:T.message)||((Q=T==null?void 0:T.data)==null?void 0:Q.message)||u("Failed to save VAT registration"))}).finally(()=>{c.value=!1})}return(S,M)=>{const I=B("el-option"),T=B("el-select"),Q=B("el-form-item"),E=B("el-input"),D=B("el-dropdown-item"),H=B("el-dropdown-menu"),P=B("el-dropdown"),G=B("el-form"),J=B("el-button"),oe=B("el-dialog");return r(),h(O,null,[n(oe,{"model-value":e.modelValue,title:s.value.isEdit?A(u)("Edit VAT registration"):A(u)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":M[5]||(M[5]=Z=>l("update:modelValue",Z))},{footer:d(()=>[n(J,{onClick:M[4]||(M[4]=Z=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(J,{type:"primary",onClick:U,loading:c.value},{default:d(()=>[R(f(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",efe,[o("p",tfe,f(A(u)("Make sure you're registered for VAT when collecting in the EU.")),1),n(G,{"label-position":"top"},{default:d(()=>[n(Q,{label:A(u)("Registration country")},{default:d(()=>[n(T,{modelValue:s.value.country,"onUpdate:modelValue":M[0]||(M[0]=Z=>s.value.country=Z),placeholder:A(u)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:C},{default:d(()=>[(r(!0),h(O,null,ae(y.value,Z=>(r(),$(I,{key:Z.value,label:Z.label,value:Z.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(Q,{label:A(u)("VAT number")},{default:d(()=>[n(E,{modelValue:s.value.vat,"onUpdate:modelValue":M[1]||(M[1]=Z=>s.value.vat=Z),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",afe,[o("p",null,f(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",lfe,[o("div",sfe,[o("div",nfe,f(A(u)("Tax Classes")),1),M[9]||(M[9]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),M[10]||(M[10]=o("div",{class:"fct-reg-rates-cell-input"},null,-1))]),_.value.length?(r(!0),h(O,{key:0},ae(_.value,Z=>(r(),h("div",{key:Z.tempKey||Z.slug,class:"fct-reg-rates-row"},[o("div",ofe,[Z.isNew?(r(),$(E,{key:0,modelValue:Z.title,"onUpdate:modelValue":W=>Z.title=W,size:"small",placeholder:A(u)("Class name"),class:"fct-reg-class-name-input"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(r(),h("span",ife,f(Z.title),1))]),o("div",rfe,[n(E,{modelValue:s.value.rates[v(Z)].rate,"onUpdate:modelValue":W=>s.value.rates[v(Z)].rate=W,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:Z.slug==="standard"?"19":"0"},{suffix:d(()=>M[11]||(M[11]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",dfe,[n(E,{modelValue:s.value.rates[v(Z)].label,"onUpdate:modelValue":W=>s.value.rates[v(Z)].label=W,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",ufe,[o("div",cfe,f(A(u)("Standard")),1),o("div",Afe,[n(E,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":M[2]||(M[2]=Z=>s.value.rates.standard.rate=Z),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:d(()=>M[12]||(M[12]=[R("%",-1)])),_:1},8,["modelValue"])]),o("div",pfe,[n(E,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":M[3]||(M[3]=Z=>s.value.rates.standard.label=Z),size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),g.value.length?(r(),h("div",ffe,[g.value.length===1&&g.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:x},[n(ee,{name:"Plus"}),R(" "+f(A(u)("Add class")),1)])):(r(),$(P,{key:1,trigger:"click",onCommand:b},{dropdown:d(()=>[n(H,null,{default:d(()=>[(r(!0),h(O,null,ae(g.value,Z=>(r(),$(D,{key:Z.command,command:Z.command},{default:d(()=>[R(f(Z.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",mfe,[n(ee,{name:"Plus"}),R(" "+f(A(u)("Add class")),1)])]),_:1}))])):k("",!0)]),_:1})])]),_:1},8,["model-value","title"]),n(oe,{modelValue:p.value,"onUpdate:modelValue":M[8]||(M[8]=Z=>p.value=Z),title:A(u)("Create Tax Class"),width:"400px","append-to-body":!0},{footer:d(()=>[n(J,{onClick:M[7]||(M[7]=Z=>p.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(J,{type:"primary",onClick:w},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1})]),default:d(()=>[n(G,{onSubmit:Ne(w,["prevent"])},{default:d(()=>[n(Q,{label:A(u)("Class Name")},{default:d(()=>[n(E,{modelValue:m.value,"onUpdate:modelValue":M[6]||(M[6]=Z=>m.value=Z),placeholder:A(u)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},_fe={class:"fct-oss-rates-section"},vfe=["aria-expanded"],gfe={class:"inline-flex items-center gap-2"},yfe={class:"fct-oss-rates-count"},bfe={class:"fct-oss-rates-table"},wfe={key:1,class:"text-system-mid"},Cfe={class:"fct-btn-group mt-4 justify-end sm"},Bfe={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=V([]),l=V([]),s=V(null),i=V("standard"),c=V(!1),p=V(!1),m=V(!1),_=V(!1),g=V(6),y=V(!1),v=V(!1),C=V(""),b=V(""),w=K(()=>a.value),x=K(()=>{const Q=b.value.trim().toLowerCase();return Q?w.value.filter(E=>E.label&&E.label.toLowerCase().includes(Q)):w.value});function F(){return c.value=!0,ce.get("tax/configuration/settings/eu-vat/oss-rates").then(Q=>{a.value=Q.rates||[],l.value=Q.classes||[];const E=kd({classes:l.value,activeId:s.value});return E&&(s.value=E.id,i.value=E.slug),l.value}).catch(Q=>{var E;z.error((E=Q==null?void 0:Q.data)==null?void 0:E.message)}).finally(()=>{c.value=!1})}function L(Q){s.value=Q.id,i.value=Q.slug}function U(Q){if(Q==="custom"){C.value="",v.value=!0;return}y.value=!0,Po({payload:{slug:Q},createdSlug:Q,currentClasses:l.value,reloadClasses:F}).then(({createdClass:E})=>{E&&L(E)}).catch(E=>{var D;z.error((D=E==null?void 0:E.data)==null?void 0:D.message)}).finally(()=>{y.value=!1})}function S(){if(!C.value.trim()){z.error(u("Please enter a class name"));return}y.value=!0,Po({payload:{title:C.value.trim()},currentClasses:l.value,reloadClasses:F}).then(({createdClass:Q})=>{v.value=!1,Q&&L(Q)}).catch(Q=>{var E;z.error((E=Q==null?void 0:Q.data)==null?void 0:E.message)}).finally(()=>{y.value=!1})}function M(Q){Q.slug!=="standard"&&il(u('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',Q.title),u("Delete Tax Class"),{confirmButtonText:u("Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{c.value=!0,Hp({classId:Q.id,currentActiveId:s.value===Q.id?null:s.value,reloadClasses:F}).then(({nextActiveClass:E})=>{E&&L(E)}).catch(E=>{var D;z.error((D=E==null?void 0:E.data)==null?void 0:D.message),c.value=!1})}).catch(()=>{})}function I(){p.value=!0,ce.post("tax/configuration/settings/eu-vat/oss-rates",{rates:w.value.map(Q=>({country:Q.country,rate:Q.rate,tax_label:Q.tax_label||"",class_rates:Q.class_rates||{}}))}).then(Q=>{z.success(Q.message)}).catch(Q=>{var E;z.error((E=Q==null?void 0:Q.data)==null?void 0:E.message)}).finally(()=>{p.value=!1})}function T(){il(u("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{m.value=!0,ce.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>F()).then(()=>{z.success(u("EU tax rates have been reset to defaults"))}).catch(Q=>{var E;z.error(((E=Q==null?void 0:Q.data)==null?void 0:E.message)||u("Failed to reset rates"))}).finally(()=>{m.value=!1})}).catch(()=>{})}return Qe(F),t({loadRates:F}),(Q,E)=>{const D=B("el-icon"),H=B("el-table-column"),P=B("el-input"),G=B("el-table"),J=B("el-button"),oe=B("el-form-item"),Z=B("el-form"),W=B("el-dialog"),pe=Va("loading");return r(),h(O,null,[o("div",_fe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:E[0]||(E[0]=N=>{_.value=!_.value,_.value||(b.value="")}),onKeydown:[E[1]||(E[1]=$a(Ne(N=>{_.value=!_.value,_.value||(b.value="")},["prevent"]),["enter"])),E[2]||(E[2]=$a(Ne(N=>{_.value=!_.value,_.value||(b.value="")},["prevent"]),["space"]))]},[o("span",gfe,[R(f(A(u)("Destination country rates"))+" ",1),o("span",yfe," ("+f(w.value.length)+") ",1)]),n(D,{class:de(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:d(()=>[n(ee,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,vfe),n(Gl,{name:"fct-collapse"},{default:d(()=>[jt(o("div",bfe,[n(Za,{type:"info"},{content:d(()=>[o("span",null,f(A(u)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+f(A(u)("button to add tax classes.")),1)]),_:1}),n(Op,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:b.value,onSwitch:L,onDelete:M,onAdd:U,"onUpdate:search":E[3]||(E[3]=N=>b.value=N)},null,8,["classes","active-id","max-classes","creating","search"]),jt((r(),$(G,{data:x.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":A(u)("No rates found")},{default:d(()=>[n(H,{label:A(u)("Country"),"min-width":"160"},{default:d(({row:N})=>[R(f(N.label),1)]),_:1},8,["label"]),n(H,{label:A(u)("Tax Label"),"min-width":"150"},{default:d(({row:N})=>[N.class_rates&&N.class_rates[i.value]?(r(),$(P,{key:0,modelValue:N.class_rates[i.value].label,"onUpdate:modelValue":j=>N.class_rates[i.value].label=j,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):k("",!0)]),_:1},8,["label"]),n(H,{label:A(u)("Rate"),"min-width":"120"},{default:d(({row:N})=>[N.class_rates&&N.class_rates[i.value]?(r(),$(P,{key:0,modelValue:N.class_rates[i.value].rate,"onUpdate:modelValue":j=>N.class_rates[i.value].rate=j,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:d(()=>E[7]||(E[7]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",wfe,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[pe,c.value]]),o("div",Cfe,[i.value==="standard"?(r(),$(J,{key:0,size:"small",loading:m.value,onClick:T,type:"danger",soft:""},{default:d(()=>[R(f(A(u)("Reset to default")),1)]),_:1},8,["loading"])):k("",!0),n(J,{type:"primary",size:"small",loading:p.value,onClick:I},{default:d(()=>[R(f(A(u)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Vl,_.value]])]),_:1})]),n(W,{modelValue:v.value,"onUpdate:modelValue":E[6]||(E[6]=N=>v.value=N),title:A(u)("Create Custom Tax Class"),"append-to-body":!0},{footer:d(()=>[n(J,{onClick:E[5]||(E[5]=N=>v.value=!1)},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(J,{type:"primary",loading:y.value,onClick:S},{default:d(()=>[R(f(A(u)("Create")),1)]),_:1},8,["loading"])]),default:d(()=>[n(Z,{onSubmit:Ne(S,["prevent"]),"label-position":"top"},{default:d(()=>[n(oe,{label:A(u)("Class Name")},{default:d(()=>[n(P,{modelValue:C.value,"onUpdate:modelValue":E[4]||(E[4]=N=>C.value=N),placeholder:A(u)("e.g. Super Reduced, Luxury"),maxlength:"30"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"])],64)}}},kfe={class:"fct-vat-card-header"},xfe={class:"fct-vat-card-title"},Sfe={class:"fct-vat-card-body"},Ffe={class:"fct-vat-reg-info"},$fe={class:"fct-vat-country-name"},Efe={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},Ufe={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},Ife={key:2,class:"fct-country-registrations-list mt-4"},Qfe={class:"fct-reg-rows"},Dfe={key:0,class:"fct-vat-registration-row"},Vfe={class:"fct-vat-reg-info"},Tfe=["src","alt"],Mfe={class:"fct-vat-country-name"},Lfe={class:"fct-vat-reg-info"},Rfe=["src","alt"],Ofe={class:"fct-vat-country-name"},Hfe={key:0,class:"fct-vat-number"},Pfe={key:1,class:"fct-vat-missing-badge"},Nfe={class:"fct-vat-reg-actions"},Kfe={key:1,class:"fct-vat-empty-state"},Gfe={class:"text-system-mid text-sm"},jfe={key:0,class:"px-5 py-3"},zfe={key:1,class:"fct-vat-cross-border-empty"},qfe={class:"fct-vat-cross-border-empty-text"},Yfe={class:"fct-vat-cross-border-empty-title"},Wfe={class:"fct-vat-cross-border-empty-desc"},Xfe={__name:"EUVatCrossBorderCard",props:{countries:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]},storeCountry:{type:String,default:""},isTaxEnabled:{type:Boolean,default:!0}},emits:["method-changed"],setup(e,{emit:t}){const a=e,l=t,s=V({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=V(!1),c=V(null),p=V([]),m=V(!1),_=V({country:"",vat:"",rates:{},isEdit:!1}),g=K(()=>a.countries.length||28),y=K(()=>a.initialRegistrations.filter(L).length),v=K(()=>a.storeCountry&&a.countries.find(Z=>Z.value===a.storeCountry)||null),C=K(()=>a.storeCountry?a.initialRegistrations.some(Z=>Z.country===a.storeCountry):!1),b=K(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const Z=a.initialRegistrations.find(W=>W.country===s.value.home_country);return!!Z&&L(Z)}),w=K(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function x(Z){if(!Z||!Array.isArray(a.countries))return Z;const W=a.countries.find(pe=>pe.value===Z);return W?W.label:Z}function F(Z){return Z?Z.rates&&typeof Z.rates=="object"&&Object.keys(Z.rates).length?Object.values(Z.rates).some(W=>W&&parseFloat(W.rate)>0):parseFloat(Z.rate)>0:!1}function L(Z){return!!Z&&!!Z.vat&&F(Z)}function U(Z){return F(Z)&&!Z.vat}function S(){return ce.get("tax/classes").then(Z=>{p.value=Z.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})}function M(Z){const W={};return p.value.forEach(pe=>{W[pe.slug]={rate:pe.slug==="standard"&&Z||"",label:""}}),W}function I(){const Z=v.value&&!C.value?a.storeCountry:"",W=Z&&v.value&&v.value.default_rate||"";_.value={country:Z,vat:"",rates:M(W),isEdit:!1},m.value=!0}function T(Z){const W=Z.rates||{},pe={};p.value.forEach(N=>{const j=W[N.slug];if(j&&typeof j=="object")pe[N.slug]={rate:j.rate||"",label:j.label||""};else{const q=N.slug==="standard"?Z.rate||"":j||"";pe[N.slug]={rate:q,label:N.slug==="standard"&&Z.tax_label||""}}}),_.value={country:Z.country,vat:Z.vat||"",rates:pe,isEdit:!0},m.value=!0}function Q(){S(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function E(Z){ce.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Z.country,vat:Z.vat,rates:Z.rates}).then(W=>{z.success(W.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Z.vat})}).catch(W=>{var pe;z.error(((pe=W==null?void 0:W.data)==null?void 0:pe.message)||u("Failed to save VAT registration"))})}function D(Z){il(u("Are you sure you want to remove this country registration?"),u("Confirm Remove"),{confirmButtonText:u("Yes, Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Z}).then(W=>{z.success(W.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(W=>{var pe;z.error((pe=W==null?void 0:W.data)==null?void 0:pe.message)})}).catch(()=>{})}function H(){return y.value===1?u("Collecting in 1 country"):u("Collecting in %1$s countries",y.value)}const P=K(()=>g.value===1?u("Collecting in 1 region"):u("Collecting in %1$s regions",g.value));function G(Z){s.value={method:Z.method,oss_country:Z.oss_country,oss_vat:Z.oss_vat,home_country:Z.home_country,home_vat:Z.home_country_vat},Z.method==="oss"&&Se(()=>{var W;return(W=c.value)==null?void 0:W.loadRates()}),l("method-changed",{method:Z.method,home_country:Z.home_country,home_vat:Z.home_country_vat})}function J(Z){Z==="edit"?i.value=!0:Z==="stop"&&oe()}function oe(){il(u("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),u("Stop Collecting"),{confirmButtonText:u("Yes, Stop"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(Z=>{z.success(Z.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(Z=>{var W;z.error((W=Z==null?void 0:Z.data)==null?void 0:W.message)})}).catch(()=>{})}return Ce(()=>a.initialForm,Z=>{const W=Z||{};s.value={method:W.method||"",oss_country:W.oss_country||"",oss_vat:W.oss_vat||"",home_country:W.home_country||"",home_vat:W.home_vat||""}},{immediate:!0}),Ce(()=>a.countries,Z=>{Z&&Z.length&&S()},{immediate:!0}),(Z,W)=>{const pe=B("el-tooltip"),N=B("el-dropdown-item"),j=B("el-dropdown-menu"),q=B("el-dropdown"),X=B("el-button");return r(),h(O,null,[n(xe,{class:"fct-vat-card"},{default:d(()=>[n(ke,null,{default:d(()=>[o("div",kfe,[o("div",xfe,[o("h3",null,f(A(u)("Collect VAT cross-border")),1),n(pe,{content:A(u)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),w.value?(r(),$(q,{key:0,trigger:"click",onCommand:J,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(j,null,{default:d(()=>[n(N,{command:"edit"},{default:d(()=>[R(f(A(u)("Edit registration")),1)]),_:1}),n(N,{command:"stop"},{default:d(()=>[R(f(A(u)("Stop collecting")),1)]),_:1})]),_:1})]),default:d(()=>[n(Xe,{border:"none",size:"small",tag:"button"},{default:d(()=>[n(ee,{name:"More"})]),_:1})]),_:1})):k("",!0)]),o("div",Sfe,[w.value?(r(),h(O,{key:0},[o("div",Ffe,[W[4]||(W[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",$fe,f(s.value.method==="oss"?A(u)("EU (OSS)"):s.value.method==="home"?A(u)("EU (micro-business)"):A(u)("EU (specific countries)")),1),e.isTaxEnabled&&(s.value.method!=="specific"||y.value>0)?(r(),h("span",Efe,[W[3]||(W[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(O,{key:0},[R(f(H()),1)],64)):(r(),h(O,{key:1},[R(f(P.value),1)],64))])):k("",!0),e.isTaxEnabled?k("",!0):(r(),h("span",Ufe,f(A(u)("Tax disabled")),1))]),s.value.method==="home"?(r(),$(Za,{key:0,type:b.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:b.value?A(u)("Collecting cross-border EU VAT at your %1$s home country rate. This is for small businesses whose total cross-border EU sales stay below €10,000/year. Once you exceed that threshold you must charge each buyer's local VAT rate instead.",x(s.value.home_country)):A(u)("Your %1$s home country VAT rate will apply to all EU cross-border sales. This is available for small businesses below €10,000/year in cross-border EU sales. Make sure %1$s is registered below with the correct rate.",x(s.value.home_country))},null,8,["type","content"])):k("",!0),s.value.method==="home"?(r(),$(Zpe,{key:1,countries:e.countries,"home-country":s.value.home_country,"home-vat":s.value.home_vat,"tax-classes":p.value,registrations:e.initialRegistrations,onSaveHome:E,onClassChanged:S},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):k("",!0),s.value.method==="specific"?(r(),h("div",Ife,[o("div",Qfe,[v.value&&!C.value?(r(),h("div",Dfe,[o("div",Vfe,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,Tfe),o("span",Mfe,f(v.value.label),1)]),n(X,{size:"small",onClick:I},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:1})])):k("",!0),(r(!0),h(O,null,ae(e.initialRegistrations,ie=>(r(),h("div",{key:ie.country,class:"fct-vat-registration-row"},[o("div",Lfe,[o("img",{src:`https://flagcdn.com/w40/${ie.country.toLowerCase()}.png`,alt:x(ie.country),class:"fct-flag-icon"},null,8,Rfe),o("span",Ofe,f(x(ie.country)),1),ie.vat?(r(),h("span",Hfe,f(ie.vat),1)):U(ie)?(r(),h("span",Pfe,f(A(u)("VAT ID missing")),1)):k("",!0)]),o("div",Nfe,[F(ie)?(r(),$(Xe,{key:0,border:"none",size:"small",tag:"button",title:A(u)("Edit"),onClick:ge=>T(ie)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),$(X,{key:1,size:"small",onClick:ge=>T(ie)},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:2},1032,["onClick"])),n(Xe,{border:"none",size:"small",tag:"button",title:A(u)("Delete"),onClick:ge=>D(ie.country)},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",Kfe,[o("p",Gfe,f(A(u)("No country VAT registrations configured.")),1),n(X,{type:"primary",size:"small",onClick:I},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:1})])):k("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",jfe,[n(X,{type:"primary",link:"",onClick:I},{default:d(()=>[R(" + "+f(A(u)("Collect in another country")),1)]),_:1})])):k("",!0)])):k("",!0),s.value.method==="oss"?(r(),$(Bfe,{key:3,ref_key:"ossRatesRef",ref:c},null,512)):k("",!0)],64)):(r(),h("div",zfe,[W[5]||(W[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",qfe,[o("p",Yfe,f(A(u)("Not collecting cross-border VAT")),1),o("p",Wfe,f(A(u)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(X,{size:"small",onClick:W[0]||(W[0]=ie=>i.value=!0),type:"primary"},{default:d(()=>[R(f(A(u)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(Upe,{modelValue:i.value,"onUpdate:modelValue":W[1]||(W[1]=ie=>i.value=ie),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:G},null,8,["modelValue","countries","current-form","initial-registrations"]),n(hfe,{modelValue:m.value,"onUpdate:modelValue":W[2]||(W[2]=ie=>m.value=ie),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(ie=>ie.country),onSaved:Q},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},Jfe={__name:"EUVatTaxOverrideModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},editRow:{type:Object,default:null}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=V({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}),i=V([]),c=V(!1),p=V(!1);function m(){return a.taxClasses&&a.taxClasses.length>0&&Number(a.taxClasses[0].id)||0}function _(){s.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}}function g(w){if(w.type==="shipping")s.value={type:"shipping",original_type:"shipping",original_id:w.id,category_id:"",category_name:"",country:w._raw.country||"",city:w._raw.city||"",postcode:w._raw.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w._raw.class_id)||m(),id:w.id};else{const x=w._raw.meta_value||w._raw;s.value={type:"products",original_type:"products",original_id:w.id,category_id:Ws(x.category_id),category_name:w.category_name,country:x.country||"",city:x.city||"",postcode:x.postcode||"",tax_label:w.tax_label,tax_rate:w.rate,class_id:Number(w.class_id)||0,id:w.id}}}Ce(()=>a.modelValue,w=>{w&&(a.editRow?g(a.editRow):_(),y())}),Ce(()=>s.value.type,w=>{w==="shipping"&&!s.value.class_id&&(s.value.class_id=m())}),Ce(()=>a.taxClasses,w=>{s.value.type==="shipping"&&!s.value.class_id&&w&&w.length>0&&(s.value.class_id=Number(w[0].id)||0)});function y(){i.value.length>0||(c.value=!0,ce.get("products/fetch-term").then(w=>{const x=w.taxonomies&&w.taxonomies["product-categories"]?w.taxonomies["product-categories"].terms||[]:[];i.value=x.map(F=>({...F,value:Ws(F.value)}))}).catch(()=>{z.error(u("Failed to load product categories"))}).finally(()=>{c.value=!1}))}function v(w,x){return ce.get("tax/rates/country/rates/"+w,{class_id:x}).then(F=>{const U=(F&&F.tax_rates?F.tax_rates:[]).find(function(M){return!M.state&&!M.city&&!M.postcode});if(U)return U;const S=a.countries.find(function(M){return M.value===w});return ce.post("tax/country/rate",{country:w,state:"",rate:S&&S.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:x}).then(function(M){return M&&M.tax_rate?M.tax_rate:null})})}function C(w){const x=Ws(w),F=i.value.find(L=>L.value===x);F&&(s.value.category_name=F.label)}function b(){if(s.value.type==="products"&&!s.value.category_id){z.error(u("Please select a category"));return}if(!s.value.country){z.error(u("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){z.error(u("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){z.error(u("Please select a tax class"));return}}if(p.value=!0,s.value.type==="products")ce.post("tax/product-overrides",{id:s.value.original_type==="products"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,country:s.value.country,state:"",city:s.value.city||"",postcode:s.value.postcode||"",category_id:s.value.category_id,category_name:s.value.category_name,tax_label:s.value.tax_label,rate:s.value.tax_rate,override_state_tax:"no",class_id:s.value.class_id||0}).then(w=>{z.success(w.message),l("saved"),l("update:modelValue",!1)}).catch(w=>{z.error(w&&w.data?w.data.message:w&&w.message?w.message:"")}).finally(()=>{p.value=!1});else{const w=s.value.class_id;v(s.value.country,w).then(x=>x?ce.post("tax/rates/country/override",{id:x.id,previous_id:s.value.original_type==="shipping"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,class_id:w,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then(F=>{z.success(F.message),l("saved"),l("update:modelValue",!1)}).catch(F=>{z.error(F&&F.data?F.data.message:F&&F.message?F.message:"")}).finally(()=>{p.value=!1}):(z.error(u("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(x=>{z.error(x&&x.data?x.data.message:x&&x.message?x.message:""),p.value=!1})}}return(w,x)=>{const F=B("el-radio"),L=B("el-radio-group"),U=B("el-form-item"),S=B("el-option"),M=B("el-select"),I=B("el-input"),T=B("el-form"),Q=B("el-button"),E=B("el-dialog");return r(),$(E,{"model-value":e.modelValue,title:e.editRow?A(u)("Edit tax override"):A(u)("Add tax override"),width:"520px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":x[14]||(x[14]=D=>l("update:modelValue",D))},{footer:d(()=>[n(Q,{onClick:x[13]||(x[13]=D=>l("update:modelValue",!1))},{default:d(()=>[R(f(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",loading:p.value,onClick:b},{default:d(()=>[R(f(e.editRow?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(T,{"label-position":"top",model:s.value},{default:d(()=>[n(U,{label:A(u)("Override type")},{default:d(()=>[n(L,{modelValue:s.value.type,"onUpdate:modelValue":x[0]||(x[0]=D=>s.value.type=D)},{default:d(()=>[n(F,{value:"products"},{default:d(()=>[R(f(A(u)("Products")),1)]),_:1}),n(F,{value:"shipping"},{default:d(()=>[R(f(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),h(O,{key:0},[n(U,{label:A(u)("Category")},{default:d(()=>[n(M,{modelValue:s.value.category_id,"onUpdate:modelValue":x[1]||(x[1]=D=>s.value.category_id=D),filterable:"",placeholder:A(u)("Select a category"),loading:c.value,style:{width:"100%"},onChange:C},{default:d(()=>[(r(!0),h(O,null,ae(i.value,D=>(r(),$(S,{key:D.value,label:D.label,value:D.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),$(U,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(M,{modelValue:s.value.class_id,"onUpdate:modelValue":x[2]||(x[2]=D=>s.value.class_id=D),style:{width:"100%"}},{default:d(()=>[n(S,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(O,null,ae(e.taxClasses,D=>(r(),$(S,{key:D.id,value:Number(D.id),label:D.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):k("",!0),n(U,{label:A(u)("Tax label")},{default:d(()=>[n(I,{modelValue:s.value.tax_label,"onUpdate:modelValue":x[3]||(x[3]=D=>s.value.tax_label=D),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("Location")},{default:d(()=>[n(M,{modelValue:s.value.country,"onUpdate:modelValue":x[4]||(x[4]=D=>s.value.country=D),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(e.countries,D=>(r(),$(S,{key:D.value,label:D.label,value:D.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("City (optional)")},{default:d(()=>[n(I,{modelValue:s.value.city,"onUpdate:modelValue":x[5]||(x[5]=D=>s.value.city=D),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(I,{modelValue:s.value.postcode,"onUpdate:modelValue":x[6]||(x[6]=D=>s.value.postcode=D),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(I,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[7]||(x[7]=D=>s.value.tax_rate=D),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(r(),h(O,{key:1},[n(U,{label:A(u)("Location")},{default:d(()=>[n(M,{modelValue:s.value.country,"onUpdate:modelValue":x[8]||(x[8]=D=>s.value.country=D),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(e.countries,D=>(r(),$(S,{key:D.value,label:D.label,value:D.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),$(U,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(M,{modelValue:s.value.class_id,"onUpdate:modelValue":x[9]||(x[9]=D=>s.value.class_id=D),style:{width:"100%"}},{default:d(()=>[(r(!0),h(O,null,ae(e.taxClasses,D=>(r(),$(S,{key:D.id,value:Number(D.id),label:D.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):k("",!0),n(U,{label:A(u)("City (optional)")},{default:d(()=>[n(I,{modelValue:s.value.city,"onUpdate:modelValue":x[10]||(x[10]=D=>s.value.city=D),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(I,{modelValue:s.value.postcode,"onUpdate:modelValue":x[11]||(x[11]=D=>s.value.postcode=D),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(U,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(I,{modelValue:s.value.tax_rate,"onUpdate:modelValue":x[12]||(x[12]=D=>s.value.tax_rate=D),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},Zfe={class:"fct-tax-rates-country-view"},eme={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},tme={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-3 border-b border-gray-200 dark:border-dark-300"},ame={key:0},lme={key:1},sme={class:"fct-btn-group sm justify-end"},nme={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=V([]),l=V(!1),s=V(!1),i=V(null),c=V([]);function p(C){if(!C||!Array.isArray(t.countries))return C;const b=t.countries.find(w=>w.value===C);return b?b.label:C}function m(){ce.get("tax/classes").then(C=>{c.value=C.classes||[]}).catch(()=>{z.error(u("Failed to load tax classes"))})}function _(){l.value=!0,ce.get("tax/configuration/settings/eu-vat/product-overrides").then(C=>{const b=[],w=C.overrides||[];for(const F of w){const L=F.meta_value||F;b.push({id:F.id,type:"products",tax_label:L.tax_label||"",category_name:L.category_name||"",location:p(L.country),city:L.city||"",postcode:L.postcode||"",rate:L.rate,class_id:Number(F.class_id)||0,class_label:F.class_label||"",_raw:F})}const x=C.shipping_overrides||[];for(const F of x)b.push({id:F.id,type:"shipping",tax_label:F.name||"",category_name:"",location:p(F.country),city:F.city||"",postcode:F.postcode||"",rate:F.for_shipping,class_id:Number(F.class_id)||0,class_label:F.class_label||"",_raw:F});a.value=b}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function g(){i.value=null,s.value=!0}function y(C){i.value=C,s.value=!0}function v(C){il(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const b=C.type==="shipping"?"tax/rates/country/override/"+C.id:"tax/product-overrides/"+C.id;ce.delete(b).then(w=>{z.success(w.message),a.value=a.value.filter(x=>!(x.id===C.id&&x.type===C.type))}).catch(w=>{var x;z.error((x=w==null?void 0:w.data)==null?void 0:x.message)})}).catch(()=>{})}return Qe(()=>{m(),_()}),(C,b)=>{const w=B("el-button"),x=B("el-tag"),F=B("el-table-column"),L=B("el-table");return r(),h(O,null,[n(xe,{class:"fct-vat-card"},{default:d(()=>[n(Ve,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(w,{size:"small",onClick:g},{default:d(()=>[R(f(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[o("div",Zfe,[l.value?(r(),h("div",eme,[o("div",tme,[(r(),h(O,null,ae(6,U=>o("div",{key:"loading-header-"+U,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(O,null,ae(3,U=>o("div",{key:"loading-row-"+U,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},b[2]||(b[2]=[o("div",{class:"fct-sk w-16 h-6 rounded-full"},null,-1),o("div",{class:"fct-sk w-28 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-12 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-4 h-4 rounded-xs justify-self-end"},null,-1)]))),64))])):(r(),$(L,{key:1,data:a.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n(F,{label:A(u)("Type"),width:"110"},{default:d(({row:U})=>[n(x,{type:U.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(f(U.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(F,{label:A(u)("Category")},{default:d(({row:U})=>[R(f(U.category_name||"—"),1)]),_:1},8,["label"]),n(F,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:U})=>[R(f(U.class_label||A(u)("All")),1)]),_:1},8,["label"]),n(F,{label:A(u)("Tax Label")},{default:d(({row:U})=>[R(f(U.tax_label||"—"),1)]),_:1},8,["label"]),n(F,{label:A(u)("Location")},{default:d(({row:U})=>[R(f(U.location),1)]),_:1},8,["label"]),n(F,{label:A(u)("City / Postcode")},{default:d(({row:U})=>[U.city||U.postcode?(r(),h("span",ame,f([U.city,U.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",lme,"—"))]),_:1},8,["label"]),n(F,{label:A(u)("Rate"),width:"100"},{default:d(({row:U})=>[R(f(U.rate)+"% ",1)]),_:1},8,["label"]),n(F,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:U})=>[o("div",sme,[n(Xe,{tag:"button",size:"small",onClick:S=>y(U)},{default:d(()=>[n(ee,{name:"Edit"})]),_:2},1032,["onClick"]),n(Xe,{tag:"button",size:"small",onClick:S=>v(U),bg:"danger",outline:""},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(Jfe,{modelValue:s.value,"onUpdate:modelValue":[b[0]||(b[0]=U=>s.value=U),b[1]||(b[1]=U=>!U&&(i.value=null))],countries:e.countries,"tax-classes":c.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},ome={class:"setting-wrap"},ime={class:"setting-wrap-inner"},rme={class:"fct-tax-collection-page"},dme={__name:"EUVatSettings",setup(e){const t=V(!0),a=ze.get("eu_vat_county_options",[]),l=V(""),s=V(""),i=V([]),c=V({}),p=K(()=>!!ze.get("is_tax_enabled"));function m(){return t.value=!0,ce.get("tax/configuration/settings").then(g=>{var v;const y=((v=g.settings)==null?void 0:v.eu_vat_settings)||{};l.value=g.store_country||"",i.value=y.country_registrations||[],c.value=y,s.value=y.method||""}).catch(g=>{var y;z.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){s.value=g||"",m()}return Qe(m),(g,y)=>(r(),h("div",ome,[n(Ea,{heading:A(u)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",ime,[n(Ua),o("div",rme,[t.value?(r(),$(ype,{key:0})):(r(),h(O,{key:1},[n(Xfe,{countries:A(a),"initial-form":c.value,"initial-registrations":i.value,"store-country":l.value,"is-tax-enabled":p.value,onMethodChanged:_},null,8,["countries","initial-form","initial-registrations","store-country","is-tax-enabled"]),n(nme,{countries:A(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class ume extends Fs{getTabs(){return{all:u("All"),active:u("Active"),expired:u("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSortableColumns(){return[{label:u("ID"),value:"id"},{label:u("Title"),value:"title"},{label:u("Code"),value:"code"},{label:u("Amount"),value:"amount"},{label:u("Max Uses"),value:"max_uses"},{label:u("Stackable"),value:"stackable"},{label:u("Status"),value:"status"},{label:u("Expiry Date"),value:"expiry_date"}]}getSearchHint(){return u("Search by id, title, amount, code.")}getFetchUrl(){return"coupons"}parseResponse(t){return t.coupons}getTableName(){return"coupon_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}with(){return["appliedCouponsCount"]}}function Pp(e){return ume.init(e)}const cme={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},Ame={class:"fct-table-mobile-header"},pme={class:"fct-table-mobile-header-left"},fme={class:"fct-table-id-col"},mme={class:"fct-table-status-col"},hme=["onClick"],_me={class:"title"},vme={class:"value"},gme={key:0,class:"fct-table-action-col"},yme={class:"more-btn pr-0"},bme={class:"fct-table-mobile-body"},wme=["onClick"],Cme={key:0,class:"fct-table-coupon-title-col"},Bme={class:"fct-table-coupon-code-col"},kme=["onClick"],xme={class:"fct-table-mobile-footer"},Sme=["onClick"],Fme={class:"fct-table-date-col grid"},$me={class:"title"},Eme={class:"value"},Ume={key:0,class:"fct-table-stackable-col"},Ime={class:"title"},Qme={class:"value"},Dme={class:"fct-table-amount-col"},Vme={class:"title"},Tme={class:"value"},Mme={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){at.extend(li);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const i=at.utc(s).local();return i.isValid()?i.isBefore(at()):!1},l=s=>{let i=u("Are you sure you want to delete this %s coupon. This action is not recoverable",s.coupon.title);s.action==="delete"&&il(i,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+s.coupon.id).then(c=>{z.success(c.message),t.table.fetch()}).catch(c=>{z.error(c)}).finally(()=>{})}).catch(()=>{})};return(s,i)=>{const c=B("router-link"),p=B("el-tooltip"),m=B("el-dropdown-item"),_=B("el-dropdown-menu"),g=B("el-dropdown");return r(),h("div",cme,[(r(!0),h(O,null,ae(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",Ame,[o("div",pme,[o("div",fme,[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:d(()=>[R(" #"+f(y.id),1)]),_:2},1032,["to"])]),o("div",mme,[n(Aa,{status:y.status},{default:d(()=>[R(f(a(y.end_date)?A(u)("Expired"):y.status),1)]),_:2},1032,["status"]),y.status==="scheduled"?(r(),$(p,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(f(A(u)("Available On: %s",A(ks)(y.start_date,!0))),1)]),default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):k("",!0)]),o("div",{class:"fct-table-usage-col",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",_me,f(A(u)("Usage:")),1),o("div",vme,[R(f(y.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),R(" "+f(y.conditions.max_uses>0?y.conditions.max_uses:A(u)("Unlimited")),1)])],8,hme)]),e.table.isColumnVisible("actions")?(r(),h("div",gme,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(_,null,{default:d(()=>[y.id?(r(),$(m,{key:0,class:"item-link"},{default:d(()=>[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(m,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",yme,[n(ee,{name:"More"})])]),_:2},1024)])):k("",!0)]),o("div",bme,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",Cme,f(y.title),1)):k("",!0),o("div",Bme,[o("code",{class:"copyable-content",onClick:C=>{A(Yl).copy(y.code)}},f(y.code),9,kme)])],8,wme)]),o("div",xme,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:C=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",Fme,[o("div",$me,f(A(u)("Expiry Date")),1),o("div",Eme,[isNaN(Date.parse(y.end_date))?(r(),h(O,{key:1},[R("n/a")],64)):(r(),$(Pa,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",Ume,[o("div",Ime,f(A(u)("Stackable")),1),o("div",Qme,f(y.stackable),1)])):k("",!0),o("div",Dme,[o("div",Vme,f(A(u)("Amount")),1),o("div",Tme,f(y.type!=="percentage"?A(ha)(y.amount,!0):y.amount+"%"),1)])],8,Sme)])]))),128))])}}},Lme={},Rme={class:"px-4 py-3"},Ome={class:"grid grid-cols-3 gap-5 mt-5"};function Hme(e,t){const a=B("el-skeleton-item"),l=B("el-skeleton");return r(),$(l,{animated:""},{template:d(()=>[o("div",Rme,[(r(),h(O,null,ae(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",Ome,[(r(),h(O,null,ae(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Pme=lt(Lme,[["render",Hme]]),Nme={class:"fct-all-coupons-page fct-layout-width"},Kme={class:"fct-all-coupons-wrap"},Gme={key:1},jme=["onClick"],zme={class:"capitalize"},qme={class:"more-btn mr-2"},dc={__name:"AllCoupons",setup(e){at.extend(li);const t=Pp(),a=V(!1),l=c=>{let p=u("Are you sure you want to delete this %s coupon. This action is not recoverable",c.coupon.title);c.action==="delete"&&il(p,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{ce.delete("coupons/"+c.coupon.id).then(m=>{z.success(m.message),t.fetch()}).catch(m=>{var _;m.status_code=="422"?z.validationErrors(m):z.error((_=m.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{ce.get("coupons/getSettings").then(c=>{a.value=!!parseInt(c.show_on_checkout)}).catch(c=>{var p;c.status_code=="422"?z.validationErrors(c):z.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})},i=c=>{if(!c||c==="0000-00-00 00:00:00")return!1;const p=at.utc(c).local();return p.isValid()?p.isBefore(at()):!1};return Qe(()=>{s()}),(c,p)=>{const m=B("el-button"),_=B("el-table-column"),g=B("el-tooltip"),y=B("router-link"),v=B("el-dropdown-item"),C=B("el-dropdown-menu"),b=B("el-dropdown"),w=B("el-table");return r(),$(Pt,{permission:"coupons/view"},{default:d(()=>[o("div",Nme,[n(ll,{title:A(u)("Coupons")},{action:d(()=>[n(m,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:d(()=>[R(f(A(u)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",Kme,[n($s,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),$(Pme,{key:0})):k("",!0),A(t).isLoading()?k("",!0):(r(),$(Mme,{key:1,table:A(t)},null,8,["table"]))]),default:d(()=>[A(t).isLoading()?(r(),$(KAe,{key:0,couponTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",Gme,[n(w,{data:A(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[n(_t,{icon:"Empty/Order","has-dark":"",text:A(u)("No coupons available at the moment.")},null,8,["text"])]),default:d(()=>[n(_,{width:100,label:A(u)("ID")},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id}}},{default:d(()=>[R(" #"+f(A(Xt)(x.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("title")?(r(),$(_,{key:0,label:A(u)("Title"),width:220},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[R(f(x.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),n(_,{label:A(u)("Code"),width:200},{default:d(x=>[o("code",{class:"copyable-content",onClick:F=>{A(Yl).copy(x.row.code)}},f(x.row.code),9,jme)]),_:1},8,["label"]),n(_,{label:A(u)("Amount"),width:120},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[R(f(x.row.type!=="percentage"?A(ha)(x.row.amount,!0):x.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Usage"),width:150},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",null,f(A(Xt)(x.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,f(x.row.conditions.max_uses>0?x.row.conditions.max_uses:A(u)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("stackable")?(r(),$(_,{key:1,label:A(u)("Stackable"),width:120},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",zme,f(x.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):k("",!0),n(_,{label:A(u)("Status"),width:120},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[n(Aa,{status:x.row.status},{default:d(()=>[R(f(i(x.row.end_date)?A(u)("Expired"):x.row.status),1)]),_:2},1032,["status"]),x.row.status==="scheduled"?(r(),$(g,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(f(A(u)("Available On: %s",A(ks)(x.row.start_date,!0))),1)]),default:d(()=>[n(ee,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):k("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Expiry Date"),width:120},{default:d(x=>[n(wa,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[o("span",null,[isNaN(Date.parse(x.row.end_date))?(r(),h(O,{key:1},[R("n/a")],64)):(r(),$(Pa,{key:0,"date-time":x.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("actions")?(r(),$(_,{key:2,label:A(u)("Actions"),width:100,align:"right",fixed:"right"},{default:d(x=>[n(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(C,null,{default:d(()=>[x.row.id?(r(),$(v,{key:0,class:"item-link"},{default:d(()=>[n(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:x.row.id,action:"edit"}}},{default:d(()=>[n(ee,{name:"Edit"}),R(" "+f(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):k("",!0),n(v,{command:{action:"delete",coupon:x.row},class:"item-destructive"},{default:d(()=>[n(ee,{name:"Delete"}),R(" "+f(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",qme,[n(ee,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):k("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},Yme={class:"fct-add-edit-coupon-wrapper fct-layout-width"},Wme={class:"single-page-header"},Xme={class:"single-page-body"},Jme={class:"fct-add-edit-coupon"},Zme={class:"fct-add-edit-coupon-main"},ehe={class:"fct-add-edit-coupon-aside"},the={class:"fct-admin-sidebar"},ahe={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=B("el-skeleton-item"),s=B("el-skeleton"),i=B("el-breadcrumb-item"),c=B("el-breadcrumb");return r(),h("div",Yme,[o("div",Wme,[n(c,{"separator-icon":A(rl)},{default:d(()=>[n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),o("div",Xme,[o("div",Jme,[o("div",Zme,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),o("div",ehe,[o("div",the,[n(xe,null,{default:d(()=>[n(Ve,{title:A(u)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};at.extend(li);at.extend(Oc);const lhe={name:"AddOrEditCoupon",components:{CardContainer:xe,CardHeader:Ve,CardBody:ke,LabelHint:ca,ValidationError:la,CopyToClipboard:Fa,DynamicTemplates:nn,SaveBar:an,ProductVariationSelector:Hc,SingleCouponLoader:ahe,Activity:Ic},beforeRouteLeave(e,t,a){var l;(l=this.keyboardShortcuts)!=null&&l.unbind&&this.keyboardShortcuts.unbind("mod+s"),a()},props:{coupon_id:{type:[String,Number],required:!0}},data(){return{changes_made:0,creating:!1,updating:!1,keyboardShortcuts:null,coupon:{type:"fixed",status:"active",stackable:"no",show_on_checkout:"no",title:"",code:"",priority:0,amount:0,start_date:"",end_date:"",notes:"",conditions:{buy_quantity:1,get_quantity:1,excluded_categories:[],included_categories:[],excluded_products:[],included_products:[],min_purchase_amount:"",max_purchase_amount:"",allowed_user_ids:[],allowed_user_roles:[],apply_to_quantity:"no",apply_to_whole_cart:"yes",max_per_customer:"",max_discount_amount:"",max_uses:"",buy_products:[],get_products:[],is_recurring:"no"}},validationErrors:{},minQuantity:1,maxQuantity:100,minPurchaseAmount:0,maxPurchaseAmount:1e4,minDiscountAmount:0,minLimit:0,maxLimit:1e3,categories:[],usageError:!1,isEndDateEnabled:!1,fetchingCoupon:!1,isInitialLoading:!1,showDynamicTemplates:!1,showManageActivity:!1}},computed:{ArrowRight(){return rl},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=ps(),this.fetchTerms(),this.coupon_id?(this.fetchCoupon(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.updateCoupon()}),window.onbeforeunload=()=>{if(this.changes_made>1)return!0}):this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.addCoupon()})},methods:{translate:u,generateRandomCouponCode(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let t="";for(let a=0;a<8;a++)t+=e.charAt(Math.floor(Math.random()*e.length));this.coupon.code=t},onChangeCouponInput(e,t){if(t=parseInt(t),isNaN(t)||t===""){this.coupon[e]="";return}if(e==="priority"&&(t<0||t>100)){this.coupon[e]=0;return}if((e==="buy_quantity"||e==="get_quantity")&&(t<this.minQuantity||t>this.maxQuantity)){this.coupon[e]=this.minQuantity;return}if((e==="min_purchase_amount"||e==="max_discount_amount")&&(t<this.minPurchaseAmount||t>this.maxPurchaseAmount)){this.coupon.conditions[e]=this.minPurchaseAmount;return}if(e==="amount"){if(this.coupon.type==="fixed"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}if(this.coupon.type==="percentage"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}}if((e==="max_uses"||e==="max_per_customer")&&(t<this.minLimit||t>this.maxLimit)){this.coupon[e]=this.minLimit;return}},preventInvalidChars(e,t=!1){let a=["-",".","+"];t&&(a=["-","+"]),a.includes(e.key)&&e.preventDefault()},handleChangesMade(){this.changes_made++},setDefaultStatus(){const e=new Date,t=this.coupon.start_date?new Date(this.coupon.start_date):null,a=this.coupon.end_date?new Date(this.coupon.end_date):null;this.coupon.status!=="disabled"&&(a===null&&(this.isEndDateEnabled=!1),!t&&!a?this.coupon.status="active":t&&e<t?this.coupon.status="scheduled":a&&e>a?this.coupon.status="expired":this.coupon.status="active")},disabledStartDate(e){const t=new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},disabledEndDate(e){const t=this.coupon.start_date?new Date(this.coupon.start_date):new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},formatDate(e){return!e||e==="0000-00-00 00:00:00"?null:at(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=ha(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=ha(this.coupon.conditions.min_purchase_amount,!1):this.coupon.conditions.min_purchase_amount=""),this.coupon.conditions.max_discount_amount!==null&&(this.coupon.conditions.max_discount_amount?this.coupon.conditions.max_discount_amount=ha(this.coupon.conditions.max_discount_amount,!1):this.coupon.conditions.max_discount_amount=""),this.coupon.conditions.max_purchase_amount||(this.coupon.conditions.max_purchase_amount=""),this.coupon.conditions.max_uses||(this.coupon.conditions.max_uses=""),this.coupon.conditions.max_per_customer||(this.coupon.conditions.max_per_customer=""),this.coupon.conditions.min_purchase_amount||(this.coupon.conditions.min_purchase_amount=""))},parseProductIds(e){return Array.isArray(e)?e.map(t=>parseInt(t,10)):[]},reloadPage(){return window.location.reload()},validateAndFormatDate(e){let t=this.formatDate(e);return t!==null&&t!=="Invalid date"?t:null},validateDate(){this.coupon.start_date=this.validateAndFormatDate(this.coupon.start_date),this.coupon.end_date=this.validateAndFormatDate(this.coupon.end_date)},fetchTerms(){ce.get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms}).catch(e=>{var t;e.status_code=="422"?z.validationErrors(e):z.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},fetchCoupon(){this.fetchingCoupon=!0,this.isInitialLoading=!0,ce.get(`coupons/${this.coupon_id}`,{}).then(e=>{var l,s;const t=(l=e==null?void 0:e.coupon)==null?void 0:l.start_date,a=(s=e==null?void 0:e.coupon)==null?void 0:s.end_date;t&&t!=="0000-00-00 00:00:00"&&(e.coupon.start_date=at.utc(t).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=at.utc(a).tz(at.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),e=e.coupon,this.coupon=e,this.coupon.start_date=this.formatDate(this.coupon.start_date),this.coupon.end_date=this.formatDate(this.coupon.end_date),this.coupon.end_date!==null&&(this.isEndDateEnabled=!0),this.coupon.end_date=this.coupon.end_date!==null&&this.coupon.end_date!=="Invalid date"?this.coupon.end_date:null,this.coupon.conditions.excluded_products=this.parseProductIds(e.conditions.excluded_products),this.coupon.conditions.included_products=this.parseProductIds(e.conditions.included_products),this.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?z.validationErrors(errors):z.error((t=errors.data)==null?void 0:t.message)}).finally(()=>{this.fetchingCoupon=!1,this.isInitialLoading=!1,this.changes_made=0})},updateCoupon(){var e,t;this.updating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),ce.put(`coupons/${this.coupon_id}`,{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),z.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(z.validationErrors(a),this.validationErrors=a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.updating=!1,this.changes_made=0})},addCoupon(){var e,t;this.creating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),ce.post("coupons",{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),z.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(z.validationErrors(a),this.validationErrors=a):z.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},she={class:"fct-add-edit-coupon-wrapper fct-layout-width"},nhe={class:"single-page-header"},ohe={class:"single-page-body"},ihe={class:"fct-add-edit-coupon"},rhe={class:"fct-add-edit-coupon-main"},dhe={class:"flex gap-2 items-center justify-between w-full mb-2.5"},uhe={class:"form-note"},che=["innerHTML"],Ahe={key:1},phe=["innerHTML"],fhe=["innerHTML"],mhe=["innerHTML"],hhe={class:"fct-add-edit-coupon-aside"},_he={class:"fct-admin-sidebar"},vhe={class:"fct-admin-sidebar-item"},ghe={key:0,class:"flex items-center gap-1"},yhe={class:"text-sm font-medium text-system-dark dark:text-gray-300"},bhe={key:1},whe={class:"fct-admin-sidebar-item mt-5 hidden"},Che={class:"sidebar-title mb-3"},Bhe={class:"fct-bullet-lists"},khe={class:"fct-admin-sidebar-item mt-5 hidden"},xhe={class:"sidebar-title mb-3"},She={class:"fct-bullet-lists"},Fhe={key:0};function $he(e,t,a,l,s,i){const c=B("SaveBar"),p=B("SingleCouponLoader"),m=B("el-breadcrumb-item"),_=B("el-breadcrumb"),g=B("CardHeader"),y=B("el-input"),v=B("ValidationError"),C=B("el-form-item"),b=B("el-col"),w=B("LabelHint"),x=B("el-row"),F=B("CardBody"),L=B("CardContainer"),U=B("el-option"),S=B("el-select"),M=B("ProductVariationSelector"),I=B("el-checkbox"),T=B("el-radio"),Q=B("el-radio-group"),E=B("el-form"),D=B("CopyToClipboard"),H=B("el-date-picker"),P=B("DynamicTemplates"),G=B("Activity");return r(),h("div",she,[n(c,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=J=>a.coupon_id?i.updateCoupon():i.addCoupon()),onDiscard:i.reloadPage,"show-cmnd-icon":!0,saveButtonText:a.coupon_id?i.translate("Update"):i.translate("Create")},null,8,["isActive","loading","onDiscard","saveButtonText"]),s.fetchingCoupon?(r(),$(p,{key:0})):k("",!0),s.fetchingCoupon?k("",!0):(r(),h(O,{key:1},[o("div",nhe,[n(_,{"separator-icon":i.ArrowRight},{default:d(()=>[n(m,{to:{name:"coupons"}},{default:d(()=>[R(f(i.translate("Coupons")),1)]),_:1}),n(m,null,{default:d(()=>[R(f(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),$(m,{key:0},{default:d(()=>[R(f(s.coupon.title),1)]),_:1})):k("",!0)]),_:1},8,["separator-icon"])]),o("div",ohe,[o("div",ihe,[o("div",rhe,[n(E,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(L,null,{default:d(()=>[n(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:24},{default:d(()=>[n(C,{label:i.translate("Title"),required:""},{default:d(()=>{var J,oe;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Z=>s.coupon.title=Z),placeholder:i.translate("Enter title"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("title")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"title"},null,8,["validation-errors"])):k("",!0)]}),_:1},8,["label"])]),_:1}),n(b,{lg:12},{default:d(()=>[n(C,null,{default:d(()=>{var J,oe;return[o("div",dhe,[n(w,{title:i.translate("Code"),required:""},null,8,["title"]),o("span",{class:"text-system-dark text-xs cursor-pointer hover:underline dark:text-gray-50 underline",onClick:t[2]||(t[2]=(...Z)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...Z))},f(i.translate("Generate Random Code")),1)]),n(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Z=>s.coupon.code=Z),placeholder:i.translate("Eg. COUPON10"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("code")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):k("",!0),o("div",uhe,[o("p",null,f(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(b,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("Coupon Priority"),content:i.translate("Coupons will be calculated based on their priority. The lower the number the higher the priority is.")},null,8,["title","content"])]),default:d(()=>{var J,oe;return[n(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Z=>s.coupon.priority=Z),type:"number",placeholder:i.translate("Enter priority"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=Z=>{i.onChangeCouponInput("priority",Z)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("priority")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(L,null,{default:d(()=>[n(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:8},{default:d(()=>[n(C,{label:i.translate("Type"),required:""},{default:d(()=>{var J;return[n(S,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=oe=>s.coupon.type=oe),placeholder:i.translate("Select coupon type"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:d(()=>[n(U,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),n(U,{label:i.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),s.coupon.type==="fixed"||s.coupon.type==="percentage"?(r(),h(O,{key:0},[n(b,{lg:8},{default:d(()=>[n(C,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:d(()=>{var J;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=oe=>s.coupon.amount=oe),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=oe=>{i.onChangeCouponInput("amount",oe)}),onKeypress:t[9]||(t[9]=oe=>i.preventInvalidChars(oe,!0))},{prefix:d(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,che)):(r(),h("span",Ahe,"%"))]),_:1},8,["modelValue","min","max"]),(J=s.validationErrors)!=null&&J.hasOwnProperty("amount")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):k("",!0)]}),_:1},8,["label"])]),_:1}),s.coupon.type==="percentage"?(r(),$(b,{key:0,lg:8},{default:d(()=>[n(C,{label:i.translate("Max Discount Amount")},{default:d(()=>{var J;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=oe=>s.coupon.conditions.max_discount_amount=oe),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,phe)]),_:1},8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):k("",!0)],64)):k("",!0)]),_:1})]),_:1})]),_:1}),n(L,null,{default:d(()=>[n(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:d(()=>{var J,oe;return[n(y,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=Z=>s.coupon.conditions.min_purchase_amount=Z),type:"number",placeholder:"0.00",class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,fhe)]),_:1},8,["modelValue","class"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("min_purchase_amount")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(b,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("Max Spend Amount"),content:i.translate("Set the maximum spend (subtotal) allowed when using the coupon.")},null,8,["title","content"])]),default:d(()=>{var J,oe;return[n(y,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=Z=>s.coupon.conditions.max_purchase_amount=Z),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,mhe)]),_:1},8,["modelValue","placeholder","class"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("max_purchase_amount")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(b,{md:12},{default:d(()=>[n(C,{label:i.translate("Include Categories")},{default:d(()=>[n(S,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[13]||(t[13]=J=>s.coupon.conditions.included_categories=J),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(O,null,ae(s.categories,J=>(r(),$(U,{key:J.value,label:J.label,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(b,{md:12},{default:d(()=>[n(C,{label:i.translate("Exclude Categories")},{default:d(()=>[n(S,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[14]||(t[14]=J=>s.coupon.conditions.excluded_categories=J),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(O,null,ae(s.categories,J=>(r(),$(U,{key:J.value,label:J.label,value:J.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(b,{md:24},{default:d(()=>[n(C,{label:i.translate("Include Products")},{default:d(()=>[n(M,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[15]||(t[15]=J=>s.coupon.conditions.included_products=J)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(b,{md:24},{default:d(()=>[n(C,{label:i.translate("Excluded Products")},{default:d(()=>[n(M,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[16]||(t[16]=J=>s.coupon.conditions.excluded_products=J)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(b,{md:24},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("By Email Address"),content:i.translate("List of email addresses that can use the coupon. Separate multiple emails with commas. You may also use regular expressions.")},null,8,["title","content"])]),default:d(()=>{var J;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[17]||(t[17]=oe=>s.coupon.conditions.email_restrictions=oe),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(J=s.validationErrors)!=null&&J.hasOwnProperty("email_restrictions")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(b,{md:24},{default:d(()=>{var J;return[n(C,null,{label:d(()=>[n(w,{title:i.translate("Recurring Coupon"),content:i.translate("Mark this coupon as recurring to apply it automatically to every future subscription order. This discount will automatically apply on every renewal. However, the coupon will not be applied if it reduces the payable amount to zero.")},null,8,["title","content"])]),default:d(()=>[n(I,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[18]||(t[18]=oe=>s.coupon.conditions.is_recurring=oe),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(J=s.validationErrors)!=null&&J.hasOwnProperty("is_recurring")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),n(L,null,{default:d(()=>[n(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("Total Limit"),content:i.translate("Total number of times this coupon can be redeemed across the entire store.")},null,8,["title","content"])]),default:d(()=>{var J,oe;return[n(y,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[19]||(t[19]=Z=>s.coupon.conditions.max_uses=Z),type:"number",placeholder:i.translate("Total limit"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[20]||(t[20]=Z=>{i.onChangeCouponInput("max_uses",Z)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(oe=s.validationErrors)!=null&&oe.hasOwnProperty("max_uses")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1}),n(b,{lg:12},{default:d(()=>[n(C,null,{label:d(()=>[n(w,{title:i.translate("Per User Limit"),content:i.translate("Maximum an user can use. 0 means unlimited")},null,8,["title","content"])]),default:d(()=>[n(y,{modelValue:s.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[21]||(t[21]=J=>s.coupon.conditions.max_per_customer=J),type:"number",placeholder:i.translate("Max limit per user"),class:de(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[22]||(t[22]=J=>{i.onChangeCouponInput("max_per_customer",J)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(L,null,{default:d(()=>[n(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:24},{default:d(()=>[n(C,{label:i.translate("Status")},{default:d(()=>[n(Q,{modelValue:s.coupon.status,"onUpdate:modelValue":t[23]||(t[23]=J=>s.coupon.status=J)},{default:d(()=>[n(T,{value:"active",label:i.translate("Active")},null,8,["label"]),n(T,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(T,{disabled:"",value:"expired",label:i.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),n(v,{"validation-errors":s.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),n(b,{lg:24},{default:d(()=>[n(C,{label:i.translate("Internal Notes")},{default:d(()=>{var J;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[24]||(t[24]=oe=>s.coupon.notes=oe),type:"textarea",placeholder:i.translate("Enter note"),class:de((J=s.validationErrors)!=null&&J.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(b,{lg:24},{default:d(()=>{var J;return[n(C,null,{label:d(()=>[n(w,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:d(()=>[n(Q,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[25]||(t[25]=oe=>s.coupon.stackable=oe)},{default:d(()=>[n(T,{value:"yes"},{default:d(()=>[R(f(i.translate("Yes")),1)]),_:1}),n(T,{value:"no"},{default:d(()=>[R(f(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(J=s.validationErrors)!=null&&J.hasOwnProperty("stackable")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):k("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o("div",hhe,[o("div",_he,[n(L,null,{default:d(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:d(()=>[o("div",vhe,[s.coupon.code?(r(),h("div",ghe,[o("span",yhe,f(i.translate("Coupon code"))+": "+f(s.coupon.code),1),n(D,{text:s.coupon.code,showMode:"basic_copy_btn",tooltipText:i.translate("Copy discount code")},null,8,["text","tooltipText"])])):(r(),h("div",bhe,f(i.translate("No discount code yet")),1))]),o("div",whe,[o("h4",Che,f(i.translate("Type & Method")),1),o("ul",Bhe,[o("li",null,[o("span",null,f(i.translate("Amount off Products")),1)]),o("li",null,[o("span",null,f(i.translate("Code")),1)])])]),o("div",khe,[o("h4",xhe,f(i.translate("Details")),1),o("ul",She,[o("li",null,[o("span",null,f(i.translate("For Online Store")),1)]),o("li",null,[o("span",null,f(i.translate("No Min Purchase Requirement")),1)]),o("li",null,[o("span",null,f(i.translate("All Customers")),1)])])])]),_:1})]),_:1}),n(L,null,{default:d(()=>[n(g,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,{class:"pb-1.5"},{default:d(()=>[n(E,{"label-position":"top"},{default:d(()=>[n(x,{gutter:20},{default:d(()=>[n(b,{lg:24},{default:d(()=>[n(C,{label:i.translate("Start Date & Time")},{default:d(()=>[n(H,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[26]||(t[26]=J=>s.coupon.start_date=J),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("Start date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledStartDate},null,8,["modelValue","placeholder","onChange","disabled-date"])]),_:1},8,["label"])]),_:1}),n(b,{lg:24},{default:d(()=>[n(C,null,{default:d(()=>[n(I,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[27]||(t[27]=J=>s.isEndDateEnabled=J),label:i.translate("Set end date & time"),onChange:t[28]||(t[28]=J=>{J||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),$(b,{key:0,lg:24},{default:d(()=>[n(C,{label:i.translate("End Date & Time")},{default:d(()=>[n(H,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[29]||(t[29]=J=>s.coupon.end_date=J),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("End date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledEndDate},null,8,["modelValue","placeholder","onChange","disabled-date"]),s.validationErrors.hasOwnProperty("end_date")?(r(),$(v,{key:0,"validation-errors":s.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):k("",!0)]),_:1},8,["label"])]),_:1})):k("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(r(),h("div",Fhe,[n(P,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:s.coupon},widgetsQuery:{coupon_id:s.coupon.id},onChange:i.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):k("",!0),n(L,null,{default:d(()=>[n(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n(F,null,{default:d(()=>[n(G,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const Ehe=lt(lhe,[["render",$he]]),Uhe={name:"CheckoutFields",components:{Animation:_a,CardHeader:Ve,Card:xe,CardBody:ke,SettingsHeader:Ea,AdminNotice:Ua},data(){return{fields:{},settings:{},saving:!1,fetching:!1}},watch:{"settings.basic_info.last_name.enabled"(e){var t,a;e==="yes"&&((a=(t=this.settings.basic_info)==null?void 0:t.first_name)==null?void 0:a.enabled)==="no"&&(this.settings.basic_info.first_name.enabled="yes")},"settings.business_details":{deep:!0,handler(e){var a,l,s;if(!e||!e.b2b_only_mode)return;((a=e.company_name)==null?void 0:a.enabled)==="yes"||((l=e.vat_number)==null?void 0:l.enabled)==="yes"||((s=e.legal_registration_id)==null?void 0:s.enabled)==="yes"||(e.b2b_only_mode.enabled="no")}}},mounted(){this.getFields()},methods:{translate:u,isFirstNameDisabled(e,t){var a,l;return e==="basic_info"&&t==="first_name"&&((l=(a=this.settings.basic_info)==null?void 0:a.last_name)==null?void 0:l.enabled)==="yes"},isB2BOnlyModeDisabled(e,t){var l,s,i;if(e!=="business_details"||t!=="b2b_only_mode")return!1;const a=this.settings.business_details||{};return((l=a.company_name)==null?void 0:l.enabled)!=="yes"&&((s=a.vat_number)==null?void 0:s.enabled)!=="yes"&&((i=a.legal_registration_id)==null?void 0:i.enabled)!=="yes"},shouldDimLabel(e,t){var a,l,s,i,c,p,m;return((s=(l=(a=this.settings)==null?void 0:a[e])==null?void 0:l[t])==null?void 0:s.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((c=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:c.enabled)==="yes"||((m=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:m.enabled)==="yes":!1},isVisible(e,t){var a,l,s,i;return t==="full_name"?((l=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:l.enabled)!=="yes"&&((i=(s=this.settings.basic_info)==null?void 0:s.last_name)==null?void 0:i.enabled)!=="yes":!0},getFields(){this.fetching=!0,this.$get("checkout-fields/get-fields").then(e=>{this.fields=e.fields||{},this.settings=e.settings||{}}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},saveFields(){this.saving=!0,this.$post("checkout-fields/save-fields",{settings:this.settings}).then(e=>{this.$notify.success(e.message||this.$t("Settings saved successfully!")),this.getFields()}).catch(e=>{this.handleError(e)}).finally(()=>{this.saving=!1})},formatSectionTitle(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}}},Ihe={class:"setting-wrap"},Qhe={class:"setting-wrap-inner"},Dhe={class:"fct-checkout-fields-wrapp"},Vhe={class:"field-heading"},The={class:"fct-checkout-fields"},Mhe={key:0,class:"fct-checkout-field"},Lhe={class:"fct-checkout-field-info"},Rhe={class:"fct-checkout-field-label-wrap"},Ohe={class:"fct-checkout-field-tags"},Hhe={key:0,class:"fct-checkout-field-info-desc"},Phe={key:0,class:"fct-checkout-field-action"},Nhe={key:1,class:"fct-checkout-field-input"},Khe={class:"fct-checkout-field-info"},Ghe={class:"fct-checkout-field-label-wrap"},jhe={key:1,class:"fct-checkout-field-tags"},zhe={key:0,class:"fct-checkout-field-info-desc"},qhe={key:0,class:"fct-checkout-field-action"},Yhe={class:"form-section-save-action"};function Whe(e,t,a,l,s,i){const c=B("SettingsHeader"),p=B("AdminNotice"),m=B("el-skeleton"),_=B("el-switch"),g=B("el-tag"),y=B("el-checkbox"),v=B("el-input"),C=B("CardBody"),b=B("Card"),w=B("el-button");return r(),h("div",Ihe,[n(c,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",Qhe,[n(p),o("div",Dhe,[n(b,null,{default:d(()=>[n(C,null,{default:d(()=>[n(m,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?k("",!0):(r(!0),h(O,{key:0},ae(s.fields,(x,F)=>(r(),h("div",{key:F,class:"fct-checkout-field-section"},[o("h3",Vhe,f(i.formatSectionTitle(F)),1),o("div",The,[x.label?(r(),h("div",Mhe,[o("div",Lhe,[o("div",Rhe,[x.can_alter==="yes"?(r(),$(_,{key:0,modelValue:s.settings[F].enabled,"onUpdate:modelValue":L=>s.settings[F].enabled=L,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):k("",!0),o("span",{class:de(`fct-checkout-field-label ${s.settings[F].enabled==="no"?"opacity-50":""}`)},f(x.label),3),o("div",Ohe,[x.can_alter!=="yes"&&s.settings[F].enabled==="yes"?(r(),$(g,{key:0,size:"small"},{default:d(()=>[R(f(i.translate("System")),1)]),_:1})):k("",!0),s.settings[F].required==="yes"&&s.settings[F].enabled==="yes"?(r(),$(g,{key:1,size:"small"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:1})):k("",!0)])]),x.help_text?(r(),h("div",Hhe,f(x.help_text),1)):k("",!0)]),x.can_alter==="yes"?(r(),h("div",Phe,[n(y,{modelValue:s.settings[F].required,"onUpdate:modelValue":L=>s.settings[F].required=L,"true-label":"yes","false-label":"no",disabled:s.settings[F].enabled!=="yes"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),s.settings[F].hasOwnProperty("text")&&s.settings[F].enabled==="yes"?(r(),h("div",Nhe,[n(v,{type:"textarea",modelValue:s.settings[F].text,"onUpdate:modelValue":L=>s.settings[F].text=L,disabled:s.settings[F].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0)])):(r(!0),h(O,{key:1},ae(x,(L,U)=>(r(),h("div",{key:U,class:"fct-checkout-field"},[o("div",Khe,[o("div",Ghe,[L.can_alter==="yes"?(r(),$(_,{key:0,modelValue:s.settings[F][U].enabled,"onUpdate:modelValue":S=>s.settings[F][U].enabled=S,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled(F,U)||i.isB2BOnlyModeDisabled(F,U)},null,8,["modelValue","onUpdate:modelValue","disabled"])):k("",!0),o("span",{class:de(["fct-checkout-field-label",i.shouldDimLabel(F,U)?"opacity-50":""])},f(L.label),3),i.isVisible(L,U)?(r(),h("div",jhe,[L.can_alter!=="yes"&&s.settings[F][U].enabled==="yes"?(r(),$(g,{key:0,size:"small"},{default:d(()=>[R(f(i.translate("System")),1)]),_:1})):k("",!0),s.settings[F][U].required==="yes"&&s.settings[F][U].enabled==="yes"?(r(),$(g,{key:1,size:"small"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:1})):k("",!0)])):k("",!0)]),L.help_text?(r(),h("div",zhe,f(L.help_text),1)):k("",!0)]),L.can_alter==="yes"&&U!=="first_name"&&U!=="b2b_only_mode"?(r(),h("div",qhe,[n(y,{modelValue:s.settings[F][U].required,"onUpdate:modelValue":S=>s.settings[F][U].required=S,"true-label":"yes","false-label":"no",disabled:s.settings[F][U].enabled!=="yes"},{default:d(()=>[R(f(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",Yhe,[n(w,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:d(()=>[R(f(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const Xhe=lt(Uhe,[["render",Whe]]);var wo={exports:{}};/* @license | |
| 278 | + </div>`}),$}},xAxis:{type:"category",data:_.value,axisLabel:{color:p.value.textColor,fontSize:12},axisLine:{lineStyle:{type:"dashed",color:p.value.splitLineColor}}},yAxis:{type:"value",axisLabel:{color:p.value.textColor,fontSize:12,formatter:S=>ft.formatScaled(S)},splitLine:{show:!0,lineStyle:{color:p.value.splitLineColor,type:"dashed"}}},series:g.value,grid:{left:"10px",right:"10px",top:"20px",bottom:"60px",containLabel:!0}};y.setOption(b,{notMerge:!0,replaceMerge:["series"]})};be([()=>c.value,i,()=>l.value],()=>{xe(w)},{deep:!0});const k=()=>{l.value=Te.isDark(),xe(()=>{w()})};return Ie(()=>{window.addEventListener("onFluentCartThemeChange",k,!1),window.addEventListener("fluentCartCurrencyChange",w),xe(v)}),Bt(()=>{window.removeEventListener("onFluentCartThemeChange",k,!1),window.removeEventListener("fluentCartCurrencyChange",w,!1)}),(b,S)=>(r(),E(Se,null,{default:d(()=>[e.title!==""?(r(),E(Ve,{key:0,border_bottom:!0},{title:d(()=>[o("h3",Iue,m(e.title),1)]),_:1})):x("",!0),n(ke,null,{default:d(()=>[f.value?(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("Currently there is no data!"),class:"fct-report-empty-state"},null,8,["text"])):(r(),h("div",{key:0,class:"fct-chart-wrap h-[350px]",ref_key:"SubscriptionCountTrendChartRef",ref:s},null,512))]),_:1})]),_:1}))}},Que={class:"fct-overview-report-loader-wrap"},Due={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},Vue={class:"fct-card-header-title is-small"},Tue={class:"flex gap-2 mt-1"},Mue={class:"py-6"},Lue={class:"grid grid-cols-1"},Rue={class:"fct-card-header-title is-small"},Oue={class:"py-6"},Pue={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Hue={class:"fct-card-header-title is-small"},Nue={class:"flex gap-2 mt-1"},Kue={class:"py-6"},Gue={class:"grid grid-cols-1"},zue={class:"fct-card-header-title is-small"},jue={class:"py-6"},que={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-2"},Yue={class:"fct-card-header-title is-small"},Wue={class:"py-6"},Jue={__name:"OverviewLoading",setup(e){const t=[{title:u("Gross Summary"),key:"gross_summary"},{title:u("Gross Revenue Quarterly"),key:"net_summary"}],a=[{title:u("Net Revenue"),key:"net_revenue"},{title:u("Net Revenue Quarterly"),key:"net_revenue_quarterly"}],l=[{title:u("Top Country Gross Volume"),key:"top_country_gross"},{title:u("Top Country Net Volume"),key:"top_country_net"}],s=[{title:u("Top Countries Gross Revenue"),key:"top_country_revenue"},{title:u("Top Countries Net Revenue"),key:"top_country_net_revenue"}];return(i,c)=>{const p=C("el-skeleton-item"),f=C("el-skeleton");return r(),h("div",Que,[o("div",Due,[(r(),h(P,null,te(t,(_,g)=>o("div",{key:g},[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",Vue,m(_.title),1),o("div",Tue,[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Mue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Lue,[(r(),h(P,null,te(2,_=>o("div",{key:_},[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-2/3"})]),_:1}),n(Ve,{border_bottom:!0},{title:d(()=>[o("h2",Rue,m(A(u)("Gross Volume Breakdown")),1)]),_:1}),o("div",Oue,[n(f,{animated:"",rows:7})])]),_:1})]),_:1})])),64))]),o("div",Pue,[(r(),h(P,null,te(a,(_,g)=>o("div",{key:g},[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",Hue,m(_.title),1),o("div",Nue,[n(f,{animated:""},{template:d(()=>[n(p,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:2},1024),o("div",Kue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",Gue,[(r(),h(P,null,te(l,(_,g)=>o("div",{key:g},[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h2",zue,m(_.title),1)]),_:2},1024),o("div",jue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))]),o("div",que,[(r(),h(P,null,te(s,(_,g)=>o("div",{key:g},[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",Yue,m(_.title),1)]),_:2},1024),o("div",Wue,[n(f,{animated:"",rows:7})])]),_:2},1024)]),_:2},1024)])),64))])])}}},Xue={class:"overview-summary-report-inline"},Zue={class:"inner-value"},ece={__name:"Summary",props:{title:{type:String},current:{type:[String,Number],required:!0},previous:{type:[String,Number],required:!0},fluctuation:{type:[String,Number],required:!0}},setup(e){return(t,a)=>(r(),h("div",Xue,[o("div",Zue,[n(Rs,{amount:A(ft).formatScaled(e.current),title:A(u)(e.title)},null,8,["amount","title"])]),n(vl,{fluctuation:e.fluctuation,amount:e.previous/100,fluctuationSuffix:A(u)("YoY")},null,8,["fluctuation","amount","fluctuationSuffix"])]))}},Co=nt(ece,[["__scopeId","data-v-b394c9f1"]]),tce={class:"report-overview-page"},ace={class:"flex items-center justify-start gap-1 mb-2 text-xs text-system-mid dark:text-system-light"},lce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},sce={class:"fct-card-header-title is-small"},nce={class:"fct-card-header-title is-small"},oce={class:"grid grid-cols-1"},ice=["innerHTML"],rce=["innerHTML"],dce={class:"report-overview-col-2 grid gap-x-7.5 grid-cols-1 xl:grid-cols-2"},uce={class:"fct-card-header-title is-small"},cce={class:"fct-card-header-title is-small"},Ace={class:"grid gap-4 grid-cols-1"},pce={class:"grid gap-4 grid-cols-1"},fce={class:"report-overview-col-2 grid gap-7.5 grid-cols-1 xl:grid-cols-2"},mce={__name:"Overview",setup(e){const t=T({}),a=T(!0),l=T({gross_revenue_quarterly:{},net_revenue_quarterly:{}}),s=()=>{Ae.get("reports/overview").then(p=>{t.value=p.data,i()}).catch(p=>{}).finally(()=>{a.value=!1})},i=()=>{l.value.gross_revenue_quarterly=c(t.value.gross_revenue_quarterly,"current","prev_year"),l.value.net_revenue_quarterly=c(t.value.net_revenue_quarterly,"current","prev_year")},c=(p,f="current",_="prev")=>{const g=dt.sum(p,"*."+f),y=dt.sum(p,"*."+_),v=y===0?100:(g-y)/y*100;return{value:parseFloat(v.toFixed(2)),prev:y,current:g}};return K(()=>{var p,f;return((p=t.value.gross_summary)==null?void 0:p.yoy_growth)<0?"danger":((f=t.value.gross_summary)==null?void 0:f.yoy_growth)===null?"warning":"success"}),Ie(()=>{s()}),(p,f)=>(r(),h("div",tce,[o("div",ace,[n(Y,{name:"InformationFill",class:"w-4 h-4 text-system-light"}),R(" "+m(A(u)("Last %s Months",A(u)(12))),1)]),a.value?(r(),E(Jue,{key:0})):(r(),h(P,{key:1},[o("div",lce,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h3",sce,m(A(u)("Gross Summary")),1),n(Co,{current:t.value.gross_summary.total,previous:t.value.gross_summary.total_prev,fluctuation:t.value.gross_summary.yoy_growth},null,8,["current","previous","fluctuation"])]),_:1}),n(wo,{data:t.value.gross_revenue,dataKey:"current","date-range":"","is-empty":!t.value.gross_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:""},{title:d(()=>[o("h3",nce,m(A(u)("Gross Revenue Quarterly")),1),n(Co,{current:l.value.gross_revenue_quarterly.current,previous:l.value.gross_revenue_quarterly.prev,fluctuation:l.value.gross_revenue_quarterly.value},null,8,["current","previous","fluctuation"])]),_:1}),n(wo,{data:t.value.gross_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!l.value.gross_revenue_quarterly.current},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",oce,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(ft).generateVolumeSummary(t.value.gross_revenue,!0)},null,8,ice),n(Cc,{title:A(u)("Gross Volume Breakdown"),data:t.value.gross_revenue,dataKey:"current","is-date":"","is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[o("div",{class:"mb-3",innerHTML:A(ft).generateVolumeSummary(t.value.gross_revenue_quarterly)},null,8,rce),n(Cc,{title:A(u)("Gross Revenue Breakdown"),data:t.value.gross_revenue_quarterly,dataKey:"current",prevKey:"prev_year",labelKey:"yy_growth","bar-max-width":80,"is-empty":!t.value.gross_summary.total},null,8,["title","data","is-empty"])]),_:1})]),_:1})]),o("div",dce,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",uce,m(A(u)("Net Revenue")),1),n(Co,{title:A(u)("Net Revenue"),current:t.value.net_summary.total,previous:t.value.net_summary.total_prev,fluctuation:t.value.net_summary.yoy_growth},null,8,["title","current","previous","fluctuation"])]),_:1}),n(wo,{data:t.value.net_revenue,dataKey:"current","date-range":"","is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(Ve,{border_bottom:!0},{title:d(()=>[o("h3",cce,m(A(u)("Net Revenue Quarterly")),1),n(Co,{title:A(u)("Net Revenue Quarterly"),current:l.value.net_revenue_quarterly.current,previous:l.value.net_revenue_quarterly.prev,fluctuation:l.value.net_revenue_quarterly.value},null,8,["title","current","previous","fluctuation"])]),_:1}),n(wo,{data:t.value.net_revenue_quarterly,dataKey:"current","bar-max-width":80,"is-empty":!t.value.net_summary.total},null,8,["data","is-empty"])]),_:1})]),_:1})]),o("div",Ace,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(kc,{data:t.value.top_country_gross,title:A(u)("Top Country Gross Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",pce,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>[n(kc,{data:t.value.top_country_net,title:A(u)("Top Country Net Volume")},null,8,["data","title"])]),_:1})]),_:1})]),o("div",fce,[n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>{var _;return[n(Bc,{data:(_=t.value.top_country_gross)==null?void 0:_.by_countries,title:A(u)("Top Countries Gross Revenue")},null,8,["data","title"])]}),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(ke,null,{default:d(()=>{var _;return[n(Bc,{data:(_=t.value.top_country_net)==null?void 0:_.by_countries,title:A(u)("Top Countries Net Revenue")},null,8,["data","title"])]}),_:1})]),_:1})])],64))]))}},hce={class:"setting-wrap"},_ce={class:"setting-wrap-inner"},vce={key:0,class:"bg-white rounded p-6 dark:bg-dark-700"},gce={class:"grid gap-3 mb-6"},yce={class:"grid gap-3 mb-6"},bce={class:"grid gap-3 mb-6"},wce={class:"grid gap-3"},Cce={class:"payment-method-list fct-content-card-list"},kce=["id"],Bce={class:"flex items-start gap-3"},xce={class:"grid gap-2 flex-1"},Sce={key:0,class:"fct-content-card-list-head stripe"},Fce=["src","alt"],$ce=["src","alt"],Ece={class:"block font-semibold text-system-dark dark:text-gray-50"},Uce={class:"fct-content-card-list-content"},Ice={class:"fct-content-card-list-action flex items-center gap-2"},Qce={key:0},Dce=Object.assign({name:"AddonSettings"},{__name:"AddonSettings",setup(e){const t=ef(),{form:a}=t.data,l=ws(),s=T([]),i=T([]),c=T(!0),p=T(!1),f=T(!0),_=T({}),g=T(!1),y=T({}),v=T(!1),w=T(""),k=T(""),b=T(""),S=K(()=>Object.keys(y.value).length>0),$=()=>{p.value=!0;let V=a.values;Ae.post("settings/modules",{...V}).then(I=>{q.success(u("Settings saved successfully")),setTimeout(()=>{window.location.reload()},300)}).catch(I=>{if(I&&I.message)return q.error(I);_.value=I}).finally(()=>{p.value=!1,f.value=!1,c.value=!1})},D=()=>{c.value=!0,Ae.get("settings/modules",{}).then(V=>{var O,L;a.setSchema(V.fields).setDefaults(V.settings).initForm(),s.value=V.settings,i.value=V.fields,f.value=!1,p.value=!1;const I=((L=(O=V.fields)==null?void 0:O.modules_settings)==null?void 0:L.schema)||[];let M=!1;Array.isArray(I)?M=I.length>0:M=Object.keys(I).length>0,g.value=M}).finally(()=>{c.value=!1})},F=()=>{v.value=!0,Ae.get("settings/modules/plugin-addons",{}).then(V=>{y.value=V.addons||{},b.value&&xe(()=>nn.scrollToHashSection(b.value))}).catch(V=>{q.error(V)}).finally(()=>{v.value=!1})},B=ze.get("app_config.isProActive"),U=(V,I)=>{if(!B){window.open(V.repo_link,"_blank","noopener,noreferrer");return}w.value=I,Ae.post("settings/modules/plugin-addons/install",{plugin_slug:V.plugin_slug,source_type:V.source_type||"wordpress",source_link:V.source_link||"",asset_path:V.asset_path||""}).then(M=>{M.action==="copy"&&M.url?(as.copy(M.url,{successMessage:u("Download link copied to your clipboard")}),window.open(M.url,"_blank","noopener,noreferrer")):M.action==="reload"?(q.success(M.message||u("Addon installed successfully")),setTimeout(()=>{window.location.reload()},500)):q.success(M.message||u("Addon installed successfully"))}).catch(M=>{q.error(M)}).finally(()=>{w.value=""})},Q=(V,I)=>{k.value=I,Ae.post("settings/modules/plugin-addons/activate",{plugin_file:V.plugin_file}).then(M=>{q.success(M.message||u("Addon activated successfully")),setTimeout(()=>{window.location.reload()},500)}).catch(M=>{q.error(M)}).finally(()=>{k.value=""})};return Ie(()=>{const V=window.location.hash||"",I=V.lastIndexOf("#");I>0&&(b.value=V.substring(I+1)),D(),F()}),l.onSave($),(V,I)=>{const M=C("el-skeleton-item"),O=C("el-skeleton"),L=C("el-form"),H=C("el-button"),j=C("el-icon"),W=C("router-link");return r(),h("div",hce,[n(Ua,{heading:A(u)("Addon Settings"),"show-save-button":!1},null,8,["heading"]),o("div",_ce,[n(Ia),f.value?(r(),h("div",vce,[n(O,{loading:f.value,animated:""},{template:d(()=>[o("div",gce,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",yce,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",bce,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})]),o("div",wce,[n(M,{variant:"p",class:"w-[20%]"}),n(M,{variant:"p"})])]),_:1},8,["loading"])])):x("",!0),f.value?x("",!0):(r(),h(P,{key:1},[A(a).isReady?(r(),E(L,{key:0},{default:d(()=>[g.value?(r(),E(Si,{key:0,form:A(a),showSubmitButton:!0,onOnSubmitButtonClick:$,submitButtonText:A(u)("Save Settings"),loading:p.value,onOnChange:I[0]||(I[0]=G=>{}),"validation-errors":_.value},null,8,["form","submitButtonText","loading","validation-errors"])):S.value?x("",!0):(r(),E(Se,{key:1},{default:d(()=>[n(Ve,{title:A(u)("Features & addon"),border_bottom:""},null,8,["title"]),n(ke,null,{default:d(()=>[n(Ct,{class:"fct-addon-empty-state",icon:"Empty/Integrations",text:A(u)("No module settings found.")},null,8,["text"])]),_:1})]),_:1}))]),_:1})):x("",!0),S.value?(r(),E(Se,{key:1,class:"mt-6"},{default:d(()=>[n(Ve,{title:A(u)("Plugin Addons"),border_bottom:""},null,8,["title"]),n(ke,{class:"py-0"},{default:d(()=>[o("div",Cce,[(r(!0),h(P,null,te(y.value,(G,Z)=>(r(),h("div",{key:Z,class:"fct-content-card-list-item",id:G.plugin_slug===b.value?b.value:null},[o("div",Bce,[o("div",xce,[G.logo?(r(),h("div",Sce,[o("img",{class:de({"dark:hidden":G.dark_logo}),src:G.logo,alt:G.title},null,10,Fce),G.dark_logo?(r(),h("img",{key:0,src:G.dark_logo,alt:G.title,class:"hidden dark:block"},null,8,$ce)):x("",!0),o("span",Ece,m(G.title),1),G.is_active?(r(),E(fa,{key:1,status:"active",text:A(u)("Active")},null,8,["text"])):x("",!0)])):x("",!0),o("div",Uce,[o("p",null,m(G.description),1)])]),o("div",Ice,[G.upcoming?(r(),h("div",Qce,m(A(u)("Coming Soon")),1)):(r(),h(P,{key:1},[G.is_installed?G.is_installed&&!G.is_active&&(A(B)||G.source_type!=="github")?(r(),E(H,{key:1,type:"success",size:"small",loading:k.value===Z,disabled:k.value===Z,onClick:ne=>Q(G,Z)},{default:d(()=>[R(m(A(u)("Activate")),1)]),_:2},1032,["loading","disabled","onClick"])):x("",!0):(r(),E(H,{key:0,type:"primary",size:"small",loading:w.value===Z,disabled:w.value===Z,onClick:ne=>U(G,Z)},{default:d(()=>[R(m(A(B)?A(u)("Install & Activate"):A(u)("Download")),1)]),_:2},1032,["loading","disabled","onClick"])),G.is_active&&Z==="fluent-pdf"?(r(),E(W,{key:2,to:{path:"/settings/pdf-template"}},{default:d(()=>[n(j,{class:"text-gray-500 hover:text-primary cursor-pointer",size:18},{default:d(()=>[n(A(Jc))]),_:1})]),_:1})):x("",!0)],64))])])],8,kce))),128))])]),_:1})]),_:1})):x("",!0)],64))])])}}}),Vce=nt(Dce,[["__scopeId","data-v-a315b5d5"]]),Tce={class:"form-note"},Mce={class:"form-note"},Lce={class:"form-note"},Rce={class:"form-note"},Oce={class:"el-form-item__label"},Pce={class:"h-[297px] w-full relative"},Hce={class:"mt-2 mb-2"},Nce={class:"form-note"},Kce={class:"fct-powered-by-email-footer-checkbox mb-4 pb-4 border-[1px] border-l-0 border-t-0 border-r-0 border-solid border-gray-outline dark:border-dark-400"},Gce={class:"setting-html-wrapper"},zce={class:"setting-label"},jce={class:"form-note"},qce={class:"setting-fields-inner w-full"},Yce={__name:"MailingSettingsLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-form-item"),c=C("el-col"),p=C("el-row");return r(),E(ke,null,{default:d(()=>[n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9 gap-2"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),a[0]||(a[0]=o("br",null,null,-1)),o("div",null,[o("div",Tce,[o("p",null,m(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[0]},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Mce,[o("p",null,m(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This | |
| 279 | +email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",Lce,[o("p",null,m(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(c,{lg:12},{default:d(()=>[n(i,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1}),o("div",null,[o("div",Rce,[o("p",null,m(A(u)(`If someone replies to your notification email, this is where you would like to | |
| 280 | +receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[o("div",Oce,m(A(u)("Email Footer")),1),o("div",Pce,[n(s,{animated:"",rows:7})]),o("div",Hce,[o("div",Nce,[o("p",null,m(A(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for | |
| 281 | +compliance.`)),1)])]),o("div",Kce,[n(s,{animated:"",class:"h-5"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1}),n(p,{gutter:15},{default:d(()=>[n(c,null,{default:d(()=>[n(i,null,{default:d(()=>[n(p,{gutter:15,class:"w-full"},{default:d(()=>[n(c,{lg:12},{default:d(()=>[o("div",Gce,[o("span",zce,m(A(u)("Admin Email Address")),1),o("div",jce,[o("p",null,m(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(c,{lg:12},{default:d(()=>[o("div",qce,[n(s,{animated:"",class:"h-9"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"})]),_:1})])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}},Wce={class:"setting-wrap"},Jce={class:"setting-wrap-inner"},Xce={class:"form-note"},Zce={class:"form-note"},eAe={class:"form-note"},tAe={class:"form-note"},aAe={class:"el-form-item__label"},lAe={class:"mt-2 mb-2"},sAe={class:"form-note"},nAe={class:"fct-powered-by-email-footer-checkbox"},oAe={class:"setting-html-wrapper"},iAe={class:"setting-label"},rAe={class:"form-note"},dAe={class:"setting-fields-inner w-full"},uAe={class:"setting-save-action"},cAe={__name:"MailingSettings",setup(e){const t=T({from_name:"",from_email:"",reply_to_name:"",reply_to_email:"",email_footer:"",show_email_footer:"yes",admin_email:"{{wp.admin_email}}"}),a=ze.get("app_config.isProActive"),l=T(!1),s=T({}),i=T({}),c=()=>{l.value=!0,Ae.get("email-notification/get-settings").then(f=>{var _,g,y,v,w,k,b;t.value={from_name:(_=f.data)==null?void 0:_.from_name,from_email:(g=f.data)==null?void 0:g.from_email,reply_to_name:(y=f.data)==null?void 0:y.reply_to_name,reply_to_email:(v=f.data)==null?void 0:v.reply_to_email,email_footer:(w=f.data)==null?void 0:w.email_footer,admin_email:(k=f.data)==null?void 0:k.admin_email,show_email_footer:((b=f.data)==null?void 0:b.show_email_footer)||"yes"},i.value=f.shortcodes}).catch(f=>{}).finally(()=>{l.value=!1})},p=()=>{l.value=!0,s.value={},Ae.post("email-notification/save-settings",t.value).then(f=>{q.success(f.message)}).catch(f=>{f.status_code===422&&f.data?s.value=f.data:f.message?q.error(f.message):(q.error(u("Something went wrong")),s.value=f)}).finally(()=>{l.value=!1})};return Ie(()=>{c()}),(f,_)=>{const g=C("el-input"),y=C("el-form-item"),v=C("el-col"),w=C("el-row"),k=C("el-tooltip"),b=C("el-checkbox"),S=C("el-button");return r(),h("div",Wce,[n(Ua,{heading:A(u)("Mailing Settings"),loading:l.value,onOnSave:p},null,8,["heading","loading"]),o("div",Jce,[n(Ia),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Email Configuration"),text:A(u)("Set your from name, email, and email footer. These configurations will be used to send emails from %s.","FluentCart"),border_bottom:""},null,8,["title","text"]),l.value?(r(),E(Yce,{key:0})):(r(),E(ke,{key:1},{default:d(()=>[n(w,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Name"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_name,"onUpdate:modelValue":_[0]||(_[0]=$=>t.value.from_name=$)},null,8,["modelValue"]),_[9]||(_[9]=o("br",null,null,-1)),o("div",null,[n(_l,{"validation-errors":s.value.from_name||{},"field-key":"from_name"},null,8,["validation-errors"]),o("div",Xce,[o("p",null,m(A(u)("Name that will be used to send emails")),1)])])]),_:1,__:[9]},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("From Email"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.from_email,"onUpdate:modelValue":_[1]||(_[1]=$=>t.value.from_email=$)},null,8,["modelValue"]),o("div",null,[n(_l,{"validation-errors":s.value.from_email||{},"field-key":"from_email"},null,8,["validation-errors"]),o("div",Zce,[o("p",null,m(A(u)(`Provide Valid Email Address email as per your domain/SMTP settings. This | |
| 282 | +email will be used to send emails like notifications`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(w,{gutter:15},{default:d(()=>[n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to name (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_name,"onUpdate:modelValue":_[2]||(_[2]=$=>t.value.reply_to_name=$)},null,8,["modelValue"]),o("div",eAe,[o("p",null,m(A(u)("Name that will be used for reply to attribute")),1)])]),_:1},8,["label"])]),_:1}),n(v,{lg:12},{default:d(()=>[n(y,{label:A(u)("Reply to email (Optional)"),"label-position":"top"},{default:d(()=>[n(g,{modelValue:t.value.reply_to_email,"onUpdate:modelValue":_[3]||(_[3]=$=>t.value.reply_to_email=$)},null,8,["modelValue"]),o("div",null,[n(_l,{"validation-errors":s.value.reply_to_email||{},"field-key":"reply_to_email"},null,8,["validation-errors"]),o("div",tAe,[o("p",null,m(A(u)(`If someone replies to your notification email, this is where you would like to | |
| 283 | +receive it.`)),1)])])]),_:1},8,["label"])]),_:1})]),_:1}),n(w,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[o("div",aAe,m(A(u)("Email Footer")),1),n(ls,{"short-codes":i.value,modelValue:t.value.email_footer,"onUpdate:modelValue":_[4]||(_[4]=$=>t.value.email_footer=$),onUpdate:_[5]||(_[5]=$=>{t.value.email_footer=$})},null,8,["short-codes","modelValue"]),o("div",lAe,[n(_l,{"validation-errors":s.value.email_footer||{},"field-key":"email_footer"},null,8,["validation-errors"]),o("div",sAe,[o("p",null,m(A(u)(`This email footer will be used for all emails sent from FluentCart, It's highly recommended to use your business name and address in the footer for | |
| 284 | +compliance.`)),1)])]),o("div",nAe,[n(b,{modelValue:t.value.show_email_footer,"onUpdate:modelValue":_[6]||(_[6]=$=>t.value.show_email_footer=$),"true-value":"yes","false-value":"no",disabled:!A(a)},{default:d(()=>[R(m(A(u)("Enable powered by FluentCart in the email footer"))+" ",1),A(a)?x("",!0):(r(),E(k,{key:0,"popper-class":"fct-tooltip",placement:"top"},{content:d(()=>[R(m(A(u)("This feature is available in pro version only.")),1)]),default:d(()=>[n(Y,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_:1},8,["modelValue","disabled"])])]),_:1})]),_:1}),n(w,{gutter:15},{default:d(()=>[n(v,null,{default:d(()=>[n(y,null,{default:d(()=>[n(w,{gutter:15,class:"w-full"},{default:d(()=>[n(v,{lg:12},{default:d(()=>[o("div",oAe,[o("span",iAe,m(A(u)("Admin Email Address")),1),o("div",rAe,[o("p",null,m(A(u)("FluentCart will send admin notification to this email address.")),1)])])]),_:1}),n(v,{lg:12},{default:d(()=>[o("div",dAe,[n(g,{modelValue:t.value.admin_email,"onUpdate:modelValue":_[7]||(_[7]=$=>t.value.admin_email=$)},null,8,["modelValue"])])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}))]),_:1}),o("div",uAe,[n(S,{type:"primary",onClick:_[8]||(_[8]=$=>p()),loading:l.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},AAe={class:"setting-wrap"},pAe={class:"setting-wrap-inner"},fAe={class:"form-note"},mAe={class:"form-note"},hAe={class:"form-note",style:{"padding-top":"6px"}},_Ae={class:"form-note"},vAe={class:"setting-save-action"},xc="{{wp.admin_email}}",gAe={__name:"StoreDigestSettings",setup(e){const t=T({recipients:"{{wp.admin_email}}",send_when_empty:"no",daily:{enabled:"no",send_hour:8},weekly:{enabled:"no",send_hour:8,send_dow:1},monthly:{enabled:"no",send_hour:8}}),a=T(!1),l=T({}),s=T(""),i=[{key:"daily",label:u("Daily digest"),desc:u("Yesterday's performance, sent every morning.")},{key:"weekly",label:u("Weekly digest"),desc:u("The previous 7 days, sent on your chosen day.")},{key:"monthly",label:u("Monthly digest"),desc:u("The previous calendar month, sent on the 1st.")}],c=u("Comma-separate multiple addresses. %1$s resolves to the site admin email.",xc),p=K(()=>{const v=[];for(let w=0;w<24;w++)v.push({value:w,label:String(w).padStart(2,"0")+":00"});return v}),f=[{value:1,label:u("Monday")},{value:2,label:u("Tuesday")},{value:3,label:u("Wednesday")},{value:4,label:u("Thursday")},{value:5,label:u("Friday")},{value:6,label:u("Saturday")},{value:7,label:u("Sunday")}],_=()=>{a.value=!0,Ae.get("email-notification/digest-settings").then(v=>{v.data&&(t.value=v.data)}).catch(()=>{}).finally(()=>{a.value=!1})},g=()=>{a.value=!0,l.value={},Ae.post("email-notification/digest-settings",t.value).then(v=>{q.success(v.message)}).catch(v=>{v.status_code===422&&v.data?l.value=v.data:v.message?q.error(v.message):q.error(u("Something went wrong"))}).finally(()=>{a.value=!1})},y=v=>{s.value=v,Ae.post("email-notification/digest-settings/send-test",{frequency:v}).then(w=>{q.success(w.message)}).catch(w=>{q.error(w.message||u("Could not send the test email."))}).finally(()=>{s.value=""})};return Ie(()=>{_()}),(v,w)=>{const k=C("el-input"),b=C("el-form-item"),S=C("el-col"),$=C("el-checkbox"),D=C("el-row"),F=C("el-switch"),B=C("el-option"),U=C("el-select"),Q=C("el-button");return r(),h("div",AAe,[n(Ua,{heading:A(u)("Store Digest Emails"),loading:a.value,onOnSave:g},null,8,["heading","loading"]),o("div",pAe,[n(Ia),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Recipients & General"),text:A(u)("A system email summarising your store activity. Numbers match the Reports dashboard."),border_bottom:""},null,8,["title","text"]),n(ke,null,{default:d(()=>[n(D,{gutter:15},{default:d(()=>[n(S,{lg:12},{default:d(()=>[n(b,{label:A(u)("Recipient email addresses"),"label-position":"top"},{default:d(()=>[n(k,{modelValue:t.value.recipients,"onUpdate:modelValue":w[0]||(w[0]=V=>t.value.recipients=V),placeholder:xc},null,8,["modelValue"]),o("div",null,[n(_l,{"validation-errors":l.value.recipients||{},"field-key":"recipients"},null,8,["validation-errors"]),o("div",fAe,[o("p",null,m(A(c)),1)])])]),_:1},8,["label"])]),_:1}),n(S,{lg:12},{default:d(()=>[n(b,{label:A(u)("Empty periods"),"label-position":"top"},{default:d(()=>[n($,{modelValue:t.value.send_when_empty,"onUpdate:modelValue":w[1]||(w[1]=V=>t.value.send_when_empty=V),"true-value":"yes","false-value":"no"},{default:d(()=>[R(m(A(u)("Send even when there was no activity")),1)]),_:1},8,["modelValue"]),o("div",mAe,[o("p",null,m(A(u)("When off, a digest is skipped for any period with no paid orders.")),1)])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1})]),_:1}),(r(),h(P,null,te(i,V=>n(Se,{key:V.key,class:"fct-mt-4"},{default:d(()=>[n(Ve,{title:V.label,text:V.desc,border_bottom:""},null,8,["title","text"]),n(ke,null,{default:d(()=>[n(D,{gutter:15,align:"middle"},{default:d(()=>[n(S,{lg:6},{default:d(()=>[n(b,{label:A(u)("Enable"),"label-position":"top"},{default:d(()=>[n(F,{modelValue:t.value[V.key].enabled,"onUpdate:modelValue":I=>t.value[V.key].enabled=I,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),n(S,{lg:6},{default:d(()=>[n(b,{label:A(u)("Send time"),"label-position":"top"},{default:d(()=>[n(U,{modelValue:t.value[V.key].send_hour,"onUpdate:modelValue":I=>t.value[V.key].send_hour=I,class:"w-full"},{default:d(()=>[(r(!0),h(P,null,te(p.value,I=>(r(),E(B,{key:I.value,label:I.label,value:I.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]),_:2},1024),V.key==="weekly"?(r(),E(S,{key:0,lg:6},{default:d(()=>[n(b,{label:A(u)("Day of week"),"label-position":"top"},{default:d(()=>[n(U,{modelValue:t.value.weekly.send_dow,"onUpdate:modelValue":w[2]||(w[2]=I=>t.value.weekly.send_dow=I),class:"w-full"},{default:d(()=>[(r(),h(P,null,te(f,I=>n(B,{key:I.value,label:I.label,value:I.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})):x("",!0),V.key==="monthly"?(r(),E(S,{key:1,lg:6},{default:d(()=>[n(b,{label:A(u)("Send day"),"label-position":"top"},{default:d(()=>[o("div",hAe,[o("p",null,m(A(u)("Sent on the 1st of each month.")),1)])]),_:1},8,["label"])]),_:1})):x("",!0),n(S,{lg:6},{default:d(()=>[n(b,{label:" ","label-position":"top"},{default:d(()=>[n(Q,{loading:s.value===V.key,onClick:I=>y(V.key),class:"mt-2"},{default:d(()=>[R(m(A(u)("Send test email")),1)]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024),o("div",_Ae,[o("p",null,m(A(u)("Send time is in your store timezone. Test emails use your saved recipients.")),1)])]),_:2},1024)]),_:2},1024)),64)),o("div",vAe,[n(Q,{type:"primary",onClick:w[3]||(w[3]=V=>g()),loading:a.value},{default:d(()=>[R(m(A(u)("Save Settings")),1)]),_:1},8,["loading"])])])])}}},yAe={};function bAe(e,t){const a=C("router-view");return r(),h("div",null,[n(a)])}const wAe=nt(yAe,[["render",bAe]]),CAe={},kAe={class:"fct-setting-form-row"},BAe={class:"w-[300px]"},xAe={class:"flex-grow flex-shrink flex-basis-0 self-center"},SAe={class:"fct-setting-form-row"},FAe={class:"w-[300px]"},$Ae={class:"flex-grow flex-shrink flex-basis-0 self-center"},EAe={class:"fct-setting-form-row"},UAe={class:"w-[300px]"},IAe={class:"flex-grow flex-shrink flex-basis-0 self-center"};function QAe(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),h("div",null,[o("div",kAe,[o("div",BAe,[n(l,{animated:"",class:"max-w-[70%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-[80%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"}),n(a,{variant:"p",class:"w-1/2 h-4"})]),_:1})]),o("div",xAe,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",SAe,[o("div",FAe,[n(l,{animated:"",class:"max-w-[60%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",$Ae,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])]),o("div",EAe,[o("div",UAe,[n(l,{animated:"",class:"max-w-[50%]"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1}),n(l,{animated:"",class:"max-w-full"},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})]),o("div",IAe,[n(l,{animated:""},{template:d(()=>[n(a,{variant:"p",class:"w-full h-4"})]),_:1})])])])}const DAe=nt(CAe,[["render",QAe]]),VAe={name:"TaxConfigurations",components:{TaxConfigurationsLoader:DAe,CardContainer:Se,CardBody:ke,CardHeader:Ve,LabelHint:pa,SettingsHeader:Ua,AdminNotice:Ia,Animation:ya},data(){return{settings:{enable_tax:"no",tax_inclusion:"included",tax_calculation_basis:"shipping",tax_rounding:"item",checkout_tax_breakdown_display:"itemized",tax_display_label:"Tax",price_suffix_included:"",price_suffix_excluded:"",eu_vat_settings:{require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[]}},tax_settings_changed:!1,saving:!1,loading:!1,categories:[],fetchingCategories:!1,keyboardShortcuts:null}},computed:{handlePriceMode(){return this.settings.eu_vat_settings.local_reverse_charge=="yes"}},mounted(){this.bindSaveShortcut(),this.getSettings(),this.fetchCategories()},beforeUnmount(){this.unbindSaveShortcut()},methods:{translate:u,saveSettings(){this.saving||this.loading||(this.saving=!0,this.$post("tax/configuration/settings",{settings:this.settings}).then(e=>{this.handleSuccess(e.message),this.tax_settings_changed=!0,ze.mergeConfig({is_tax_enabled:this.settings.enable_tax==="yes"})}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message),this.saving=!1}).finally(()=>{this.saving=!1}))},getSettings(){this.loading=!0,this.$get("tax/configuration/settings").then(e=>{if(this.settings=e.settings,this.settings.eu_vat_settings={require_vat_number:"no",local_reverse_charge:"yes",reverse_charge_price_mode:"fixed",vat_reverse_excluded_categories:[],...this.settings.eu_vat_settings||{}},["itemized","simplified"].includes(this.settings.checkout_tax_breakdown_display)||(this.settings.checkout_tax_breakdown_display="itemized"),this.settings.tax_display_label||(this.settings.tax_display_label="Tax"),!Array.isArray(this.settings.eu_vat_settings.vat_reverse_excluded_categories))this.settings.eu_vat_settings.vat_reverse_excluded_categories=[];else{let t=this.settings.eu_vat_settings.vat_reverse_excluded_categories.map(a=>a.toString());this.settings.eu_vat_settings.vat_reverse_excluded_categories=t}}).catch(e=>{var t;this.handleError((t=e==null?void 0:e.data)==null?void 0:t.message)}).finally(()=>{this.loading=!1})},fetchCategories(){this.categories.length>0||(this.fetchingCategories=!0,this.$get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms||[]}).catch(()=>{}).finally(()=>{this.fetchingCategories=!1}))},bindSaveShortcut(){this.keyboardShortcuts=bs(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.saveSettings()})},unbindSaveShortcut(){var e;(e=this.keyboardShortcuts)!=null&&e.unbind&&this.keyboardShortcuts.unbind("mod+s")}}},TAe={class:"setting-wrap"},MAe={class:"setting-wrap-inner"},LAe={class:"fct-setting-form-row"},RAe={class:"fct-setting-form-content flex gap-3.5 flex-1"},OAe={class:"fct-inline-tip"},PAe={key:1},HAe={class:"fct-setting-form-row"},NAe={class:"fct-setting-form-content"},KAe={class:"fct-inline-tip"},GAe={class:"fct-setting-form-fields self-center"},zAe={class:"fct-inline-tip mt-2"},jAe={class:"fct-setting-form-row"},qAe={class:"fct-setting-form-content"},YAe={class:"fct-inline-tip"},WAe={class:"fct-setting-form-fields self-center"},JAe={class:"flex flex-col"},XAe={class:"price-mode-label"},ZAe={class:"price-mode-text"},epe={class:"flex flex-col"},tpe={class:"price-mode-label"},ape={class:"price-mode-text"},lpe={class:"fct-setting-form-row"},spe={class:"fct-setting-form-content"},npe={class:"fct-inline-tip"},ope={class:"fct-setting-form-fields self-center"},ipe={class:"fct-setting-form-row"},rpe={class:"fct-setting-form-content"},dpe={class:"fct-inline-tip"},upe={class:"fct-setting-form-fields self-center"},cpe={class:"fct-setting-form-row"},Ape={class:"fct-setting-form-content"},ppe={class:"fct-inline-tip"},fpe={class:"fct-setting-form-fields self-center"},mpe={class:"fct-setting-form-row"},hpe={class:"fct-setting-form-content"},_pe={class:"fct-inline-tip"},vpe={class:"fct-setting-form-fields self-center"},gpe={key:0,class:"fct-setting-form-row"},ype={class:"fct-setting-form-content"},bpe={class:"fct-inline-tip"},wpe={class:"fct-setting-form-fields self-center"},Cpe={class:"fct-setting-form-row"},kpe={class:"fct-setting-form-content"},Bpe={class:"fct-inline-tip"},xpe={class:"fct-setting-form-fields"},Spe={class:"fct-vat-charge-setting-wrap grid gap-5 w-full"},Fpe={class:"fct-local-reverse-charge flex gap-2 justify-items-start"},$pe={class:"fct-inline-tip"},Epe={class:"fct-vat-excluded-categories"},Upe={class:"fct-inline-tip"};function Ipe(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-switch"),_=C("LabelHint"),g=C("TaxConfigurationsLoader"),y=C("el-radio"),v=C("el-radio-group"),w=C("el-option"),k=C("el-select"),b=C("el-input"),S=C("Animation"),$=C("CardBody"),D=C("CardContainer"),F=Va("loading");return r(),h("div",TAe,[n(c,{heading:i.translate("Tax Configuration"),loading:s.saving,"show-cmnd-icon":!0,onOnSave:i.saveSettings},null,8,["heading","loading","onOnSave"]),o("div",MAe,[n(p),n(D,null,{default:d(()=>[n($,null,{default:d(()=>[o("div",LAe,[o("div",RAe,[n(f,{modelValue:s.settings.enable_tax,"onUpdate:modelValue":t[0]||(t[0]=B=>s.settings.enable_tax=B),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Enable Tax")},null,8,["title"]),o("p",OAe,m(s.settings.enable_tax==="yes"?i.translate("This store is now collecting tax."):i.translate("This store is not collecting tax.")),1)])])]),n(S,{visible:s.settings.enable_tax==="yes",accordion:""},{default:d(()=>[s.loading?(r(),E(g,{key:0})):x("",!0),s.loading?x("",!0):(r(),h("div",PAe,[o("div",HAe,[o("div",NAe,[n(_,{title:i.translate("Prices entered with tax")},null,8,["title"]),o("p",KAe,m(i.translate("Choose whether product prices are entered including or excluding tax.")),1)]),o("div",GAe,[n(v,{modelValue:s.settings.tax_inclusion,"onUpdate:modelValue":t[1]||(t[1]=B=>s.settings.tax_inclusion=B)},{default:d(()=>[n(y,{value:"included"},{default:d(()=>[R(m(i.translate("Included")),1)]),_:1}),n(y,{value:"excluded"},{default:d(()=>[R(m(i.translate("Excluded")),1)]),_:1})]),_:1},8,["modelValue"]),o("p",zAe,m(i.translate("Shipping tax always follows the store-level tax mode (Included or Excluded). Product-specific tax settings do not apply to shipping.")),1)])]),o("div",jAe,[o("div",qAe,[n(_,{title:i.translate("Tax-Inclusive Price Mode")},null,8,["title"]),o("p",YAe,m(i.translate("Controls how reverse charge affects tax-inclusive product prices.")),1)]),o("div",WAe,[n(v,{modelValue:s.settings.eu_vat_settings.reverse_charge_price_mode,"onUpdate:modelValue":t[2]||(t[2]=B=>s.settings.eu_vat_settings.reverse_charge_price_mode=B),class:"fct-reverse-charge-price-mode"},{default:d(()=>[n(y,{value:"fixed"},{default:d(()=>[o("div",JAe,[o("span",XAe,m(i.translate("Fixed")),1),o("span",ZAe,m(i.translate("Listed price stays unchanged on reverse charge. Only the tax line is zeroed on the invoice.")),1)])]),_:1}),n(y,{value:"dynamic"},{default:d(()=>[o("div",epe,[o("span",tpe,m(i.translate("Dynamic")),1),o("span",ape,m(i.translate("VAT is stripped from the price on reverse charge. Customer pays the net (ex-VAT) amount.")),1)])]),_:1})]),_:1},8,["modelValue"])])]),o("div",lpe,[o("div",spe,[n(_,{title:i.translate("Calculate Tax Based On")},null,8,["title"]),o("p",npe,m(i.translate("Determine the location used for tax calculations.")),1)]),o("div",ope,[n(k,{modelValue:s.settings.tax_calculation_basis,"onUpdate:modelValue":t[3]||(t[3]=B=>s.settings.tax_calculation_basis=B),clearable:""},{default:d(()=>[n(w,{value:"shipping",label:i.translate("Customer Shipping Address")},null,8,["label"]),n(w,{value:"billing",label:i.translate("Customer Billing Address")},null,8,["label"]),n(w,{value:"store",label:i.translate("Store Location")},null,8,["label"])]),_:1},8,["modelValue"])])]),o("div",ipe,[o("div",rpe,[n(_,{title:i.translate("Price Suffix (Tax Included)")},null,8,["title"]),o("p",dpe,m(i.translate("Shown on prices where tax is included. Applies when product or store pricing is tax-inclusive.")),1)]),o("div",upe,[n(b,{modelValue:s.settings.price_suffix_included,"onUpdate:modelValue":t[4]||(t[4]=B=>s.settings.price_suffix_included=B),placeholder:i.translate("e.g. (incl. tax)")},null,8,["modelValue","placeholder"])])]),o("div",cpe,[o("div",Ape,[n(_,{title:i.translate("Price Suffix (Tax Excluded)")},null,8,["title"]),o("p",ppe,m(i.translate("Shown on prices where tax is excluded. Applies when product or store pricing is tax-exclusive.")),1)]),o("div",fpe,[n(b,{modelValue:s.settings.price_suffix_excluded,"onUpdate:modelValue":t[5]||(t[5]=B=>s.settings.price_suffix_excluded=B),placeholder:i.translate("e.g. (+ tax)")},null,8,["modelValue","placeholder"])])]),o("div",mpe,[o("div",hpe,[n(_,{title:i.translate("Tax Display Style")},null,8,["title"]),o("p",_pe,m(i.translate("Choose how tax context appears on each checkout line item.")),1)]),o("div",vpe,[n(k,{modelValue:s.settings.checkout_tax_breakdown_display,"onUpdate:modelValue":t[6]||(t[6]=B=>s.settings.checkout_tax_breakdown_display=B)},{default:d(()=>[n(w,{value:"simplified",label:i.translate("Simplified (single line + details)")},null,8,["label"]),n(w,{value:"itemized",label:i.translate("Itemized (per-item tax + breakdown)")},null,8,["label"])]),_:1},8,["modelValue"])])]),s.settings.checkout_tax_breakdown_display==="simplified"?(r(),h("div",gpe,[o("div",ype,[n(_,{title:i.translate("Tax Line Label")},null,8,["title"]),o("p",bpe,m(i.translate("The single-line tax label shown in Simplified mode, e.g. VAT, MwSt, GST.")),1)]),o("div",wpe,[n(b,{modelValue:s.settings.tax_display_label,"onUpdate:modelValue":t[7]||(t[7]=B=>s.settings.tax_display_label=B),placeholder:i.translate("e.g. Tax")},null,8,["modelValue","placeholder"])])])):x("",!0),o("div",Cpe,[o("div",kpe,[n(_,{title:i.translate("VAT Reverse Charge Settings")},null,8,["title"]),o("p",Bpe,m(i.translate("Configure reverse VAT handling for customers in the European Union.")),1)]),o("div",xpe,[o("div",Spe,[o("div",Fpe,[n(f,{modelValue:s.settings.eu_vat_settings.local_reverse_charge,"onUpdate:modelValue":t[8]||(t[8]=B=>s.settings.eu_vat_settings.local_reverse_charge=B),"active-value":"yes","inactive-value":"no"},null,8,["modelValue"]),o("div",null,[n(_,{title:i.translate("Local Reverse Charge")},null,8,["title"]),o("p",$pe,m(i.translate("If enabled, apply reverse charge when applicable even when customers are in your home country.")),1)])]),n(S,{visible:i.handlePriceMode,accordion:""},{default:d(()=>[o("div",Epe,[n(_,{title:i.translate("Exclude Categories from VAT reverse")},null,8,["title"]),o("p",Upe,m(i.translate("Select product categories that should NOT get VAT reverse charge !")),1),Wt((r(),E(k,{modelValue:s.settings.eu_vat_settings.vat_reverse_excluded_categories,"onUpdate:modelValue":t[9]||(t[9]=B=>s.settings.eu_vat_settings.vat_reverse_excluded_categories=B),filterable:"",multiple:"",clearable:"",placeholder:i.translate("Select Product Categories"),class:"w-full mt-4"},{default:d(()=>[(r(!0),h(P,null,te(s.categories,B=>(r(),E(w,{key:B.value||B.term_id,label:B.label||B.name,value:B.value||B.term_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])),[[F,s.fetchingCategories]])])]),_:1},8,["visible"])])])])]))]),_:1},8,["visible"])]),_:1})]),_:1})])])}const Qpe=nt(VAe,[["render",Ipe]]),Dpe={class:"fct-tax-rates-wrap-loader px-5"},Vpe={__name:"TaxRatesLoader",setup(e){const t=T(Array.from({length:6},()=>`${Math.floor(Math.random()*21)+120}px`));return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",Dpe,[(r(!0),h(P,null,te(t.value,(c,p)=>(r(),h("div",{key:p,class:"flex items-center justify-between border-[1px] border-solid border-gray-divider dark:border-dark-400 rounded h-12 pr-4 pl-6 mb-4"},[n(i,{animated:"",style:ra({width:c}),class:"h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:2},1032,["style"]),n(i,{animated:"",class:"w-[100px] h-4"},{template:d(()=>[n(s,{variant:"p",class:"h-4"})]),_:1})]))),128))])}}},Tpe={class:"setting-wrap"},Mpe={class:"setting-wrap-inner"},Lpe={class:"fct-all-tax-classes-page"},Rpe={class:"flex items-center justify-end gap-4"},Ope={key:0,class:"px-6 py-4 border-b border-gray-200 dark:border-gray-700"},Ppe={class:"inline-flex items-center gap-2"},Hpe={class:"inline-flex items-center gap-2"},Npe=["src","alt"],Kpe={key:0,class:"text-gray-400 dark:text-gray-300"},Gpe={key:1,class:"text-success-500"},zpe={key:2,class:"text-system-mid dark:text-gray-300"},jpe={key:3,class:"text-gray-400 dark:text-gray-300"},qpe={key:1,class:"text-gray-400"},Ype={__name:"TaxRates",setup(e){const t=T({}),a=T([]),l=T({}),s=T({}),i=K(()=>!!ze.get("is_tax_enabled")),c=T(!1),p=T({}),f={};let _=0;const g=T(""),y=T(!1),v={XI:"gb"},w=I=>(v[I]||I).toLowerCase(),k=K(()=>{const I=new Set;for(const M of a.value)for(const O of M.countries||[])I.add(O.country_code);return I}),b=I=>!I||!Object.prototype.hasOwnProperty.call(s.value,I)?!0:s.value[I],S=I=>!I||!I.vat?!1:I.rates&&typeof I.rates=="object"&&Object.keys(I.rates).length?Object.values(I.rates).some(M=>M&&parseFloat(M.rate)>0):parseFloat(I.rate)>0,$=K(()=>{const I=l.value||{},M=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"",L=M.some(S);if(O==="oss")return!!I.oss_country;if(O==="home"){const H=I.home_country||"",j=M.find(W=>W.country===H);if(H&&j&&S(j))return!0}return O==="specific"?!!I.home_country:L}),D=K(()=>{const I=l.value||{},M=Array.isArray(I.country_registrations)?I.country_registrations:[],O=I.method||"";return O==="oss"?!!I.oss_country:O==="home"?!!I.home_country&&M.some(L=>L.country===I.home_country):O==="specific"?!!I.home_country:M.some(S)}),F=K(()=>{const I=[],M=Object.values(t.value||{});for(const H of M)if(H.group_code==="EU")I.push({country_code:"EU",country_name:"European Union",isEU:!0,group_code:"EU",hasConfig:D.value,enabled:b("EU"),collecting:D.value&&$.value&&b("EU")});else for(const j of H.countries||[]){const W=k.value.has(j.country_code),G=b(j.country_code);I.push({country_code:j.country_code,country_name:j.country_name,isEU:!1,group_code:H.group_code,hasConfig:W,enabled:G,collecting:W&&G})}const O=["EU","US","GB","AU","CA","NZ","IN","SG","JP"],L=new Set(O);return I.sort((H,j)=>{if(H.hasConfig!==j.hasConfig)return H.hasConfig?-1:1;const W=L.has(H.country_code),G=L.has(j.country_code);return W&&G?O.indexOf(H.country_code)-O.indexOf(j.country_code):W?-1:G?1:H.country_name.localeCompare(j.country_name)}),I}),B=K(()=>{const I=g.value.trim().toLowerCase();return F.value.filter(M=>y.value&&(!i.value||!M.collecting)?!1:I?M.country_name.toLowerCase().includes(I)||M.country_code.toLowerCase().includes(I):!0)}),U=K(()=>{if(!i.value)return!1;const I=F.value.filter(O=>O.enabled).length,M=F.value.filter(O=>!O.enabled).length;return I>0&&M>0}),Q=()=>{c.value=!0,Promise.all([Ae.get("tax/configuration/rates"),Ae.get("tax/rates"),Ae.get("tax/configuration/settings")]).then(([I,M,O])=>{var L;t.value=I.tax_rates,a.value=M.tax_rates,s.value=M.country_enabled_map||{},l.value=((L=O.settings)==null?void 0:L.eu_vat_settings)||{}}).catch(I=>{}).finally(()=>{c.value=!1})},V=(I,M)=>{const O=b(I.country_code),L=++_;f[I.country_code]=L,s.value={...s.value,[I.country_code]:M},p.value={...p.value,[I.country_code]:!0},Ae.post("tax/country-status/"+I.country_code,{enabled:M?1:0}).then(H=>{f[I.country_code]===L&&(q.success(H.message),s.value={...s.value,[I.country_code]:H.enabled})}).catch(H=>{var j;f[I.country_code]===L&&(s.value={...s.value,[I.country_code]:O},q.error(((j=H==null?void 0:H.data)==null?void 0:j.message)||u("Failed to update tax status")))}).finally(()=>{if(f[I.country_code]===L){const H={...p.value};delete H[I.country_code],p.value=H}})};return Ie(()=>{Q()}),(I,M)=>{const O=C("el-checkbox"),L=C("el-input"),H=C("el-table-column"),j=C("el-switch"),W=C("el-table");return r(),h("div",Tpe,[n(Ua,{heading:A(u)("Tax Regions"),"show-save-button":!1},null,8,["heading"]),o("div",Mpe,[n(Ia),o("div",Lpe,[n(Se,{class:"overflow-hidden"},{default:d(()=>[n(Ve,{title:A(u)("Tax Regions"),text:A(u)("Manage tax rates for different regions")},{action:d(()=>[o("div",Rpe,[U.value?(r(),E(O,{key:0,modelValue:y.value,"onUpdate:modelValue":M[0]||(M[0]=G=>y.value=G)},{default:d(()=>[R(m(A(u)("Collecting Tax")),1)]),_:1},8,["modelValue"])):x("",!0),n(L,{modelValue:g.value,"onUpdate:modelValue":M[1]||(M[1]=G=>g.value=G),class:"w-[200px]",placeholder:A(u)("Search regions..."),size:"small",clearable:""},{prefix:d(()=>[n(Y,{name:"Search",class:"w-4 h-4"})]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["title","text"]),n(ke,{class:"px-0 pb-0"},{default:d(()=>[!c.value&&!i.value?(r(),h("div",Ope,[n(el,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),c.value?(r(),E(Vpe,{key:1})):(r(),E(W,{key:2,data:B.value,"max-height":"500",class:"w-full compact-table fct-tax-rates-regions-table"},{default:d(()=>[n(H,{label:A(u)("Region"),"min-width":"300"},{default:d(({row:G})=>[G.isEU?(r(),E(Ba,{key:0,class:"hover:no-underline",to:{name:"eu"}},{default:d(()=>[o("div",Ppe,[M[2]||(M[2]=o("img",{class:"w-[22px] block",src:"https://flagcdn.com/w40/eu.png",alt:"EU"},null,-1)),R(" "+m(G.country_name),1)])]),_:2},1024)):(r(),E(Ba,{key:1,to:{name:"tax-rates-country-single",params:{country:G.country_code,group:G.group_code}},class:"fct-tax-region-link hover:no-underline"},{default:d(()=>[o("div",Hpe,[o("img",{class:"w-[22px] block",src:`https://flagcdn.com/w40/${w(G.country_code)}.png`,alt:G.country_code},null,8,Npe),R(" "+m(G.country_name),1)])]),_:2},1032,["to"]))]),_:1},8,["label"]),n(H,{label:A(u)("Collecting"),width:"200"},{default:d(({row:G})=>[i.value?G.collecting?(r(),h("span",Gpe,m(A(u)("Collecting tax")),1)):G.hasConfig&&!G.enabled?(r(),h("span",zpe,m(A(u)("Disabled")),1)):(r(),h("span",jpe,"—")):(r(),h("span",Kpe,"—"))]),_:1},8,["label"]),n(H,{label:A(u)("Enabled"),width:"140",align:"center"},{default:d(({row:G})=>[G.hasConfig?(r(),E(j,{key:0,"model-value":i.value?G.enabled:!1,loading:!!p.value[G.country_code],disabled:!i.value,onChange:Z=>V(G,Z)},null,8,["model-value","loading","disabled","onChange"])):(r(),h("span",qpe,"—"))]),_:1},8,["label"])]),_:1},8,["data"]))]),_:1})]),_:1})])])])}}},Wpe={class:"fct-base-taxes"},Jpe={class:"fct-tax-class-tabs"},Xpe={class:"fct-tax-class-tabs__list"},Zpe={class:"fct-base-taxes__header"},efe={class:"fct-base-taxes__header-label"},tfe={class:"fct-base-taxes__state-row fct-base-taxes__state-row--federal"},afe={class:"fct-base-taxes__region-name fct-base-taxes__region-name--federal"},lfe={class:"fct-base-taxes__state-fields"},sfe={class:"fct-base-taxes__region-name"},nfe={class:"fct-base-taxes__state-fields"},ofe={__name:"CountryTaxRatesLoader",setup(e){const t=[1,2,3];return(a,l)=>{const s=C("el-skeleton-item"),i=C("el-skeleton");return r(),h("div",null,[o("div",Wpe,[o("div",Jpe,[o("div",Xpe,[(r(),h(P,null,te(3,c=>o("div",{key:c,class:"fct-tax-class-tabs__tab"},[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-16 h-5"})]),_:1})])),64)),n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-5 h-5"})]),_:1})])]),o("div",Zpe,[o("span",efe,m(A(u)("Regions")),1)]),o("div",tfe,[o("div",afe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-40 h-5"})]),_:1})]),o("div",lfe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),l[0]||(l[0]=o("div",{class:"fct-base-taxes__field-compound"},null,-1))])]),l[1]||(l[1]=o("div",{class:"fct-base-taxes__divider"},null,-1)),(r(),h(P,null,te(t,c=>o("div",{key:c,class:"fct-base-taxes__state-row"},[o("div",sfe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"text",class:"w-32 h-4"})]),_:1})]),o("div",nfe,[n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-rate h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-name h-8"})]),_:1}),n(i,{animated:""},{template:d(()=>[n(s,{variant:"rect",class:"fct-base-taxes__field-compound h-8"})]),_:1})])])),64))])])}}},ife={class:"fct-tax-class-tabs"},rfe={class:"fct-tax-class-tabs__list"},dfe=["onClick"],ufe=["title","onClick"],cfe=["disabled","title"],Afe=["disabled","title"],pfe=["disabled"],ffe=["disabled","title"],mfe={class:"fct-tax-class-tabs__search"},wf={__name:"TaxClassTabs",props:{classes:{type:Array,default:()=>[]},activeId:{type:[Number,String],default:null},maxClasses:{type:Number,default:6},creating:{type:Boolean,default:!1},search:{type:String,default:""}},emits:["switch","delete","add","create-custom","update:search"],setup(e,{emit:t}){const a=e,l=t,s=T(!1),i=T(""),c=T(null),p=T(!1),f=K(()=>[...a.classes].sort((b,S)=>b.slug==="standard"&&S.slug!=="standard"?-1:b.slug!=="standard"&&S.slug==="standard"?1:0)),_=K(()=>["reduced","zero"].filter(b=>!a.classes.find(S=>S.slug===b))),g=()=>{i.value="",p.value=!1,s.value=!0,xe(()=>{var b;return(b=c.value)==null?void 0:b.focus()})},y=b=>{if(b==="custom"){g();return}l("add",b)},v=()=>{const b=i.value.trim();if(!b){w();return}l("create-custom",b)},w=()=>{s.value=!1,i.value="",p.value=!1},k=()=>{!a.creating&&!i.value.trim()&&w()};return be([()=>a.classes.length,()=>a.creating],([b,S],[$,D])=>{if(s.value){if(b>$){w();return}D&&!S&&(p.value=!0)}}),be(i,()=>{p.value=!1}),(b,S)=>{const $=C("el-input"),D=C("el-dropdown-item"),F=C("el-dropdown-menu"),B=C("el-dropdown");return r(),h("div",ife,[o("div",rfe,[(r(!0),h(P,null,te(f.value,U=>(r(),h("button",{key:U.id,class:de(["fct-tax-class-tabs__tab",{"fct-tax-class-tabs__tab--active":e.activeId==U.id}]),onClick:Q=>l("switch",U)},[R(m(U.title)+" ",1),U.slug!=="standard"?(r(),h("span",{key:0,class:"fct-tax-class-tabs__delete",title:A(u)("Delete tax class"),onClick:Ge(Q=>l("delete",U),["stop"])},[n(Y,{name:"Close"})],8,ufe)):x("",!0)],10,dfe))),128)),e.classes.length<e.maxClasses?(r(),h(P,{key:0},[s.value?(r(),h("div",{key:0,class:de(["fct-tax-class-tabs__inline-create",{"fct-tax-class-tabs__inline-create--error":p.value}])},[n($,{ref_key:"inlineInput",ref:c,modelValue:i.value,"onUpdate:modelValue":S[0]||(S[0]=U=>i.value=U),size:"small",maxlength:"30",disabled:e.creating,placeholder:A(u)("e.g. Luxury"),onKeyup:[xa(v,["enter"]),xa(w,["esc"])],onBlur:k},null,8,["modelValue","disabled","placeholder"]),o("button",{class:"fct-tax-class-tabs__inline-confirm",disabled:e.creating||!i.value.trim(),title:A(u)("Create tax class"),onMousedown:S[1]||(S[1]=Ge(()=>{},["prevent"])),onClick:v},[n(Y,{name:"Check"})],40,cfe),o("button",{class:"fct-tax-class-tabs__inline-cancel",disabled:e.creating,title:A(u)("Cancel"),onMousedown:S[2]||(S[2]=Ge(()=>{},["prevent"])),onClick:w},[n(Y,{name:"Close"})],40,Afe)],2)):_.value.length?(r(),E(B,{key:1,trigger:"click",disabled:e.creating,onCommand:y,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(F,null,{default:d(()=>[_.value.includes("reduced")?(r(),E(D,{key:0,command:"reduced"},{default:d(()=>[R(m(A(u)("Reduced")),1)]),_:1})):x("",!0),_.value.includes("zero")?(r(),E(D,{key:1,command:"zero"},{default:d(()=>[R(m(A(u)("Zero")),1)]),_:1})):x("",!0),n(D,{command:"custom"},{default:d(()=>[R(m(A(u)("Custom Class...")),1)]),_:1})]),_:1})]),default:d(()=>[o("button",{class:"fct-tax-class-tabs__add",disabled:e.creating},[n(Y,{name:"Plus"})],8,pfe)]),_:1},8,["disabled"])):(r(),h("button",{key:2,class:"fct-tax-class-tabs__add",disabled:e.creating,title:A(u)("Add custom tax class"),onClick:g},[n(Y,{name:"Plus"})],8,ffe))],64)):x("",!0)]),o("div",mfe,[n($,{"model-value":e.search,placeholder:A(u)("Search country or region…"),size:"small",clearable:"","onUpdate:modelValue":S[3]||(S[3]=U=>l("update:search",U)),onClear:S[4]||(S[4]=U=>l("update:search",""))},{prefix:d(()=>[n(Y,{name:"Search",class:"w-3.5 h-3.5 text-system-light dark:text-gray-400"})]),_:1},8,["model-value","placeholder"]),ga(b.$slots,"search-actions")])])}}},hfe=(e=[])=>e.find(t=>t.slug==="standard")||e[0]||null,Td=({classes:e=[],activeId:t=null})=>(t?e.find(l=>l.id===t):null)||hfe(e),_fe=({classes:e=[],previousIds:t=new Set,createdSlug:a=null})=>{if(a){const l=e.find(s=>s.slug===a);if(l)return l}return e.find(l=>!t.has(l.id))||null},Jo=async({payload:e,createdSlug:t=null,currentClasses:a=[],reloadClasses:l})=>{const s=new Set((a||[]).map(p=>p.id)),i=await Ae.post("tax/classes",e),c=await l();return{response:i,classes:c,createdClass:_fe({classes:c,previousIds:s,createdSlug:t})}},Cf=async({classId:e,currentActiveId:t=null,reloadClasses:a})=>{const l=await Ae.delete("tax/classes/"+e),s=await a();return{response:l,classes:s,nextActiveClass:Td({classes:s,activeId:t})}};function an(e){return e==null||e===""?"":String(e)}const vfe={class:"setting-wrap"},gfe={class:"setting-wrap-inner"},yfe={class:"fct-single-tax-rates-country-single-page"},bfe={class:"fct-single-tax-rates-country-single"},wfe={class:"single-page-header flex items-center justify-between"},Cfe={key:0,class:"flex items-center gap-2"},kfe={key:0,class:"notices fct-notices-wrap fct-layout-width settings"},Bfe={class:"mt-3 flex justify-end"},xfe={key:1,class:"fct-base-taxes"},Sfe={class:"fct-btn-group mt-4 justify-end sm"},Ffe={class:"fct-tax-rates-country-view"},$fe={key:0},Efe={key:1},Ufe={key:0},Ife={key:1},Qfe={class:"fct-btn-group sm justify-end"},Sc={__name:"TaxRatesCountrySingle",props:{country:{type:String},group:{type:String}},setup(e){const t=e,a=T(!1),l=T([]),s=T(""),i=K(()=>!!ze.get("is_tax_enabled")),c=T([]),p=T(null),f=T("standard"),_=T(!1),g=T(null),y=T(6),v=T({id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0}),w=T({rate:0,name:""}),k=T([]),b=T({}),S=T(""),$=K(()=>{const X=S.value.trim().toLowerCase();return X?k.value.filter(we=>we.stateName&&we.stateName.toLowerCase().includes(X)):k.value}),D=K(()=>t.group==="EU"),F=K(()=>[v.value,...$.value]),B=T([]),U=T(!1),Q=T([]),V=T([]),I=T(!1),M=T(new Set),O=T(0),L=T([]),H=T(!1),j=T(!1),W=T(!1),G=T({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:"",tax_rate:0,override_state_tax:!0,class_id:0,id:"",previous_id:""}),Z=K(()=>{const X=v.value.rate||0;return[{label:u("added to")+` ${X}% `+u("federal tax"),is_compound:"0",for_order:0},{label:u("instead of")+` ${X}% `+u("federal tax"),is_compound:"0",for_order:1},{label:u("compounded on top of")+` ${X}% `+u("federal tax"),is_compound:"1",for_order:0}]}),ne=X=>String(X.is_compound)==="1"?"1_0":X.for_order==1?"0_1":"0_0",ce=(X,we)=>{const[le,he]=we.split("_");X.is_compound=le,X.for_order=parseInt(he)},z=X=>X&&X.replace(/\s*\(Standard\)\s*/gi,"").trim(),ue=T(!1),ie=T({}),J=T(!1),N=T(""),ae=T(""),oe=T(""),fe=T(!1),re=T(!1),Ee=T(!0),ye=T(!1),Ce=T(!1),ve=T(!1),Ue=K(()=>u("Toggle tax collection for %1$s",s.value||t.country)),Ke=()=>Ae.get("tax/classes").then(X=>{c.value=X.classes||[],y.value=X.max_classes||6,g.value=X.next_builtin||null;const we=Td({classes:c.value,activeId:p.value});return we&&(p.value=we.id,f.value=we.slug),c.value}).catch(X=>c.value),We=(X="")=>{if(!X)return v.value.name||"Tax";const we=k.value.find(le=>le.state===X);return we!=null&&we.name?we.name:v.value.name||"Tax"},Be=X=>{v.value={...X.federalRate},w.value={...X.federalOriginal},k.value=X.stateRows.map(we=>({...we})),b.value={...X.stateOriginals}},$e=()=>({federalRate:{...v.value},federalOriginal:{...w.value},stateRows:k.value.map(X=>({...X})),stateOriginals:{...b.value}}),He=()=>{p.value&&(ie.value[p.value]=$e())},Re=async X=>{He(),p.value=X.id,f.value=X.slug,ie.value[X.id]?(Be(ie.value[X.id]),await ht()):await qt()},yt=X=>{_.value=!0,Jo({payload:{slug:X},createdSlug:X,currentClasses:c.value,reloadClasses:Ke}).then(({response:we,createdClass:le})=>{if(q.success(we.message),le)return Re(le)}).catch(we=>{var le;q.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},gt=X=>{_.value=!0,Jo({payload:{title:X},currentClasses:c.value,reloadClasses:Ke}).then(({response:we,createdClass:le})=>{if(q.success(we.message),le)return Re(le)}).catch(we=>{var le;q.error(((le=we==null?void 0:we.data)==null?void 0:le.message)||"Failed to create tax class")}).finally(()=>{_.value=!1})},Rt=X=>{const we=p.value===X.id;ul(u("All rates for this class will be deleted. Products using it will default to Standard."),u("Delete")+" "+X.title+"?",{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Cf({classId:X.id,currentActiveId:p.value,reloadClasses:Ke}).then(({response:le,nextActiveClass:he})=>{if(delete ie.value[X.id],q.success(le.message),he)return we&&(p.value=null),Re(he)}).catch(le=>{var he;q.error(((he=le==null?void 0:le.data)==null?void 0:he.message)||"Failed to delete tax class")})}).catch(()=>{})},Tt=()=>Ae.get("address-info/get-country-info",{country_code:t.country}).then(X=>{l.value=X.states||[],s.value=X.country_name||t.country}).catch(X=>{q.error(u("Failed to load country data. Please refresh the page."))}),Dt=()=>D.value?(ae.value="",oe.value="",Promise.resolve()):(fe.value=!0,Ae.get("tax/country-tax-id/"+t.country).then(X=>{var le;const we=((le=X==null?void 0:X.tax_data)==null?void 0:le.tax_id)||"";ae.value=we,oe.value=we}).catch(X=>{var we;q.error(((we=X==null?void 0:X.data)==null?void 0:we.message)||u("Failed to load tax ID"))}).finally(()=>{fe.value=!1})),_t=({hydrateClassData:X=!0}={})=>Ae.get("tax/rates/country/rates/"+t.country).then(we=>{const le=we.tax_rates||[],he=le.filter(je=>je.for_shipping!==null),Ye=p.value?le.filter(je=>Number(je.class_id)===Number(p.value)):le;Q.value=Ye.filter(je=>!je.city&&!je.postcode).map(je=>({name:je.name,value:je.id,state:je.state||""}));const st=Qt(Ye);return ve.value=le.length>0,X&&(Be(st),He(),Ee.value=!!we.tax_enabled,Ce.value=!0),{allRates:le,shippingOverrides:he,classEntry:st}}).catch(we=>(q.error(u("Failed to load tax rates. Please refresh the page.")),{allRates:[],shippingOverrides:[],classEntry:null})),Gt=()=>Ae.get("tax/product-overrides/"+t.country).then(X=>X.overrides||[]).catch(()=>[]),bt=()=>{L.value.length>0||(H.value=!0,Ae.get("products/fetch-term").then(X=>{const we=X.taxonomies&&X.taxonomies["product-categories"]?X.taxonomies["product-categories"].terms||[]:[];L.value=we.map(le=>({...le,value:an(le.value)}))}).catch(()=>{}).finally(()=>{H.value=!1}))};let St=0;const Pt=X=>{const we=++St;return!X||Number(X)===Number(p.value)?(V.value=Q.value.slice(),I.value=!1,Promise.resolve()):(I.value=!0,V.value=[],Ae.get("tax/rates/country/rates/"+t.country,{class_id:X}).then(le=>{if(we!==St)return;const he=le.tax_rates||[];V.value=he.filter(Ye=>!Ye.city&&!Ye.postcode).map(Ye=>({name:Ye.name,value:Ye.id,state:Ye.state||""}))}).catch(()=>{we===St&&(V.value=[],q.error(u("Failed to load tax rates for the selected tax class")))}).finally(()=>{we===St&&(I.value=!1)}))},Ht=(X,we)=>{var he,Ye;const le=[];for(const st of X){const je=st.state?((he=l.value.find(et=>et.value===st.state))==null?void 0:he.name)||st.state:s.value||t.country,Xe=We(st.state||""),mt=c.value.find(et=>Number(et.id)===Number(st.class_id));le.push({id:st.id,type:"shipping",label:Xe,tax_label:Xe,category_name:"",location:je,city:st.city||"",postcode:st.postcode||"",rate:st.for_shipping,class_id:Number(st.class_id)||0,class_label:mt?mt.title:"",_raw:st})}for(const st of we){const je=st.meta_value||st,Xe=je.state||"",mt=Xe?((Ye=l.value.find(pe=>pe.value===Xe))==null?void 0:Ye.name)||Xe:s.value||t.country,et=Number(st.class_id)||0,It=et?c.value.find(pe=>Number(pe.id)===et):null;le.push({id:st.id,type:"products",label:je.category_name||"",tax_label:je.tax_label||"",category_name:je.category_name||"",location:mt,city:je.city||"",postcode:je.postcode||"",rate:je.rate,class_id:et,class_label:It?It.title:"",_raw:st})}B.value=le},Qt=X=>{const we=et=>(!et.state||et.state==="")&&(!et.city||et.city==="")&&(!et.postcode||et.postcode===""),le=X.find(we),he=X.filter(et=>et.state&&et.state!==""&&(!et.city||et.city==="")&&(!et.postcode||et.postcode===""));let Ye,st;if(le){const et=z(le.name)||"Tax";Ye={...le,name:et},st={rate:le.rate,name:et}}else Ye={id:null,rate:0,name:"Tax",state:"",is_compound:"0",for_order:0},st={rate:0,name:"Tax"};const je={};for(const et of he)je[et.state]=et;const Xe=[],mt={};for(const et of l.value){const It=je[et.value];if(It){const pe=z(It.name)||"State Tax";Xe.push({id:It.id,state:et.value,stateName:et.name,rate:It.rate,name:pe,is_compound:String(It.is_compound||"0"),for_order:It.for_order||0}),mt[et.value]={rate:It.rate,name:pe,is_compound:String(It.is_compound||"0"),for_order:It.for_order||0}}else Xe.push({id:null,state:et.value,stateName:et.name,rate:0,name:"State Tax",is_compound:"0",for_order:0}),mt[et.value]={rate:0,name:"State Tax",is_compound:"0",for_order:0}}return{federalRate:Ye,federalOriginal:st,stateRows:Xe,stateOriginals:mt}},ht=async()=>{const[{shippingOverrides:X},we]=await Promise.all([_t({hydrateClassData:!1}),Gt()]);Ht(X,we)},qt=async()=>{a.value=!0;try{const[{shippingOverrides:X},we]=await Promise.all([_t(),Gt()]);Ht(X,we)}finally{a.value=!1}},ge=async()=>{a.value=!0;try{await Promise.all([Ke(),Tt(),Dt()]),await qt()}finally{a.value=!1}},Fe=()=>{D.value||re.value||fe.value||(re.value=!0,Ae.post("tax/country-tax-id/"+t.country,{tax_id:ae.value||""}).then(X=>{oe.value=ae.value||"",q.success(X.message||u("Tax ID has been saved successfully"))}).catch(X=>{var we;q.error(((we=X==null?void 0:X.data)==null?void 0:we.message)||u("Failed to save tax ID"))}).finally(()=>{re.value=!1}))},ot=X=>{if(ye.value)return;const we=Ee.value;Ee.value=X,ye.value=!0,Ae.post("tax/country-status/"+t.country,{enabled:X?1:0}).then(le=>{Ee.value=le.enabled,q.success(le.message)}).catch(le=>{var he;Ee.value=we,q.error(((he=le==null?void 0:le.data)==null?void 0:he.message)||u("Failed to update tax status"))}).finally(()=>{ye.value=!1})},wt=async()=>{try{await ul(u("This will overwrite your current rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"})}catch{return}J.value=!0;try{const we=(await Ae.get("tax/configuration/rates")).tax_rates||{};let le=[];for(const Xe in we){const mt=we[Xe];for(const et of mt.countries||[])if(et.country_code===t.country){le=et.rates||[];break}if(le.length)break}if(!le.length){q.error(u("No preset rates found for this country"));return}const he=le.find(Xe=>(!Xe.state||Xe.state==="")&&Xe.type==="standard"),Ye=le.filter(Xe=>Xe.state&&Xe.state!==""&&Xe.type==="standard"),st=[];he&&he.rate>0&&(v.value.rate=he.rate,v.value.name=z(he.name||"")||u("Tax"),st.push(kt()));const je=[];for(const Xe of Ye){const mt=k.value.find(et=>et.state===Xe.state);mt&&(mt.rate=Xe.rate,mt.name=z(Xe.name)||u("State Tax"),mt.is_compound=Xe.compound?"1":"0",je.push(Xt(mt)))}await Promise.all([...st,...je]),He(),await ht(),q.success(u("Tax rates have been reset to defaults"))}catch{q.error(u("Failed to reset tax rates"))}finally{J.value=!1}},kt=()=>{const X={country:t.country,state:"",rate:v.value.rate,name:v.value.name||"Tax",is_compound:v.value.is_compound||"0",for_order:v.value.for_order||0,group:t.group,class_id:p.value||""};return(v.value.id?Ae.put("tax/country/rate/"+v.value.id,X):Ae.post("tax/country/rate",X)).then(le=>{le.tax_rate&&(v.value.id=le.tax_rate.id),w.value={rate:v.value.rate,name:v.value.name}})},Xt=X=>{const we={country:t.country,state:X.state,rate:X.rate,name:X.name,is_compound:X.is_compound,for_order:X.for_order,group:t.group,class_id:p.value||""};return(X.id?Ae.put("tax/country/rate/"+X.id,we):Ae.post("tax/country/rate",we)).then(he=>{he.tax_rate&&(X.id=he.tax_rate.id),b.value[X.state]={rate:X.rate,name:X.name,is_compound:String(X.is_compound),for_order:X.for_order}})},vt=async()=>{ue.value=!0;try{const X=[];(String(v.value.rate)!==String(w.value.rate)||v.value.name!==w.value.name)&&X.push(kt());for(const le of k.value){const he=b.value[le.state];(!he||String(le.rate)!==String(he.rate)||le.name!==he.name||String(le.is_compound)!==String(he.is_compound)||le.for_order!=he.for_order)&&X.push(Xt(le))}await Promise.all(X),He(),await ht(),q.success(u("Tax rates saved"))}catch{q.error(u("Failed to save rates"))}finally{ue.value=!1}},ea=()=>{M.value=new Set,O.value=0},ta=()=>{const X=We();W.value=!1,G.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",state:"__country__",city:"",postcode:"",tax_label:X,tax_rate:0,override_state_tax:!0,class_id:Number(p.value)||0,id:"",previous_id:""},N.value=X,V.value=Q.value.slice(),U.value=!0,bt()},zt=X=>{if(W.value=!0,bt(),X.type==="shipping"){const we=X._raw.state||"",le=We(we),he=Number(X._raw.class_id)||Number(p.value)||0;G.value={type:"shipping",original_type:"shipping",original_id:X.id,category_id:"",category_name:"",state:we||"__country__",city:X._raw.city||"",postcode:X._raw.postcode||"",tax_label:le,tax_rate:X.rate,override_state_tax:!0,class_id:he,id:X.id,previous_id:X.id},N.value=le,O.value=he,Pt(he);const Ye=X._raw.city||"",st=X._raw.postcode||"",je=new Set;for(const Xe of B.value)Xe.type==="shipping"&&(Xe._raw.state||"")===we&&(Xe._raw.city||"")===Ye&&(Xe._raw.postcode||"")===st&&je.add(Number(Xe.class_id));M.value=je}else{const we=X._raw.meta_value||X._raw,le=we.state||"",he=We(le),Ye=X.tax_label||he;G.value={type:"products",original_type:"products",original_id:X.id,category_id:an(we.category_id),category_name:X.category_name,state:le||"__country__",tax_label:Ye,tax_rate:X.rate,override_state_tax:we.override_state_tax==="yes",city:we.city||"",postcode:we.postcode||"",class_id:X.class_id||0,id:X.id,previous_id:""},N.value=he}U.value=!0},wa=K(()=>{const X=[{label:s.value||t.country,value:"__country__"}];for(const we of l.value)X.push({label:we.name,value:we.value});return X}),qa=K(()=>{if(!V.value.length)return wa.value;const X=new Set(V.value.map(we=>we.state||""));return wa.value.filter(we=>{const le=we.value==="__country__"?"":we.value;return X.has(le)})}),il=X=>{const we=an(X),le=L.value.find(he=>he.value===we);le&&(G.value.category_name=le.label)},Ya=X=>{ul(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const we=X.type==="shipping"?"tax/rates/country/override/"+X.id:"tax/product-overrides/"+X.id;Ae.delete(we).then(le=>{q.success(le.message),B.value=B.value.filter(he=>!(he.id===X.id&&he.type===X.type))}).catch(le=>{var he;q.error(((he=le==null?void 0:le.data)==null?void 0:he.message)||u("Failed to delete override"))})}).catch(()=>{})},ma=async()=>{var we;const X=G.value.state==="__country__"?"":G.value.state;if(G.value.type==="products"&&!G.value.category_id){q.error(u("Please select a category"));return}if(G.value.type==="shipping"){if(!G.value.class_id){q.error(u("Please select a tax class"));return}if(I.value){q.error(u("Please wait for the province rates to finish loading"));return}const le=V.value.find(he=>(he.state||"")===X);G.value.id=le?le.value:0}j.value=!0;try{let le;if(G.value.type==="products"){const he=G.value.state==="__country__"?"":G.value.state;le=await Ae.post("tax/product-overrides",{id:W.value&&G.value.original_type==="products"?G.value.original_id:"",source_type:G.value.original_type,source_id:G.value.original_id,country:t.country,state:he,category_id:G.value.category_id,category_name:G.value.category_name,tax_label:G.value.tax_label,rate:G.value.tax_rate,override_state_tax:G.value.override_state_tax===!0?"yes":"no",city:G.value.city||"",postcode:G.value.postcode||"",class_id:G.value.class_id||0})}else le=await Ae.post("tax/rates/country/override",{id:G.value.id,country:t.country,state:X,previous_id:W.value&&G.value.original_type==="shipping"?G.value.previous_id:"",source_type:G.value.original_type,source_id:G.value.original_id,class_id:G.value.class_id||p.value||"",override_tax_rate:G.value.tax_rate,city:G.value.city||"",postcode:G.value.postcode||""});q.success(le.message),U.value=!1,await ht()}catch(le){const he=((we=le==null?void 0:le.data)==null?void 0:we.message)||(le==null?void 0:le.message)||"Failed to save override";q.error(he)}finally{j.value=!1}};return be(()=>G.value.type,X=>{X==="shipping"&&(G.value.class_id||(G.value.class_id=p.value||0),Pt(G.value.class_id))}),be(()=>G.value.class_id,X=>{G.value.type!=="shipping"||!U.value||Pt(X).then(()=>{const we=G.value.state==="__country__"?"":G.value.state,le=V.value.map(he=>he.state||"");we!==""&&!le.includes(we)&&(G.value.state="__country__")})}),be(()=>G.value.state,X=>{if(!U.value||G.value.type!=="products"||W.value)return;const we=We(X==="__country__"?"":X);(!G.value.tax_label||G.value.tax_label===N.value)&&(G.value.tax_label=we),N.value=we}),Ie(()=>{ge()}),(X,we)=>{const le=C("el-breadcrumb-item"),he=C("el-breadcrumb"),Ye=C("el-switch"),st=C("el-skeleton"),je=C("el-input"),Xe=C("el-form-item"),mt=C("el-form"),et=C("el-button"),It=C("el-table-column"),pe=C("el-option"),_e=C("el-select"),Oe=C("el-table"),Me=C("el-tag"),ct=C("el-radio"),ee=C("el-radio-group"),Ne=C("el-checkbox"),pt=C("el-dialog");return r(),h("div",vfe,[o("div",gfe,[o("div",yfe,[o("div",bfe,[o("div",wfe,[n(he,{class:"mb-0","separator-icon":A(Al)},{default:d(()=>[e.group==="EU"?(r(),E(le,{key:0,to:{name:"eu"}},{default:d(()=>[R(m(A(u)("Tax Regions")),1)]),_:1})):(r(),E(le,{key:1,to:{name:"tax_rates"}},{default:d(()=>[R(m(A(u)("Tax Regions")),1)]),_:1})),n(le,null,{default:d(()=>[R(m(s.value||e.country),1)]),_:1})]),_:1},8,["separator-icon"]),Ce.value&&ve.value?(r(),h("div",Cfe,[i.value?(r(),h("span",{key:0,class:de(["text-sm",Ee.value?"text-success-500":"text-system-mid dark:text-gray-300"])},m(Ee.value?A(u)("Collecting tax"):A(u)("Disabled")),3)):x("",!0),n(Ye,{"model-value":i.value?Ee.value:!1,loading:ye.value,disabled:!i.value,"aria-label":Ue.value,onChange:ot},null,8,["model-value","loading","disabled","aria-label"])])):x("",!0)]),!a.value&&!i.value?(r(),h("div",kfe,[n(el,{type:"warning",icon:"AlertTriangle",content:A(u)("Tax is currently disabled. Enable tax from the Tax Settings page to start collecting tax.")},null,8,["content"])])):x("",!0),D.value?x("",!0):(r(),E(Se,{key:1},{default:d(()=>[n(ke,null,{default:d(()=>[fe.value?(r(),E(st,{key:0,animated:"",rows:2})):(r(),E(mt,{key:1,"label-position":"top"},{default:d(()=>[n(Xe,{label:A(u)("VAT/GST/Tax Number"),class:"mb-0"},{default:d(()=>[n(je,{modelValue:ae.value,"onUpdate:modelValue":we[0]||(we[0]=De=>ae.value=De),placeholder:A(u)("VAT/GST/Tax Number"),maxlength:"255"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})),o("div",Bfe,[n(et,{type:"primary",size:"small",loading:re.value,disabled:fe.value||re.value||ae.value===oe.value,onClick:Fe},{default:d(()=>[R(m(A(u)("Save")),1)]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Base taxes")},null,8,["title"]),n(ke,null,{default:d(()=>[n(el,{type:"info"},{content:d(()=>[o("span",null,m(A(u)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+m(A(u)("button to add tax classes.")),1)]),_:1}),a.value?(r(),E(ofe,{key:0})):(r(),h("div",xfe,[n(wf,{classes:c.value,"active-id":p.value,"max-classes":y.value,creating:_.value,search:S.value,onSwitch:Re,onDelete:Rt,onAdd:yt,onCreateCustom:gt,"onUpdate:search":we[1]||(we[1]=De=>S.value=De)},null,8,["classes","active-id","max-classes","creating","search"]),n(Oe,{data:F.value,class:"w-full fct-tax-rates-table","max-height":"450"},{default:d(()=>[n(It,{label:A(u)("Region")},{default:d(({row:De})=>[o("span",{class:de(["fct-base-taxes__region-name",De.state?"":"fct-base-taxes__region-name--federal"])},m(De.state?De.stateName:s.value||e.country),3)]),_:1},8,["label"]),n(It,{label:A(u)("Rate"),width:"130"},{default:d(({row:De})=>[n(je,{modelValue:De.rate,"onUpdate:modelValue":xt=>De.rate=xt,size:"small",type:"number",step:"0.01",min:"0"},{suffix:d(()=>we[18]||(we[18]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"]),n(It,{label:A(u)("Tax Label"),width:"200"},{default:d(({row:De})=>[n(je,{modelValue:De.name,"onUpdate:modelValue":xt=>De.name=xt,size:"small",placeholder:A(u)("Tax name")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(r(),E(It,{key:0,label:A(u)("Compound"),width:"310"},{default:d(({row:De})=>[De.state?(r(),E(_e,{key:0,"model-value":ne(De),size:"small",style:{width:"100%"},onChange:xt=>ce(De,xt)},{default:d(()=>[n(pe,{value:"0_0",label:Z.value[0].label},null,8,["label"]),n(pe,{value:"0_1",label:Z.value[1].label},null,8,["label"]),n(pe,{value:"1_0",label:Z.value[2].label},null,8,["label"])]),_:2},1032,["model-value","onChange"])):x("",!0)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"]),o("div",Sfe,[f.value==="standard"?(r(),E(et,{key:0,loading:J.value,size:"small",onClick:wt,type:"danger",soft:""},{default:d(()=>[R(m(A(u)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),n(et,{type:"primary",size:"small",loading:ue.value,onClick:vt},{default:d(()=>[R(m(A(u)("Save Rates")),1)]),_:1},8,["loading"])])]))]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(et,{size:"small",onClick:ta},{default:d(()=>[R(m(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[o("div",Ffe,[n(Oe,{data:B.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n(It,{label:A(u)("Type"),width:"110"},{default:d(({row:De})=>[n(Me,{type:De.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(m(De.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n(It,{label:A(u)("Category")},{default:d(({row:De})=>[R(m(De.category_name||"—"),1)]),_:1},8,["label"]),n(It,{label:A(u)("Tax Label")},{default:d(({row:De})=>[R(m(De.tax_label||"—"),1)]),_:1},8,["label"]),n(It,{label:A(u)("Location")},{default:d(({row:De})=>[R(m(De.location),1)]),_:1},8,["label"]),n(It,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:De})=>[De.type==="products"?(r(),h("span",$fe,m(De.class_label||A(u)("All")),1)):(r(),h("span",Efe,m(De.class_label||"—"),1))]),_:1},8,["label"]),n(It,{label:A(u)("City / Postcode")},{default:d(({row:De})=>[De.city||De.postcode?(r(),h("span",Ufe,m([De.city,De.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",Ife,"—"))]),_:1},8,["label"]),n(It,{label:A(u)("Rate"),width:"100"},{default:d(({row:De})=>[R(m(De.rate)+"% ",1)]),_:1},8,["label"]),n(It,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:De})=>[o("div",Qfe,[n(at,{tag:"button",size:"small",onClick:xt=>zt(De)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(at,{tag:"button",size:"small",onClick:xt=>Ya(De),bg:"danger",outline:""},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])])]),_:1})]),_:1}),n(pt,{modelValue:U.value,"onUpdate:modelValue":we[17]||(we[17]=De=>U.value=De),title:(W.value?A(u)("Edit tax override for"):A(u)("Add tax override for"))+" "+(s.value||e.country),width:"520px","append-to-body":!0,onClose:ea},{footer:d(()=>[n(et,{onClick:we[16]||(we[16]=De=>U.value=!1)},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(et,{type:"primary",loading:j.value,onClick:ma},{default:d(()=>[R(m(W.value?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(mt,{"label-position":"top",model:G.value},{default:d(()=>[n(Xe,{label:A(u)("Override type")},{default:d(()=>[n(ee,{modelValue:G.value.type,"onUpdate:modelValue":we[2]||(we[2]=De=>G.value.type=De)},{default:d(()=>[n(ct,{value:"products"},{default:d(()=>[R(m(A(u)("Products")),1)]),_:1}),n(ct,{value:"shipping"},{default:d(()=>[R(m(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),G.value.type==="products"?(r(),h(P,{key:0},[n(Xe,{label:A(u)("Category")},{default:d(()=>[n(_e,{modelValue:G.value.category_id,"onUpdate:modelValue":we[3]||(we[3]=De=>G.value.category_id=De),filterable:"",placeholder:A(u)("Select a category"),loading:H.value,style:{width:"100%"},onChange:il},{default:d(()=>[(r(!0),h(P,null,te(L.value,De=>(r(),E(pe,{key:De.value,label:De.label,value:De.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Tax Class")},{default:d(()=>[n(_e,{modelValue:G.value.class_id,"onUpdate:modelValue":we[4]||(we[4]=De=>G.value.class_id=De),style:{width:"100%"}},{default:d(()=>[n(pe,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,te(c.value,De=>(r(),E(pe,{key:De.id,value:Number(De.id),label:De.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Tax label")},{default:d(()=>[n(je,{modelValue:G.value.tax_label,"onUpdate:modelValue":we[5]||(we[5]=De=>G.value.tax_label=De),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Location")},{default:d(()=>[n(_e,{modelValue:G.value.state,"onUpdate:modelValue":we[6]||(we[6]=De=>G.value.state=De),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(wa.value,De=>(r(),E(pe,{key:De.value,label:De.label,value:De.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("City (optional)")},{default:d(()=>[n(je,{modelValue:G.value.city,"onUpdate:modelValue":we[7]||(we[7]=De=>G.value.city=De),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(je,{modelValue:G.value.postcode,"onUpdate:modelValue":we[8]||(we[8]=De=>G.value.postcode=De),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(je,{modelValue:G.value.tax_rate,"onUpdate:modelValue":we[9]||(we[9]=De=>G.value.tax_rate=De),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),k.value.length>0?(r(),E(Xe,{key:0},{default:d(()=>[n(Ne,{modelValue:G.value.override_state_tax,"onUpdate:modelValue":we[10]||(we[10]=De=>G.value.override_state_tax=De)},{default:d(()=>[R(m(A(u)("Also override state/provincial taxes")),1)]),_:1},8,["modelValue"])]),_:1})):x("",!0)],64)):(r(),h(P,{key:1},[n(Xe,{label:A(u)("Tax Class")},{default:d(()=>[n(_e,{modelValue:G.value.class_id,"onUpdate:modelValue":we[11]||(we[11]=De=>G.value.class_id=De),style:{width:"100%"},loading:I.value},{default:d(()=>[(r(!0),h(P,null,te(c.value,De=>(r(),E(pe,{key:De.id,value:Number(De.id),label:De.title,disabled:W.value&&Number(De.id)!==Number(O.value)&&M.value.has(Number(De.id))},null,8,["value","label","disabled"]))),128))]),_:1},8,["modelValue","loading"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Location")},{default:d(()=>[n(_e,{modelValue:G.value.state,"onUpdate:modelValue":we[12]||(we[12]=De=>G.value.state=De),placeholder:A(u)("Select location"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(qa.value,De=>(r(),E(pe,{key:De.value,label:De.label,value:De.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("City (optional)")},{default:d(()=>[n(je,{modelValue:G.value.city,"onUpdate:modelValue":we[13]||(we[13]=De=>G.value.city=De),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(je,{modelValue:G.value.postcode,"onUpdate:modelValue":we[14]||(we[14]=De=>G.value.postcode=De),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(Xe,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(je,{modelValue:G.value.tax_rate,"onUpdate:modelValue":we[15]||(we[15]=De=>G.value.tax_rate=De),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])])])])}}};class Dfe extends Vs{getTabs(){return{all:u("All"),filed:u("Filed"),not_filed:u("Not Filed")}}getToggleableColumns(){return[{label:"ID",value:"id"},{label:"Order ID",value:"order_id"},{label:"Zip Code",value:"postcode"},{label:"Tax Rate",value:"rate"},{label:"Filed",value:"filed_at"}]}getSearchHint(){return u("Search by id, title, content or module.")}getFetchUrl(){return"taxes"}parseResponse(t){return t.taxes}getTableName(){return"taxes_table"}with(){return["admin_tax_report"]}scopes(){return["validOrder"]}}function Vfe(e){return Dfe.init(e)}const Tfe=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),Mfe=e=>{const t=Object.keys(e[0]),l=[t.map(Tfe).join(",")];return e.forEach(s=>{const i=t.map(c=>{let p=s[c];return typeof p=="object"&&(p=JSON.stringify(p)),typeof p=="string"&&(p=`"${p.replace(/"/g,'""')}"`),p});l.push(i.join(","))}),l.join(` | |
| 285 | +`)},Lfe=(e,t="export.csv")=>new Promise((a,l)=>{try{if(!e||!e.length)throw new Error("No data to export");const s=Mfe(e),i=new Blob([s],{type:"text/csv"}),c=document.createElement("a"),p=()=>{window.removeEventListener("focus",p),a()};window.addEventListener("focus",p),c.href=URL.createObjectURL(i),c.download=t,c.click(),URL.revokeObjectURL(c.href),setTimeout(()=>{a()},200)}catch(s){l(s)}}),Rfe={class:"table-cell"},Ofe={class:"table-cell"},Pfe={class:"table-cell"},Hfe={class:"table-cell"},Nfe={class:"table-cell"},Kfe={class:"table-cell"},Gfe={class:"table-cell"},zfe={class:"table-cell"},jfe={class:"table-cell"},qfe={__name:"TaxesLoader",props:{nextPageCount:{type:Number,default:0},taxTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-table-column"),c=C("el-skeleton-item"),p=C("el-skeleton"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table full-compact"},{default:d(()=>[n(i,{type:"selection",width:45}),e.taxTable.isColumnVisible("id")?(r(),E(i,{key:0,width:100,label:A(u)("ID")},{default:d(()=>[o("div",Rfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),e.taxTable.isColumnVisible("order_id")?(r(),E(i,{key:1,label:A(u)("Order ID"),width:100},{default:d(()=>[o("div",Ofe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(i,{label:A(u)("Tax Country"),width:120},{default:d(()=>[o("div",Pfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),n(i,{label:A(u)("Tax Region"),width:120},{default:d(()=>[o("div",Hfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("postcode")?(r(),E(i,{key:2,label:A(u)("Zip Code"),width:120},{default:d(()=>[o("div",Nfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(i,{label:A(u)("Tax Name"),width:120},{default:d(()=>[o("div",Kfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("rate")?(r(),E(i,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(()=>[o("div",Gfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(i,{label:A(u)("Sale Taxes"),width:120},{default:d(()=>[o("div",zfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"]),e.taxTable.isColumnVisible("filed_at")?(r(),E(i,{key:4,label:A(u)("Filed"),width:120},{default:d(()=>[o("div",jfe,[n(p,{animated:""},{template:d(()=>[n(c,{variant:"p"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},Yfe={class:"table-cell"},Wfe={class:"table-cell"},Jfe={class:"table-cell"},Xfe={class:"table-cell"},Zfe={class:"table-cell"},eme={class:"table-cell"},tme={class:"table-cell"},ame={class:"table-cell"},lme={class:"table-cell"},sme={__name:"AllCouponsLoader",props:{nextPageCount:{type:Number,default:0},couponTable:{type:Object,default:()=>({})}},setup(e){const t=e,a=Array.from({length:t.nextPageCount},(l,s)=>s+1);return(l,s)=>{const i=C("el-skeleton-item"),c=C("el-skeleton"),p=C("el-table-column"),f=C("el-table");return r(),E(f,{data:A(a),class:"w-full compact-table responsive full-compact"},{default:d(()=>[n(p,{width:103,label:A(u)("ID")},{default:d(()=>[o("div",Yfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("title")?(r(),E(p,{key:0,label:A(u)("Title"),width:227},{default:d(()=>[o("div",Wfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[180px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(p,{label:A(u)("Code"),width:206},{default:d(()=>[o("div",Jfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[130px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Amount"),width:124},{default:d(()=>[o("div",Xfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Usage"),width:155},{default:d(()=>[o("div",Zfe,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[100px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("stackable")?(r(),E(p,{key:1,label:A(u)("Stackable"),width:124},{default:d(()=>[o("div",eme,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[80px]"})]),_:1})])]),_:1},8,["label"])):x("",!0),n(p,{label:A(u)("Status"),width:124},{default:d(()=>[o("div",tme,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),n(p,{label:A(u)("Expiry Date"),width:124},{default:d(()=>[o("div",ame,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[90px]"})]),_:1})])]),_:1},8,["label"]),e.couponTable.isColumnVisible("actions")?(r(),E(p,{key:2,label:A(u)("Actions"),width:103,align:"right"},{default:d(()=>[o("div",lme,[n(c,{animated:""},{template:d(()=>[n(i,{variant:"p",class:"w-[70px]"})]),_:1})])]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])}}},nme={class:"fct-taxes-page fct-layout-width"},ome={key:1},ime={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},rme={class:"fct-tax-filing-wrap"},dme={class:"fct-tax-filing-summary"},ume={class:"summary-item"},cme={class:"summary-label"},Ame={class:"summary-value"},pme={class:"summary-item"},fme={class:"summary-label"},mme={class:"summary-value"},hme={class:"fct-tax-filing max-h-[400px] overflow-y-auto"},_me={style:{display:"flex","flex-wrap":"wrap","align-items":"center",gap:"4px"}},vme={class:"dialog-footer"},gme={class:"fct-tax-filing-success-wrap"},yme={class:"fct-tax-filling-success-icon"},bme={class:"dialog-footer"},wme={__name:"Taxes",setup(e){const t=Object.fromEntries(ym.map(B=>[B.value,B.label])),a=B=>t[B]||B;Jt().ctx;const l=Vfe(),s=T(!1),i=T(!1),c=T(!1),p=T([]),f=K(()=>l.getTableData().map(B=>{var U,Q,V,I,M,O,L,H,j,W,G;return{id:B.id,order_id:B.order_id,country:a(((U=B.tax_rate)==null?void 0:U.country)??((Q=B.meta)==null?void 0:Q.tax_country)??""),state:((V=B.tax_rate)==null?void 0:V.formatted_state)??((I=B.tax_rate)==null?void 0:I.state)??"",postcode:((M=B.tax_rate)==null?void 0:M.postcode)??"",name:((O=B.tax_rate)==null?void 0:O.name)??((L=B.meta)==null?void 0:L.label)??"",reverse_charge:!!((H=B.meta)!=null&&H.reverse_charge_applied),rate:((j=B.tax_rate)==null?void 0:j.rate)??((W=B.meta)==null?void 0:W.rate_percent)??"",total_tax:String(parseFloat((B.total_tax/100).toFixed(2))),currency:((G=B.order)==null?void 0:G.currency)||"",total_tax:String(parseFloat((B.total_tax/100).toFixed(2))),filed_at:B.filed_at?u("Yes"):u("No")}})),_=()=>{s.value=!0,i.value=!1},g=()=>{s.value=!1,i.value=!0},y=async()=>{try{await Lfe($.value),g()}catch{}},v=()=>{i.value=!1},w=()=>{const B=$.value.map(U=>U.id);Ae.post(l.getFetchUrl(),{ids:B}).then(U=>{q.success(U.message),l.fetch()}).catch(U=>{q.error(U)}).finally(()=>{v()})},k=B=>{p.value=B,c.value=B.length>0},b=B=>{$.value=B},S=T(null),$=T([]),D=K(()=>{const B=$.value.reduce((Q,V)=>Q+parseFloat(V.total_tax||0),0),U=[...new Set($.value.map(Q=>Q.order_id))];return{totalTax:ft.formatNumber(Math.round(B*100),!1),totalOrders:U.length,items:$.value}}),F=()=>{xe(()=>{$.value=[...p.value],p.value.forEach(B=>{S.value.toggleRowSelection(B,!0)})})};return(B,U)=>{const Q=C("el-button"),V=C("el-tooltip"),I=C("el-table-column"),M=C("router-link"),O=C("el-tag"),L=C("el-table"),H=C("el-dialog");return r(),h("div",nme,[n(ol,{title:A(u)("Taxes")},{action:d(()=>[c.value?(r(),E(Q,{key:1,type:"primary",onClick:_,disabled:!c.value},{default:d(()=>[R(m(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])):(r(),E(V,{key:0,"popper-class":"fct-tooltip",effect:"dark",content:A(u)("Please select the taxes you want to file"),placement:"top-start"},{default:d(()=>[n(Q,{type:"primary",disabled:!c.value},{default:d(()=>[R(m(A(u)("Tax Filing")),1)]),_:1},8,["disabled"])]),_:1},8,["content"]))]),_:1},8,["title"]),n(Ts,{table:A(l),"has-mobile-slot":!1},{default:d(()=>[A(l).isLoading()?(r(),E(qfe,{key:0,taxTable:A(l),"next-page-count":A(l).nextPageCount},null,8,["taxTable","next-page-count"])):(r(),h("div",ome,[n(L,{class:"w-full",data:f.value,onSelectionChange:k},{empty:d(()=>[n(Ct,{icon:"Empty/ListView","has-dark":!0,text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(I,{type:"selection",width:45}),A(l).isColumnVisible("id")?(r(),E(I,{key:0,label:A(u)("ID"),width:100},{default:d(j=>[o("span",null,"#"+m(A(u)(j.row.id)),1)]),_:1},8,["label"])):x("",!0),A(l).isColumnVisible("order_id")?(r(),E(I,{key:1,label:A(u)("Order ID"),width:100},{default:d(j=>[o("span",ime,[n(M,{class:"link",to:{name:"view_order",params:{order_id:j.row.order_id}}},{default:d(()=>[R(" #"+m(j.row.order_id),1)]),_:2},1032,["to"]),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(m(A(u)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"])):x("",!0),n(I,{label:A(u)("Tax Country"),width:120},{default:d(j=>[o("span",null,m(j.row.country),1)]),_:1},8,["label"]),n(I,{label:A(u)("Tax Region"),width:120},{default:d(j=>[o("span",null,m(j.row.state),1)]),_:1},8,["label"]),A(l).isColumnVisible("postcode")?(r(),E(I,{key:2,label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,m(j.row.postcode),1)]),_:1},8,["label"])):x("",!0),n(I,{label:A(u)("Tax Name"),width:120},{default:d(j=>[o("span",null,m(j.row.name),1)]),_:1},8,["label"]),A(l).isColumnVisible("rate")?(r(),E(I,{key:3,label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,m(j.row.rate)+"%",1)]),_:1},8,["label"])):x("",!0),n(I,{label:A(u)("Sale Taxes"),width:120},{default:d(j=>[o("span",null,m(A(ft).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"]),A(l).isColumnVisible("filed_at")?(r(),E(I,{key:4,label:A(u)("Filed"),width:120},{default:d(j=>[o("span",null,m(j.row.filed_at),1)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"]),n(H,{modelValue:s.value,"onUpdate:modelValue":U[1]||(U[1]=j=>s.value=j),title:A(u)("Tax Filing"),onOpen:F,class:"fct-tax-filling-modal"},{footer:d(()=>[o("div",vme,[n(Q,{onClick:U[0]||(U[0]=()=>{s.value=!1})},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:y},{default:d(()=>[n(Y,{name:"Download",style:{width:"16px",height:"16px"}}),R(" "+m(A(u)("Download & Continue")),1)]),_:1})])]),default:d(()=>[o("div",rme,[o("div",dme,[o("div",ume,[o("span",cme,m(A(u)("Taxable Amount")),1),o("span",Ame,m(D.value.totalTax),1)]),o("div",pme,[o("span",fme,m(A(u)("Total Orders")),1),o("span",mme,m(A(u)(D.value.totalOrders)),1)])]),o("div",hme,[n(L,{ref_key:"selectedTaxesTableRef",ref:S,data:p.value,onSelectionChange:b},{empty:d(()=>[n(Ct,{icon:"Empty/ListView",text:A(u)("We could't find any taxes matching your filter.")},null,8,["text"])]),default:d(()=>[n(I,{type:"selection",width:45}),n(I,{label:A(u)("ID"),width:100},{default:d(j=>[o("span",null,m(j.row.id),1)]),_:1},8,["label"]),n(I,{label:A(u)("Order ID"),"min-width":100},{default:d(j=>[o("span",_me,[o("span",null,m(j.row.order_id),1),j.row.reverse_charge?(r(),E(O,{key:0,type:"warning",size:"small","disable-transitions":""},{default:d(()=>[R(m(A(u)("Reverse Charge")),1)]),_:1})):x("",!0)])]),_:1},8,["label"]),n(I,{width:120,label:A(u)("Tax Country")},{default:d(j=>[o("span",null,m(j.row.country),1)]),_:1},8,["label"]),n(I,{width:120,label:A(u)("Tax Region")},{default:d(j=>[o("span",null,m(j.row.state),1)]),_:1},8,["label"]),n(I,{label:A(u)("Zip Code"),width:120},{default:d(j=>[o("span",null,m(j.row.postcode),1)]),_:1},8,["label"]),n(I,{width:120,label:A(u)("Tax Name")},{default:d(j=>[o("span",null,m(j.row.name),1)]),_:1},8,["label"]),n(I,{label:A(u)("Tax Rate"),width:120},{default:d(j=>[o("span",null,m(j.row.rate)+"%",1)]),_:1},8,["label"]),n(I,{width:150,label:A(u)("Sale Taxes")},{default:d(j=>[o("span",null,m(A(ft).formatForOrder(j.row.total_tax_cents,j.row.currency)),1)]),_:1},8,["label"])]),_:1},8,["data"])])])]),_:1},8,["modelValue","title"]),n(H,{modelValue:i.value,"onUpdate:modelValue":U[2]||(U[2]=j=>i.value=j),class:"fct-tax-filling-success-modal","close-on-click-modal":!1},{footer:d(()=>[o("div",bme,[n(Q,{onClick:v},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(Q,{type:"primary",onClick:w},{default:d(()=>[R(m(A(u)("Mark as Filed")),1)]),_:1})])]),default:d(()=>[o("div",gme,[o("div",yme,[n(Y,{name:"CheckCircleFill"})]),o("div",null,[o("h4",null,m(A(u)("Don't Forget to Save Your Tax File")),1),o("p",null,m(A(u)("You're about to mark this tax report as filed.")),1),o("p",null,[R(m(A(u)("Make sure you've downloaded and saved the CSV file for your records before proceeding."))+" ",1),o("a",{onClick:Ge(y,["prevent"]),class:"cursor-pointer"},m(A(u)("Download Again")),1)])])])]),_:1},8,["modelValue"])])}}},Cme={class:"fct-card fct-card-border fct-vat-card"},kme={class:"fct-card-body"},Bme={class:"fct-vat-card-header"},xme={class:"fct-vat-card-title"},Sme={class:"fct-card fct-card-border fct-vat-card mt-5"},Fme={class:"fct-card-body"},$me={class:"fct-vat-card-header"},Eme={class:"fct-vat-card-title"},Ume={class:"fct-tax-rates-country-view"},Ime={class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},Qme={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-3 border-b border-gray-200 dark:border-dark-300"},Dme={__name:"EUVatSettingsLoader",setup(e){const t=[1,2,3];return(a,l)=>(r(),h("div",null,[o("div",Cme,[o("div",kme,[o("div",Bme,[o("div",xme,[o("h3",null,m(A(u)("Collect VAT cross-border")),1)])]),l[0]||(l[0]=o("div",{class:"fct-vat-card-body"},[o("div",{class:"fct-sk w-[200px] h-3 rounded-xs"}),o("div",{class:"fct-sk w-full h-3 rounded-xs mt-3"})],-1))])]),o("div",Sme,[o("div",Fme,[o("div",$me,[o("div",Eme,[o("h3",null,m(A(u)("Tax overrides")),1)])]),o("div",Ume,[o("div",Ime,[o("div",Qme,[(r(),h(P,null,te(6,s=>o("div",{key:"header-"+s,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,te(t,s=>o("div",{key:"override-row-"+s,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_80px] gap-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},l[1]||(l[1]=[Dn('<div class="fct-sk w-16 h-6 rounded-full"></div><div class="fct-sk w-28 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-24 h-3.5 rounded-xs"></div><div class="fct-sk w-12 h-3.5 rounded-xs"></div><div class="fct-sk w-4 h-4 rounded-xs justify-self-end"></div>',6)]))),64))])])])])]))}},Vme={class:"fct-modal-body"},Tme={class:"fct-radio-option-fields"},Mme={class:"form-note"},Lme={class:"fct-radio-option-fields"},Rme={class:"fct-radio-option-fields-desc"},Ome={class:"form-note"},Pme={key:0,class:"fct-info-box mt-3"},Hme={class:"text-xs text-system-mid"},Nme={class:"fct-radio-option-fields"},Kme={class:"fct-radio-option-fields-desc"},Gme={__name:"EUVatCrossBorderModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},currentForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=T({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=T(!1);be(()=>a.modelValue,_=>{if(_){const g=a.initialRegistrations.length?a.initialRegistrations[0]:null,y=g?g.country:"",v=g&&g.vat||"",w=a.currentForm||{};s.value={method:w.method||"oss",oss_country:w.oss_country||y,oss_vat:w.oss_vat||v,home_country:w.home_country||y,home_vat:w.home_vat||v}}else s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}});function c(_){const g=a.countries.find(y=>y.value===_);return g?parseFloat(g.default_rate||0):0}function p(){return a.initialRegistrations.some(_=>_.country===s.value.home_country)}function f(){if(!s.value.method){q.error(u("Select a cross-border registration type"));return}if(s.value.method==="oss"){if(!s.value.oss_country){q.error(u("Select your country of OSS registration"));return}}else if(s.value.method==="home"&&!s.value.home_country){q.error(u("Select your country of registration"));return}i.value=!0,(s.value.method==="home"&&!p()?Ae.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.home_country,vat:s.value.home_vat,rate:c(s.value.home_country)}):Promise.resolve()).then(()=>Ae.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:s.value})).then(g=>{q.success(g.message),l("saved",{method:s.value.method,oss_country:s.value.oss_country,oss_vat:s.value.oss_vat,home_country:s.value.home_country,home_country_vat:s.value.home_vat}),l("update:modelValue",!1)}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{i.value=!1})}return(_,g)=>{const y=C("el-radio"),v=C("el-option"),w=C("el-select"),k=C("el-form-item"),b=C("el-input"),S=C("el-radio-group"),$=C("el-form"),D=C("el-button"),F=C("el-dialog");return r(),E(F,{"model-value":e.modelValue,title:A(u)("Collect across the EU"),width:"760px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":g[9]||(g[9]=B=>l("update:modelValue",B))},{footer:d(()=>[n(D,{onClick:g[8]||(g[8]=B=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(D,{type:"primary",onClick:f,loading:i.value},{default:d(()=>[R(m(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",Vme,[n($,{"label-position":"top"},{default:d(()=>[n(S,{modelValue:s.value.method,"onUpdate:modelValue":g[7]||(g[7]=B=>s.value.method=B),class:"fct-cross-border-radios"},{default:d(()=>[o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="oss"}]),onClick:g[2]||(g[2]=B=>s.value.method="oss")},[n(y,{value:"oss"},{default:d(()=>[R(m(A(u)("Collect using a One Stop Shop (OSS) registration")),1)]),_:1}),n(ya,{accordion:"",visible:s.value.method==="oss"},{default:d(()=>[o("div",Tme,[n(k,{label:A(u)("Country of OSS registration")},{default:d(()=>[n(w,{modelValue:s.value.oss_country,"onUpdate:modelValue":g[0]||(g[0]=B=>s.value.oss_country=B),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(P,null,te(e.countries,B=>(r(),E(v,{key:B.value,label:B.label,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(b,{modelValue:s.value.oss_vat,"onUpdate:modelValue":g[1]||(g[1]=B=>s.value.oss_vat=B),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Mme,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"])])]),_:1},8,["visible"])],2),o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="home"}]),onClick:g[5]||(g[5]=B=>s.value.method="home")},[n(y,{value:"home"},{default:d(()=>[R(m(A(u)("Collect using your home country registration")),1)]),_:1}),n(ya,{accordion:"",visible:s.value.method==="home"},{default:d(()=>[o("div",Lme,[o("p",Rme,m(A(u)("Applies to micro-businesses located in one EU country and making less than €10,000 in sales to other EU countries each year")),1),n(k,{label:A(u)("Country of registration")},{default:d(()=>[n(w,{modelValue:s.value.home_country,"onUpdate:modelValue":g[3]||(g[3]=B=>s.value.home_country=B),placeholder:A(u)("Select country"),filterable:"",class:"w-full"},{default:d(()=>[(r(!0),h(P,null,te(e.countries,B=>(r(),E(v,{key:B.value,label:B.label,value:B.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(k,{label:A(u)("VAT number")},{default:d(()=>[n(b,{modelValue:s.value.home_vat,"onUpdate:modelValue":g[4]||(g[4]=B=>s.value.home_vat=B),placeholder:A(u)("e.g. DE999999999")},null,8,["modelValue","placeholder"]),o("div",Ome,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),e.initialRegistrations.length?x("",!0):(r(),h("div",Pme,[n(Y,{name:"InformationFill",class:"w-4 h-4 text-blue-500 flex-shrink-0"}),o("span",Hme,m(A(u)("You haven't added a home country registration. The information you add here will be used to create one for you.")),1)]))])]),_:1},8,["visible"])],2),o("div",{class:de(["fct-radio-option",{"is-active":s.value.method==="specific"}]),onClick:g[6]||(g[6]=B=>s.value.method="specific")},[n(y,{value:"specific"},{default:d(()=>[R(m(A(u)("Collect using specific country registrations")),1)]),_:1}),n(ya,{accordion:"",visible:s.value.method==="specific"},{default:d(()=>[o("div",Nme,[o("p",Kme,m(A(u)("Register in each EU country where you are required to collect VAT. Manage your registrations in the country list below.")),1)])]),_:1},8,["visible"])],2)]),_:1},8,["modelValue"])]),_:1})])]),_:1},8,["model-value","title"])}}},zme={key:0,class:"fct-country-registrations-list mt-4"},jme={class:"fct-home-country-header"},qme=["src","alt"],Yme={class:"fct-vat-country-name"},Wme={key:0,class:"fct-collecting-badge"},Jme={class:"fct-home-country-body"},Xme={class:"fct-vat-home-field"},Zme={class:"fct-vat-home-field__label"},ehe={class:"fct-reg-rates-section"},the={class:"fct-reg-rates-table fct-reg-rates-table--home mt-5 px-5 pt-5"},ahe={class:"fct-reg-rates-row fct-reg-rates-header"},lhe={class:"fct-reg-rates-cell-label"},she={class:"fct-reg-rates-cell-label"},nhe={key:1,class:"fct-reg-class-name"},ohe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},ihe={class:"fct-reg-rates-cell-input"},rhe={class:"fct-reg-rates-cell-action"},dhe=["title","onClick"],uhe={key:0,class:"fct-reg-add-class px-5"},che={type:"button",class:"fct-reg-add-class-btn"},Ahe={class:"fct-vat-home-actions"},phe={__name:"EUVatHomeCountryRegistration",props:{countries:{type:Array,default:()=>[]},homeCountry:{type:String,default:""},homeVat:{type:String,default:""},taxClasses:{type:Array,default:()=>[]},registrations:{type:Array,default:()=>[]}},emits:["save-home","class-changed"],setup(e,{emit:t}){const a=e,l=t,s=T({country:"",vat:"",rates:{}}),i=T([]),c=K(()=>a.homeCountry&&a.countries.find(B=>B.value===a.homeCountry)||null),p=K(()=>a.homeCountry&&a.registrations.find(B=>B.country===a.homeCountry)||null),f=K(()=>{const B=p.value;return!B||!B.vat?!1:B.rates&&typeof B.rates=="object"&&Object.keys(B.rates).length?Object.values(B.rates).some(function(U){return U&&parseFloat(U.rate)>0}):parseFloat(B.rate)>0}),_=K(()=>[...a.taxClasses,...i.value]),g=K(()=>_.value.length?_.value:[{slug:"standard",title:u("Standard")}]),y=K(()=>{if(_.value.length>=6)return[];const B=_.value.map(Q=>Q.slug).filter(Boolean),U=[];return B.includes("reduced")||U.push({command:"reduced",label:u("Reduced")}),B.includes("zero")||U.push({command:"zero",label:u("Zero")}),U.push({command:"custom",label:u("Custom Class...")}),U});be([()=>a.homeCountry,()=>a.homeVat,()=>a.taxClasses,()=>a.registrations],()=>{const B=p.value,U={};a.taxClasses.forEach(Q=>{var O;const V=(O=B==null?void 0:B.rates)==null?void 0:O[Q.slug],I=Q.slug==="standard"?(B==null?void 0:B.rate)??"":"",M=Q.slug==="standard"?(B==null?void 0:B.tax_label)??"":"";V&&typeof V=="object"?U[Q.slug]={rate:V.rate??"",label:V.label??""}:U[Q.slug]={rate:V??I,label:M}}),i.value.forEach(Q=>{const V=v(Q);U[V]=s.value.rates[V]||{rate:"",label:""}}),U.standard||(U.standard={rate:"",label:""}),s.value={country:a.homeCountry||"",vat:(B==null?void 0:B.vat)||a.homeVat||"",rates:U}},{immediate:!0});function v(B){return B.tempKey||B.slug}function w(B){if(B==="custom"){b();return}const U=B==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:B,title:U,tempKey:B}),s.value.rates[B]={rate:"",label:""}}let k=0;function b(){const B="_new_"+k++;i.value.push({slug:null,title:"",tempKey:B,isNew:!0}),s.value.rates[B]={rate:"",label:""}}function S(B){return B.slug?B.title||B.slug:B.title&&B.title.trim()?B.title.trim():u("Custom")}function $(B){if(B.hasError=!1,B.created)return Promise.resolve(null);if(!B.slug&&!(B.title&&B.title.trim()))return B.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const U=B.slug?{slug:B.slug}:{title:B.title.trim()};return Ae.post("tax/classes",U).then(Q=>{const V=(Q==null?void 0:Q.class)||{},I=V.slug||B.slug;if(!I)throw new Error(u("Tax class creation returned an invalid response"));return!B.slug&&s.value.rates[B.tempKey]!==void 0&&(s.value.rates[I]=s.value.rates[B.tempKey],delete s.value.rates[B.tempKey],B.tempKey=null),B.slug=I,B.title=V.title||B.title,B.created=!0,V}).catch(Q=>{var I;B.hasError=!0;const V=((I=Q==null?void 0:Q.data)==null?void 0:I.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",V,S(B)))})}function D(B){const U=v(B);if(i.value.some(V=>v(V)===U)){i.value=i.value.filter(V=>v(V)!==U),delete s.value.rates[U];return}ul(u('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',B.title),u("Delete Tax Class"),{confirmButtonText:u("Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Ae.delete("tax/classes/"+B.id).then(()=>{l("class-changed")}).catch(V=>{var I;q.error(((I=V==null?void 0:V.data)==null?void 0:I.message)||u("Failed to delete tax class"))})}).catch(()=>{})}function F(){const B=i.value.map($);Promise.all(B).then(()=>{i.value=[],l("save-home",{country:s.value.country,vat:s.value.vat,rates:s.value.rates})}).catch(U=>{q.error((U==null?void 0:U.message)||u("Failed to create tax class"))})}return(B,U)=>{const Q=C("el-input"),V=C("el-dropdown-item"),I=C("el-dropdown-menu"),M=C("el-dropdown"),O=C("el-button");return c.value?(r(),h("div",zme,[o("div",jme,[o("img",{src:`https://flagcdn.com/w40/${e.homeCountry.toLowerCase()}.png`,alt:c.value.label,class:"fct-flag-icon"},null,8,qme),o("span",Yme,m(c.value.label),1),f.value?(r(),h("span",Wme,[U[1]||(U[1]=o("span",{class:"fct-green-dot"},null,-1)),R(" "+m(A(u)("Collecting")),1)])):x("",!0)]),o("div",Jme,[o("div",Xme,[o("label",Zme,m(A(u)("VAT number")),1),n(Q,{modelValue:s.value.vat,"onUpdate:modelValue":U[0]||(U[0]=L=>s.value.vat=L),class:"fct-vat-number-input"},null,8,["modelValue"])]),o("div",ehe,[o("div",the,[o("div",ahe,[o("div",lhe,m(A(u)("Tax Classes")),1),U[2]||(U[2]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),U[3]||(U[3]=o("div",{class:"fct-reg-rates-cell-input"},null,-1)),U[4]||(U[4]=o("div",{class:"fct-reg-rates-cell-action"},null,-1))]),(r(!0),h(P,null,te(g.value,L=>(r(),h("div",{key:v(L),class:"fct-reg-rates-row"},[o("div",she,[L.isNew?(r(),E(Q,{key:0,modelValue:L.title,"onUpdate:modelValue":H=>L.title=H,size:"small",placeholder:A(u)("Class name"),class:de(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":L.hasError}]),onInput:H=>L.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",nhe,m(L.title),1))]),o("div",ohe,[n(Q,{modelValue:s.value.rates[v(L)].rate,"onUpdate:modelValue":H=>s.value.rates[v(L)].rate=H,type:"number",step:"0.01",min:"0",size:"small"},{suffix:d(()=>U[5]||(U[5]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])]),o("div",ihe,[n(Q,{modelValue:s.value.rates[v(L)].label,"onUpdate:modelValue":H=>s.value.rates[v(L)].label=H,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",rhe,[L.slug!=="standard"?(r(),h("button",{key:0,type:"button",class:"fct-reg-rates-delete-btn",title:A(u)("Delete class"),onClick:H=>D(L)},[n(Y,{name:"Delete"})],8,dhe)):x("",!0)])]))),128))]),y.value.length?(r(),h("div",uhe,[y.value.length===1&&y.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:b},[n(Y,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add class")),1)])):(r(),E(M,{key:1,trigger:"click",onCommand:w,"popper-class":"fct-dropdown"},{dropdown:d(()=>[n(I,null,{default:d(()=>[(r(!0),h(P,null,te(y.value,L=>(r(),E(V,{key:L.command,command:L.command},{default:d(()=>[R(m(L.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",che,[n(Y,{name:"Plus",class:"w-3 h-3"}),R(" "+m(A(u)("Add class")),1)])]),_:1}))])):x("",!0)]),o("div",Ahe,[n(O,{type:"primary",size:"small",onClick:F},{default:d(()=>[R(m(A(u)("Save VAT")),1)]),_:1})])])])):x("",!0)}}},fhe={class:"fct-modal-body fct-country-reg-modal"},mhe={class:"fct-country-reg-text"},hhe={class:"form-note"},_he={class:"fct-reg-rates-table"},vhe={class:"fct-reg-rates-row fct-reg-rates-header"},ghe={class:"fct-reg-rates-cell-label"},yhe={class:"fct-reg-rates-cell-label"},bhe={key:1,class:"fct-reg-class-name"},whe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},Che={class:"fct-reg-rates-cell-input"},khe={key:1,class:"fct-reg-rates-row"},Bhe={class:"fct-reg-rates-cell-label"},xhe={class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},She={class:"fct-reg-rates-cell-input"},Fhe={key:0,class:"fct-reg-add-class"},$he={type:"button",class:"fct-reg-add-class-btn"},Ehe={__name:"EUVatRegistrationModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({country:"",vat:"",rates:{},isEdit:!1})},registeredCountries:{type:Array,default:()=>[]}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=T({country:"",vat:"",rates:{},isEdit:!1}),i=T([]),c=T(!1),p=K(()=>[...a.taxClasses,...i.value]),f=K(()=>{if(p.value.length>=6)return[];const D=p.value.map(B=>B.slug).filter(Boolean),F=[];return D.includes("reduced")||F.push({command:"reduced",label:u("Reduced")}),D.includes("zero")||F.push({command:"zero",label:u("Zero")}),F.push({command:"custom",label:u("Custom Class...")}),F}),_=K(()=>s.value.isEdit?a.countries:a.countries.filter(D=>!a.registeredCountries.includes(D.value)));be(()=>a.modelValue,D=>{if(D){const F=a.initialForm||{},B=F.rates?JSON.parse(JSON.stringify(F.rates)):{};a.taxClasses.forEach(U=>{B[U.slug]||(B[U.slug]={rate:"",label:""})}),B.standard||(B.standard={rate:"",label:""}),s.value={country:F.country||"",vat:F.vat||"",rates:B,isEdit:F.isEdit||!1},i.value=[]}});function g(D){return D.tempKey||D.slug}function y(D){const F=a.countries.find(B=>B.value===D);if(F&&F.default_rate){const B=s.value.rates.standard||{};s.value.rates=Object.assign({},s.value.rates,{standard:Object.assign({},B,{rate:F.default_rate})})}}function v(D){if(D==="custom"){k();return}const F=D==="reduced"?u("Reduced"):u("Zero");i.value.push({slug:D,title:F,tempKey:D}),s.value.rates[D]={rate:"",label:""}}let w=0;function k(){const D="_new_"+w++;i.value.push({slug:null,title:"",tempKey:D,isNew:!0}),s.value.rates[D]={rate:"",label:""}}function b(D){return D.slug?D.title||D.slug:D.title&&D.title.trim()?D.title.trim():u("Custom")}function S(D){if(D.hasError=!1,D.created)return Promise.resolve(null);if(!D.slug&&!(D.title&&D.title.trim()))return D.hasError=!0,Promise.reject(new Error(u("Please enter a name for the custom tax class")));const F=D.slug?{slug:D.slug}:{title:D.title.trim()};return Ae.post("tax/classes",F).then(B=>{const U=(B==null?void 0:B.class)||{},Q=U.slug||D.slug;if(!Q)throw new Error(u("Tax class creation returned an invalid response"));return!D.slug&&s.value.rates[D.tempKey]!==void 0&&(s.value.rates[Q]=s.value.rates[D.tempKey],delete s.value.rates[D.tempKey],D.tempKey=null),D.slug=Q,D.title=U.title||D.title,D.created=!0,U}).catch(B=>{var Q;D.hasError=!0;const U=((Q=B==null?void 0:B.data)==null?void 0:Q.message)||u("Failed to create tax class");throw new Error(u("%1$s: %2$s",U,b(D)))})}function $(){if(!s.value.country){q.error(u("Select a registration country"));return}const D=s.value.rates;if(!Object.values(D).some(U=>parseFloat(U.rate)>0)){q.error(u("At least one tax rate must be greater than 0%"));return}c.value=!0;const B=i.value.map(S);Promise.all(B).then(()=>Ae.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:s.value.country,vat:s.value.vat,rates:s.value.rates})).then(U=>{q.success(U.message),i.value=[],l("saved"),l("update:modelValue",!1)}).catch(U=>{var Q;q.error((U==null?void 0:U.message)||((Q=U==null?void 0:U.data)==null?void 0:Q.message)||u("Failed to save VAT registration"))}).finally(()=>{c.value=!1})}return(D,F)=>{const B=C("el-option"),U=C("el-select"),Q=C("el-form-item"),V=C("el-input"),I=C("el-dropdown-item"),M=C("el-dropdown-menu"),O=C("el-dropdown"),L=C("el-form"),H=C("el-button"),j=C("el-dialog");return r(),E(j,{"model-value":e.modelValue,title:s.value.isEdit?A(u)("Edit VAT registration"):A(u)("Collect VAT"),"close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":F[5]||(F[5]=W=>l("update:modelValue",W))},{footer:d(()=>[n(H,{onClick:F[4]||(F[4]=W=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(H,{type:"primary",onClick:$,loading:c.value},{default:d(()=>[R(m(A(u)("Collect VAT")),1)]),_:1},8,["loading"])]),default:d(()=>[o("div",fhe,[o("p",mhe,m(A(u)("Make sure you're registered for VAT when collecting in the EU.")),1),n(L,{"label-position":"top"},{default:d(()=>[n(Q,{label:A(u)("Registration country")},{default:d(()=>[n(U,{modelValue:s.value.country,"onUpdate:modelValue":F[0]||(F[0]=W=>s.value.country=W),placeholder:A(u)("Select country"),filterable:"",class:"w-full",disabled:s.value.isEdit,onChange:y},{default:d(()=>[(r(!0),h(P,null,te(_.value,W=>(r(),E(B,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","disabled"])]),_:1},8,["label"]),n(Q,{label:A(u)("VAT number")},{default:d(()=>[n(V,{modelValue:s.value.vat,"onUpdate:modelValue":F[1]||(F[1]=W=>s.value.vat=W),placeholder:s.value.country?s.value.country+"999999999":"DE999999999"},null,8,["modelValue","placeholder"]),o("div",hhe,[o("p",null,m(A(u)("Shown on VAT invoice")),1)])]),_:1},8,["label"]),o("div",_he,[o("div",vhe,[o("div",ghe,m(A(u)("Tax Classes")),1),F[6]||(F[6]=o("div",{class:"fct-reg-rates-cell-input fct-reg-rates-cell-rate"},null,-1)),F[7]||(F[7]=o("div",{class:"fct-reg-rates-cell-input"},null,-1))]),p.value.length?(r(!0),h(P,{key:0},te(p.value,W=>(r(),h("div",{key:W.tempKey||W.slug,class:"fct-reg-rates-row"},[o("div",yhe,[W.isNew?(r(),E(V,{key:0,modelValue:W.title,"onUpdate:modelValue":G=>W.title=G,size:"small",placeholder:A(u)("Class name"),class:de(["fct-reg-class-name-input",{"fct-reg-class-name-input--error":W.hasError}]),onInput:G=>W.hasError=!1},null,8,["modelValue","onUpdate:modelValue","placeholder","class","onInput"])):(r(),h("span",bhe,m(W.title),1))]),o("div",whe,[n(V,{modelValue:s.value.rates[g(W)].rate,"onUpdate:modelValue":G=>s.value.rates[g(W)].rate=G,modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:W.slug==="standard"?"19":"0"},{suffix:d(()=>F[8]||(F[8]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])]),o("div",Che,[n(V,{modelValue:s.value.rates[g(W)].label,"onUpdate:modelValue":G=>s.value.rates[g(W)].label=G,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])])]))),128)):(r(),h("div",khe,[o("div",Bhe,m(A(u)("Standard")),1),o("div",xhe,[n(V,{modelValue:s.value.rates.standard.rate,"onUpdate:modelValue":F[2]||(F[2]=W=>s.value.rates.standard.rate=W),modelModifiers:{number:!0},type:"number",step:"0.01",min:"0",size:"small",placeholder:"19"},{suffix:d(()=>F[9]||(F[9]=[R("%",-1)])),_:1},8,["modelValue"])]),o("div",She,[n(V,{modelValue:s.value.rates.standard.label,"onUpdate:modelValue":F[3]||(F[3]=W=>s.value.rates.standard.label=W),size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","placeholder"])])]))]),f.value.length?(r(),h("div",Fhe,[f.value.length===1&&f.value[0].command==="custom"?(r(),h("button",{key:0,type:"button",class:"fct-reg-add-class-btn",onClick:k},[n(Y,{name:"Plus"}),R(" "+m(A(u)("Add class")),1)])):(r(),E(O,{key:1,trigger:"click",onCommand:v},{dropdown:d(()=>[n(M,null,{default:d(()=>[(r(!0),h(P,null,te(f.value,W=>(r(),E(I,{key:W.command,command:W.command},{default:d(()=>[R(m(W.label),1)]),_:2},1032,["command"]))),128))]),_:1})]),default:d(()=>[o("button",$he,[n(Y,{name:"Plus"}),R(" "+m(A(u)("Add class")),1)])]),_:1}))])):x("",!0)]),_:1})])]),_:1},8,["model-value","title"])}}},Uhe={class:"fct-oss-rates-section"},Ihe=["aria-expanded"],Qhe={class:"inline-flex items-center gap-2"},Dhe={class:"fct-oss-rates-count"},Vhe={class:"fct-oss-rates-table"},The={key:1,class:"text-system-mid"},Mhe={class:"fct-btn-group mt-4 justify-end sm"},Lhe={__name:"EUVatOssRatesSection",setup(e,{expose:t}){const a=T([]),l=T([]),s=T(null),i=T("standard"),c=T(!1),p=T(!1),f=T(!1),_=T(!1),g=T(6),y=T(!1),v=T(""),w=K(()=>a.value),k=K(()=>{const Q=v.value.trim().toLowerCase();return Q?w.value.filter(V=>V.label&&V.label.toLowerCase().includes(Q)):w.value});function b(){return c.value=!0,Ae.get("tax/configuration/settings/eu-vat/oss-rates").then(Q=>{a.value=Q.rates||[],l.value=Q.classes||[];const V=Td({classes:l.value,activeId:s.value});return V&&(s.value=V.id,i.value=V.slug),l.value}).catch(Q=>{var V;q.error((V=Q==null?void 0:Q.data)==null?void 0:V.message)}).finally(()=>{c.value=!1})}function S(Q){s.value=Q.id,i.value=Q.slug}function $(Q){y.value=!0,Jo({payload:{slug:Q},createdSlug:Q,currentClasses:l.value,reloadClasses:b}).then(({createdClass:V})=>{V&&S(V)}).catch(V=>{var I;q.error((I=V==null?void 0:V.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function D(Q){y.value=!0,Jo({payload:{title:Q},currentClasses:l.value,reloadClasses:b}).then(({createdClass:V})=>{V&&S(V)}).catch(V=>{var I;q.error((I=V==null?void 0:V.data)==null?void 0:I.message)}).finally(()=>{y.value=!1})}function F(Q){Q.slug!=="standard"&&ul(u('This will permanently delete the "%1$s" tax class and all its rates across every country (not just EU). Products using this class will fall back to Standard. Continue?',Q.title),u("Delete Tax Class"),{confirmButtonText:u("Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{c.value=!0,Cf({classId:Q.id,currentActiveId:s.value===Q.id?null:s.value,reloadClasses:b}).then(({nextActiveClass:V})=>{V&&S(V)}).catch(V=>{var I;q.error((I=V==null?void 0:V.data)==null?void 0:I.message),c.value=!1})}).catch(()=>{})}function B(){p.value=!0,Ae.post("tax/configuration/settings/eu-vat/oss-rates",{rates:w.value.map(Q=>({country:Q.country,rate:Q.rate,tax_label:Q.tax_label||"",class_rates:Q.class_rates||{}}))}).then(Q=>{q.success(Q.message)}).catch(Q=>{var V;q.error((V=Q==null?void 0:Q.data)==null?void 0:V.message)}).finally(()=>{p.value=!1})}function U(){ul(u("This will overwrite all EU destination country standard rates with preset defaults. Continue?"),u("Reset to default tax rates"),{confirmButtonText:u("Reset"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{f.value=!0,Ae.post("tax/configuration/settings/eu-vat/reset-rates").then(()=>b()).then(()=>{q.success(u("EU tax rates have been reset to defaults"))}).catch(Q=>{var V;q.error(((V=Q==null?void 0:Q.data)==null?void 0:V.message)||u("Failed to reset rates"))}).finally(()=>{f.value=!1})}).catch(()=>{})}return Ie(b),t({loadRates:b}),(Q,V)=>{const I=C("el-icon"),M=C("el-table-column"),O=C("el-input"),L=C("el-table"),H=C("el-button"),j=Va("loading");return r(),h("div",Uhe,[o("div",{class:"fct-oss-rates-toggle",role:"button",tabindex:"0","aria-expanded":_.value,onClick:V[0]||(V[0]=W=>{_.value=!_.value,_.value||(v.value="")}),onKeydown:[V[1]||(V[1]=xa(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["enter"])),V[2]||(V[2]=xa(Ge(W=>{_.value=!_.value,_.value||(v.value="")},["prevent"]),["space"]))]},[o("span",Qhe,[R(m(A(u)("Destination country rates"))+" ",1),o("span",Dhe," ("+m(w.value.length)+") ",1)]),n(I,{class:de(["fct-oss-rates-arrow",{"is-expanded":_.value}])},{default:d(()=>[n(Y,{name:"ChevronDown",class:"w-4 h-4"})]),_:1},8,["class"])],40,Ihe),n(Xl,{name:"fct-collapse"},{default:d(()=>[Wt(o("div",Vhe,[n(el,{type:"info"},{content:d(()=>[o("span",null,m(A(u)("Rates are pre-filled for convenience and may not reflect current laws — verify with a tax advisor before going live. If you sell products taxed at different rates (e.g. food, books, digital goods), use the"))+" + "+m(A(u)("button to add tax classes.")),1)]),_:1}),n(wf,{classes:l.value,"active-id":s.value,"max-classes":g.value,creating:y.value,search:v.value,onSwitch:S,onDelete:F,onAdd:$,onCreateCustom:D,"onUpdate:search":V[3]||(V[3]=W=>v.value=W)},null,8,["classes","active-id","max-classes","creating","search"]),Wt((r(),E(L,{data:k.value,class:"w-full fct-tax-rates-table","max-height":"450","empty-text":A(u)("No rates found")},{default:d(()=>[n(M,{label:A(u)("Country"),"min-width":"160"},{default:d(({row:W})=>[R(m(W.label),1)]),_:1},8,["label"]),n(M,{label:A(u)("Tax Label"),"min-width":"150"},{default:d(({row:W})=>[W.class_rates&&W.class_rates[i.value]?(r(),E(O,{key:0,modelValue:W.class_rates[i.value].label,"onUpdate:modelValue":G=>W.class_rates[i.value].label=G,size:"small",placeholder:A(u)("e.g. VAT, MwSt")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):x("",!0)]),_:1},8,["label"]),n(M,{label:A(u)("Rate"),"min-width":"120"},{default:d(({row:W})=>[W.class_rates&&W.class_rates[i.value]?(r(),E(O,{key:0,modelValue:W.class_rates[i.value].rate,"onUpdate:modelValue":G=>W.class_rates[i.value].rate=G,modelModifiers:{number:!0},size:"small",type:"number",min:0,max:100,step:"0.5"},{suffix:d(()=>V[4]||(V[4]=[R("%",-1)])),_:2},1032,["modelValue","onUpdate:modelValue"])):(r(),h("span",The,"—"))]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[j,c.value]]),o("div",Mhe,[i.value==="standard"?(r(),E(H,{key:0,size:"small",loading:f.value,onClick:U,type:"danger",soft:""},{default:d(()=>[R(m(A(u)("Reset to default")),1)]),_:1},8,["loading"])):x("",!0),n(H,{type:"primary",size:"small",loading:p.value,onClick:B},{default:d(()=>[R(m(A(u)("Save Rates")),1)]),_:1},8,["loading"])])],512),[[Tl,_.value]])]),_:1})])}}},Rhe={class:"fct-vat-card-header"},Ohe={class:"fct-vat-card-title"},Phe={class:"fct-vat-card-body"},Hhe={class:"fct-vat-reg-info"},Nhe={class:"fct-vat-country-name"},Khe={key:0,size:"small",type:"success",class:"ml-3 fct-collecting-badge"},Ghe={key:1,class:"ml-3 text-sm text-system-mid dark:text-gray-400"},zhe={key:2,class:"fct-country-registrations-list mt-4"},jhe={class:"fct-reg-rows"},qhe={key:0,class:"fct-vat-registration-row"},Yhe={class:"fct-vat-reg-info"},Whe=["src","alt"],Jhe={class:"fct-vat-country-name"},Xhe={class:"fct-vat-reg-info"},Zhe=["src","alt"],e_e={class:"fct-vat-country-name"},t_e={key:0,class:"fct-vat-number"},a_e={key:1,class:"fct-vat-missing-badge"},l_e={class:"fct-vat-reg-actions"},s_e={key:1,class:"fct-vat-empty-state"},n_e={class:"text-system-mid text-sm"},o_e={key:0,class:"px-5 py-3"},i_e={key:1,class:"fct-vat-cross-border-empty"},r_e={class:"fct-vat-cross-border-empty-text"},d_e={class:"fct-vat-cross-border-empty-title"},u_e={class:"fct-vat-cross-border-empty-desc"},c_e={__name:"EUVatCrossBorderCard",props:{countries:{type:Array,default:()=>[]},initialForm:{type:Object,default:()=>({})},initialRegistrations:{type:Array,default:()=>[]},storeCountry:{type:String,default:""},isTaxEnabled:{type:Boolean,default:!0}},emits:["method-changed"],setup(e,{emit:t}){const a=e,l=t,s=T({method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""}),i=T(!1),c=T(null),p=T([]),f=T(!1),_=T({country:"",vat:"",rates:{},isEdit:!1}),g=K(()=>a.countries.length||28),y=K(()=>a.initialRegistrations.filter(D).length),v=K(()=>a.storeCountry&&a.countries.find(Z=>Z.value===a.storeCountry)||null),w=K(()=>a.storeCountry?a.initialRegistrations.some(Z=>Z.country===a.storeCountry):!1),k=K(()=>{if(s.value.method!=="home"||!s.value.home_country)return!1;const Z=a.initialRegistrations.find(ne=>ne.country===s.value.home_country);return!!Z&&D(Z)}),b=K(()=>s.value.method==="oss"||s.value.method==="home"||s.value.method==="specific");function S(Z){if(!Z||!Array.isArray(a.countries))return Z;const ne=a.countries.find(ce=>ce.value===Z);return ne?ne.label:Z}function $(Z){return Z?Z.rates&&typeof Z.rates=="object"&&Object.keys(Z.rates).length?Object.values(Z.rates).some(ne=>ne&&parseFloat(ne.rate)>0):parseFloat(Z.rate)>0:!1}function D(Z){return!!Z&&!!Z.vat&&$(Z)}function F(Z){return $(Z)&&!Z.vat}function B(){return Ae.get("tax/classes").then(Z=>{p.value=Z.classes||[]}).catch(()=>{q.error(u("Failed to load tax classes"))})}function U(Z){const ne={};return p.value.forEach(ce=>{ne[ce.slug]={rate:ce.slug==="standard"&&Z||"",label:""}}),ne}function Q(){const Z=v.value&&!w.value?a.storeCountry:"",ne=Z&&v.value&&v.value.default_rate||"";_.value={country:Z,vat:"",rates:U(ne),isEdit:!1},f.value=!0}function V(Z){const ne=Z.rates||{},ce={};p.value.forEach(z=>{const ue=ne[z.slug];if(ue&&typeof ue=="object")ce[z.slug]={rate:ue.rate||"",label:ue.label||""};else{const ie=z.slug==="standard"?Z.rate||"":ue||"";ce[z.slug]={rate:ie,label:z.slug==="standard"&&Z.tax_label||""}}}),_.value={country:Z.country,vat:Z.vat||"",rates:ce,isEdit:!0},f.value=!0}function I(){B(),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}function M(Z){Ae.post("tax/configuration/settings/eu-vat",{action:"saveCountryRegistration",country:Z.country,vat:Z.vat,rates:Z.rates}).then(ne=>{q.success(ne.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:Z.vat})}).catch(ne=>{var ce;q.error(((ce=ne==null?void 0:ne.data)==null?void 0:ce.message)||u("Failed to save VAT registration"))})}function O(Z){ul(u("Are you sure you want to remove this country registration?"),u("Confirm Remove"),{confirmButtonText:u("Yes, Remove"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Ae.post("tax/configuration/settings/eu-vat",{action:"deleteCountryRegistration",country:Z}).then(ne=>{q.success(ne.message),l("method-changed",{method:s.value.method,home_country:s.value.home_country,home_vat:s.value.home_vat})}).catch(ne=>{var ce;q.error((ce=ne==null?void 0:ne.data)==null?void 0:ce.message)})}).catch(()=>{})}function L(){return y.value===1?u("Collecting in 1 country"):u("Collecting in %1$s countries",y.value)}const H=K(()=>g.value===1?u("Collecting in 1 region"):u("Collecting in %1$s regions",g.value));function j(Z){s.value={method:Z.method,oss_country:Z.oss_country,oss_vat:Z.oss_vat,home_country:Z.home_country,home_vat:Z.home_country_vat},Z.method==="oss"&&xe(()=>{var ne;return(ne=c.value)==null?void 0:ne.loadRates()}),l("method-changed",{method:Z.method,home_country:Z.home_country,home_vat:Z.home_country_vat})}function W(Z){Z==="edit"?i.value=!0:Z==="stop"&&G()}function G(){ul(u("Are you sure you want to stop collecting cross-border VAT? This will clear your OSS/home country registration."),u("Stop Collecting"),{confirmButtonText:u("Yes, Stop"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Ae.post("tax/configuration/settings/eu-vat",{action:"euCrossBorderSettings",eu_vat_settings:{method:"specific"},reset_registration:"yes"}).then(Z=>{q.success(Z.message),s.value={method:"",oss_country:"",oss_vat:"",home_country:"",home_vat:""},l("method-changed",{method:"",home_country:"",home_vat:""})}).catch(Z=>{var ne;q.error((ne=Z==null?void 0:Z.data)==null?void 0:ne.message)})}).catch(()=>{})}return be(()=>a.initialForm,Z=>{const ne=Z||{};s.value={method:ne.method||"",oss_country:ne.oss_country||"",oss_vat:ne.oss_vat||"",home_country:ne.home_country||"",home_vat:ne.home_vat||""}},{immediate:!0}),be(()=>a.countries,Z=>{Z&&Z.length&&B()},{immediate:!0}),(Z,ne)=>{const ce=C("el-tooltip"),z=C("el-dropdown-item"),ue=C("el-dropdown-menu"),ie=C("el-dropdown"),J=C("el-button");return r(),h(P,null,[n(Se,{class:"fct-vat-card"},{default:d(()=>[n(ke,null,{default:d(()=>[o("div",Rhe,[o("div",Ohe,[o("h3",null,m(A(u)("Collect VAT cross-border")),1),n(ce,{content:A(u)("Choose how to collect VAT for sales to other EU countries."),placement:"top"},{default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 h-4 text-system-mid cursor-pointer"})]),_:1},8,["content"])]),b.value?(r(),E(ie,{key:0,trigger:"click",onCommand:W,"popper-class":"fct-dropdown",placement:"bottom-end"},{dropdown:d(()=>[n(ue,null,{default:d(()=>[n(z,{command:"edit"},{default:d(()=>[R(m(A(u)("Edit registration")),1)]),_:1}),n(z,{command:"stop"},{default:d(()=>[R(m(A(u)("Stop collecting")),1)]),_:1})]),_:1})]),default:d(()=>[n(at,{border:"none",size:"small",tag:"button"},{default:d(()=>[n(Y,{name:"More"})]),_:1})]),_:1})):x("",!0)]),o("div",Phe,[b.value?(r(),h(P,{key:0},[o("div",Hhe,[ne[4]||(ne[4]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("span",Nhe,m(s.value.method==="oss"?A(u)("EU (OSS)"):s.value.method==="home"?A(u)("EU (micro-business)"):A(u)("EU (specific countries)")),1),e.isTaxEnabled&&(s.value.method!=="specific"||y.value>0)?(r(),h("span",Khe,[ne[3]||(ne[3]=o("span",{class:"fct-green-dot"},null,-1)),s.value.method==="specific"?(r(),h(P,{key:0},[R(m(L()),1)],64)):(r(),h(P,{key:1},[R(m(H.value),1)],64))])):x("",!0),e.isTaxEnabled?x("",!0):(r(),h("span",Ghe,m(A(u)("Tax disabled")),1))]),s.value.method==="home"?(r(),E(el,{key:0,type:k.value?"info":"warning",icon:"Info",class:"mb-4 mt-4",content:k.value?A(u)("Collecting cross-border EU VAT at your %1$s home country rate. This is for small businesses whose total cross-border EU sales stay below €10,000/year. Once you exceed that threshold you must charge each buyer's local VAT rate instead.",S(s.value.home_country)):A(u)("Your %1$s home country VAT rate will apply to all EU cross-border sales. This is available for small businesses below €10,000/year in cross-border EU sales. Make sure %1$s is registered below with the correct rate.",S(s.value.home_country))},null,8,["type","content"])):x("",!0),s.value.method==="home"?(r(),E(phe,{key:1,countries:e.countries,"home-country":s.value.home_country,"home-vat":s.value.home_vat,"tax-classes":p.value,registrations:e.initialRegistrations,onSaveHome:M,onClassChanged:B},null,8,["countries","home-country","home-vat","tax-classes","registrations"])):x("",!0),s.value.method==="specific"?(r(),h("div",zhe,[o("div",jhe,[v.value&&!w.value?(r(),h("div",qhe,[o("div",Yhe,[o("img",{src:`https://flagcdn.com/w40/${e.storeCountry.toLowerCase()}.png`,alt:v.value.label,class:"fct-flag-icon"},null,8,Whe),o("span",Jhe,m(v.value.label),1)]),n(J,{size:"small",onClick:Q},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})])):x("",!0),(r(!0),h(P,null,te(e.initialRegistrations,N=>(r(),h("div",{key:N.country,class:"fct-vat-registration-row"},[o("div",Xhe,[o("img",{src:`https://flagcdn.com/w40/${N.country.toLowerCase()}.png`,alt:S(N.country),class:"fct-flag-icon"},null,8,Zhe),o("span",e_e,m(S(N.country)),1),N.vat?(r(),h("span",t_e,m(N.vat),1)):F(N)?(r(),h("span",a_e,m(A(u)("VAT ID missing")),1)):x("",!0)]),o("div",l_e,[$(N)?(r(),E(at,{key:0,border:"none",size:"small",tag:"button",title:A(u)("Edit"),onClick:ae=>V(N)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["title","onClick"])):(r(),E(J,{key:1,size:"small",onClick:ae=>V(N)},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:2},1032,["onClick"])),n(at,{border:"none",size:"small",tag:"button",title:A(u)("Delete"),onClick:ae=>O(N.country)},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["title","onClick"])])]))),128)),!e.initialRegistrations.length&&!v.value?(r(),h("div",s_e,[o("p",n_e,m(A(u)("No country VAT registrations configured.")),1),n(J,{type:"primary",size:"small",onClick:Q},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})])):x("",!0)]),e.initialRegistrations.length||v.value?(r(),h("div",o_e,[n(J,{type:"primary",link:"",onClick:Q},{default:d(()=>[R(" + "+m(A(u)("Collect in another country")),1)]),_:1})])):x("",!0)])):x("",!0),s.value.method==="oss"?(r(),E(Lhe,{key:3,ref_key:"ossRatesRef",ref:c},null,512)):x("",!0)],64)):(r(),h("div",i_e,[ne[5]||(ne[5]=o("span",{class:"fct-eu-flag-icon"},"🇪🇺",-1)),o("div",r_e,[o("p",d_e,m(A(u)("Not collecting cross-border VAT")),1),o("p",u_e,m(A(u)("Set up OSS, micro-business, or specific-country registrations to collect VAT across the EU.")),1)]),n(J,{size:"small",onClick:ne[0]||(ne[0]=N=>i.value=!0),type:"primary"},{default:d(()=>[R(m(A(u)("Configure")),1)]),_:1})]))])]),_:1})]),_:1}),n(Gme,{modelValue:i.value,"onUpdate:modelValue":ne[1]||(ne[1]=N=>i.value=N),countries:e.countries,"current-form":s.value,"initial-registrations":e.initialRegistrations,onSaved:j},null,8,["modelValue","countries","current-form","initial-registrations"]),n(Ehe,{modelValue:f.value,"onUpdate:modelValue":ne[2]||(ne[2]=N=>f.value=N),countries:e.countries,"tax-classes":p.value,"initial-form":_.value,"registered-countries":e.initialRegistrations.map(N=>N.country),onSaved:I},null,8,["modelValue","countries","tax-classes","initial-form","registered-countries"])],64)}}},A_e={__name:"EUVatTaxOverrideModal",props:{modelValue:{type:Boolean,default:!1},countries:{type:Array,default:()=>[]},taxClasses:{type:Array,default:()=>[]},editRow:{type:Object,default:null}},emits:["update:modelValue","saved"],setup(e,{emit:t}){const a=e,l=t,s=T({type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}),i=T([]),c=T(!1),p=T(!1);function f(){return a.taxClasses&&a.taxClasses.length>0&&Number(a.taxClasses[0].id)||0}function _(){s.value={type:"products",original_type:"",original_id:"",category_id:"",category_name:"",country:"",city:"",postcode:"",tax_label:"VAT",tax_rate:0,class_id:0,id:""}}function g(b){if(b.type==="shipping")s.value={type:"shipping",original_type:"shipping",original_id:b.id,category_id:"",category_name:"",country:b._raw.country||"",city:b._raw.city||"",postcode:b._raw.postcode||"",tax_label:b.tax_label,tax_rate:b.rate,class_id:Number(b._raw.class_id)||f(),id:b.id};else{const S=b._raw.meta_value||b._raw;s.value={type:"products",original_type:"products",original_id:b.id,category_id:an(S.category_id),category_name:b.category_name,country:S.country||"",city:S.city||"",postcode:S.postcode||"",tax_label:b.tax_label,tax_rate:b.rate,class_id:Number(b.class_id)||0,id:b.id}}}be(()=>a.modelValue,b=>{b&&(a.editRow?g(a.editRow):_(),y())}),be(()=>s.value.type,b=>{b==="shipping"&&!s.value.class_id&&(s.value.class_id=f())}),be(()=>a.taxClasses,b=>{s.value.type==="shipping"&&!s.value.class_id&&b&&b.length>0&&(s.value.class_id=Number(b[0].id)||0)});function y(){i.value.length>0||(c.value=!0,Ae.get("products/fetch-term").then(b=>{const S=b.taxonomies&&b.taxonomies["product-categories"]?b.taxonomies["product-categories"].terms||[]:[];i.value=S.map($=>({...$,value:an($.value)}))}).catch(()=>{q.error(u("Failed to load product categories"))}).finally(()=>{c.value=!1}))}function v(b,S){return Ae.get("tax/rates/country/rates/"+b,{class_id:S}).then($=>{const F=($&&$.tax_rates?$.tax_rates:[]).find(function(U){return!U.state&&!U.city&&!U.postcode});if(F)return F;const B=a.countries.find(function(U){return U.value===b});return Ae.post("tax/country/rate",{country:b,state:"",rate:B&&B.default_rate||0,name:"Tax",is_compound:0,for_order:0,group:"EU",class_id:S}).then(function(U){return U&&U.tax_rate?U.tax_rate:null})})}function w(b){const S=an(b),$=i.value.find(D=>D.value===S);$&&(s.value.category_name=$.label)}function k(){if(s.value.type==="products"&&!s.value.category_id){q.error(u("Please select a category"));return}if(!s.value.country){q.error(u("Please select a location"));return}if(s.value.type==="shipping"){if(!a.taxClasses||a.taxClasses.length===0){q.error(u("Tax classes are not available. Please reload the page and try again."));return}if(!s.value.class_id){q.error(u("Please select a tax class"));return}}if(p.value=!0,s.value.type==="products")Ae.post("tax/product-overrides",{id:s.value.original_type==="products"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,country:s.value.country,state:"",city:s.value.city||"",postcode:s.value.postcode||"",category_id:s.value.category_id,category_name:s.value.category_name,tax_label:s.value.tax_label,rate:s.value.tax_rate,override_state_tax:"no",class_id:s.value.class_id||0}).then(b=>{q.success(b.message),l("saved"),l("update:modelValue",!1)}).catch(b=>{q.error(b&&b.data?b.data.message:b&&b.message?b.message:"")}).finally(()=>{p.value=!1});else{const b=s.value.class_id;v(s.value.country,b).then(S=>S?Ae.post("tax/rates/country/override",{id:S.id,previous_id:s.value.original_type==="shipping"?s.value.original_id:"",source_type:s.value.original_type,source_id:s.value.original_id,class_id:b,override_tax_rate:s.value.tax_rate,city:s.value.city||"",postcode:s.value.postcode||""}).then($=>{q.success($.message),l("saved"),l("update:modelValue",!1)}).catch($=>{q.error($&&$.data?$.data.message:$&&$.message?$.message:"")}).finally(()=>{p.value=!1}):(q.error(u("No tax rate found for the selected country and tax class")),p.value=!1,null)).catch(S=>{q.error(S&&S.data?S.data.message:S&&S.message?S.message:""),p.value=!1})}}return(b,S)=>{const $=C("el-radio"),D=C("el-radio-group"),F=C("el-form-item"),B=C("el-option"),U=C("el-select"),Q=C("el-input"),V=C("el-form"),I=C("el-button"),M=C("el-dialog");return r(),E(M,{"model-value":e.modelValue,title:e.editRow?A(u)("Edit tax override"):A(u)("Add tax override"),width:"520px","close-on-click-modal":!1,class:"fluent-cart-admin-pages","append-to-body":!0,"onUpdate:modelValue":S[14]||(S[14]=O=>l("update:modelValue",O))},{footer:d(()=>[n(I,{onClick:S[13]||(S[13]=O=>l("update:modelValue",!1))},{default:d(()=>[R(m(A(u)("Cancel")),1)]),_:1}),n(I,{type:"primary",loading:p.value,onClick:k},{default:d(()=>[R(m(e.editRow?A(u)("Save changes"):A(u)("Add override")),1)]),_:1},8,["loading"])]),default:d(()=>[n(V,{"label-position":"top",model:s.value},{default:d(()=>[n(F,{label:A(u)("Override type")},{default:d(()=>[n(D,{modelValue:s.value.type,"onUpdate:modelValue":S[0]||(S[0]=O=>s.value.type=O)},{default:d(()=>[n($,{value:"products"},{default:d(()=>[R(m(A(u)("Products")),1)]),_:1}),n($,{value:"shipping"},{default:d(()=>[R(m(A(u)("Shipping")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.value.type==="products"?(r(),h(P,{key:0},[n(F,{label:A(u)("Category")},{default:d(()=>[n(U,{modelValue:s.value.category_id,"onUpdate:modelValue":S[1]||(S[1]=O=>s.value.category_id=O),filterable:"",placeholder:A(u)("Select a category"),loading:c.value,style:{width:"100%"},onChange:w},{default:d(()=>[(r(!0),h(P,null,te(i.value,O=>(r(),E(B,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","loading"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),E(F,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(U,{modelValue:s.value.class_id,"onUpdate:modelValue":S[2]||(S[2]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[n(B,{value:0,label:A(u)("All Tax Classes")},null,8,["label"]),(r(!0),h(P,null,te(e.taxClasses,O=>(r(),E(B,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),n(F,{label:A(u)("Tax label")},{default:d(()=>[n(Q,{modelValue:s.value.tax_label,"onUpdate:modelValue":S[3]||(S[3]=O=>s.value.tax_label=O),placeholder:A(u)("e.g. Tax, VAT, GST")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Location")},{default:d(()=>[n(U,{modelValue:s.value.country,"onUpdate:modelValue":S[4]||(S[4]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(e.countries,O=>(r(),E(B,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("City (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.city,"onUpdate:modelValue":S[5]||(S[5]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":S[6]||(S[6]=O=>s.value.postcode=O),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":S[7]||(S[7]=O=>s.value.tax_rate=O),type:"number",step:"0.01",min:"0",placeholder:A(u)("e.g. 0 for tax exempt")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])],64)):(r(),h(P,{key:1},[n(F,{label:A(u)("Location")},{default:d(()=>[n(U,{modelValue:s.value.country,"onUpdate:modelValue":S[8]||(S[8]=O=>s.value.country=O),placeholder:A(u)("Select country"),filterable:"",style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(e.countries,O=>(r(),E(B,{key:O.value,label:O.label,value:O.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),e.taxClasses.length>0?(r(),E(F,{key:0,label:A(u)("Tax Class")},{default:d(()=>[n(U,{modelValue:s.value.class_id,"onUpdate:modelValue":S[9]||(S[9]=O=>s.value.class_id=O),style:{width:"100%"}},{default:d(()=>[(r(!0),h(P,null,te(e.taxClasses,O=>(r(),E(B,{key:O.id,value:Number(O.id),label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):x("",!0),n(F,{label:A(u)("City (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.city,"onUpdate:modelValue":S[10]||(S[10]=O=>s.value.city=O),placeholder:A(u)("Leave empty to match all cities")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Postcode (optional)")},{default:d(()=>[n(Q,{modelValue:s.value.postcode,"onUpdate:modelValue":S[11]||(S[11]=O=>s.value.postcode=O),placeholder:A(u)("e.g. 9300 or 9300-9399 or 9300,9400")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(F,{label:A(u)("Tax rate (%)")},{default:d(()=>[n(Q,{modelValue:s.value.tax_rate,"onUpdate:modelValue":S[12]||(S[12]=O=>s.value.tax_rate=O),type:"number",step:"0.01",min:"0"},null,8,["modelValue"])]),_:1},8,["label"])],64))]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}},p_e={class:"fct-tax-rates-country-view"},f_e={key:0,class:"border border-gray-200 rounded-md overflow-hidden dark:border-dark-300"},m_e={class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-3 border-b border-gray-200 dark:border-dark-300"},h_e={key:0},__e={key:1},v_e={class:"fct-btn-group sm justify-end"},g_e={__name:"EUVatTaxOverridesCard",props:{countries:{type:Array,default:()=>[]}},setup(e){const t=e,a=T([]),l=T(!1),s=T(!1),i=T(null),c=T([]);function p(w){if(!w||!Array.isArray(t.countries))return w;const k=t.countries.find(b=>b.value===w);return k?k.label:w}function f(){Ae.get("tax/classes").then(w=>{c.value=w.classes||[]}).catch(()=>{q.error(u("Failed to load tax classes"))})}function _(){l.value=!0,Ae.get("tax/configuration/settings/eu-vat/product-overrides").then(w=>{const k=[],b=w.overrides||[];for(const $ of b){const D=$.meta_value||$;k.push({id:$.id,type:"products",tax_label:D.tax_label||"",category_name:D.category_name||"",location:p(D.country),city:D.city||"",postcode:D.postcode||"",rate:D.rate,class_id:Number($.class_id)||0,class_label:$.class_label||"",_raw:$})}const S=w.shipping_overrides||[];for(const $ of S)k.push({id:$.id,type:"shipping",tax_label:$.name||"",category_name:"",location:p($.country),city:$.city||"",postcode:$.postcode||"",rate:$.for_shipping,class_id:Number($.class_id)||0,class_label:$.class_label||"",_raw:$});a.value=k}).catch(()=>{a.value=[]}).finally(()=>{l.value=!1})}function g(){i.value=null,s.value=!0}function y(w){i.value=w,s.value=!0}function v(w){ul(u("Are you sure you want to delete this override?"),u("Confirm Delete"),{confirmButtonText:u("Yes, Delete"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{const k=w.type==="shipping"?"tax/rates/country/override/"+w.id:"tax/product-overrides/"+w.id;Ae.delete(k).then(b=>{q.success(b.message),a.value=a.value.filter(S=>!(S.id===w.id&&S.type===w.type))}).catch(b=>{var S;q.error((S=b==null?void 0:b.data)==null?void 0:S.message)})}).catch(()=>{})}return Ie(()=>{f(),_()}),(w,k)=>{const b=C("el-button"),S=C("el-tag"),$=C("el-table-column"),D=C("el-table");return r(),h(P,null,[n(Se,{class:"fct-vat-card"},{default:d(()=>[n(Ve,{title:A(u)("Tax overrides"),text:A(u)("Override tax rates for specific product categories or shipping.")},{action:d(()=>[n(b,{size:"small",onClick:g},{default:d(()=>[R(m(A(u)("Add Tax Override")),1)]),_:1})]),_:1},8,["title","text"]),n(ke,null,{default:d(()=>[o("div",p_e,[l.value?(r(),h("div",f_e,[o("div",m_e,[(r(),h(P,null,te(6,F=>o("div",{key:"loading-header-"+F,class:"fct-sk h-3 rounded-xs"})),64))]),(r(),h(P,null,te(3,F=>o("div",{key:"loading-row-"+F,class:"grid grid-cols-[110px_1fr_1fr_1fr_100px_110px] gap-4 px-4 py-4 border-b border-gray-100 last:border-b-0 dark:border-dark-400"},k[2]||(k[2]=[o("div",{class:"fct-sk w-16 h-6 rounded-full"},null,-1),o("div",{class:"fct-sk w-28 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-24 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-12 h-3.5 rounded-xs"},null,-1),o("div",{class:"fct-sk w-4 h-4 rounded-xs justify-self-end"},null,-1)]))),64))])):(r(),E(D,{key:1,data:a.value,"empty-text":A(u)("No overrides configured")},{default:d(()=>[n($,{label:A(u)("Type"),width:"110"},{default:d(({row:F})=>[n(S,{type:F.type==="products"?"primary":"info",size:"small"},{default:d(()=>[R(m(F.type==="products"?A(u)("Product"):A(u)("Shipping")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),n($,{label:A(u)("Category")},{default:d(({row:F})=>[R(m(F.category_name||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Class"),width:"130"},{default:d(({row:F})=>[R(m(F.class_label||A(u)("All")),1)]),_:1},8,["label"]),n($,{label:A(u)("Tax Label")},{default:d(({row:F})=>[R(m(F.tax_label||"—"),1)]),_:1},8,["label"]),n($,{label:A(u)("Location")},{default:d(({row:F})=>[R(m(F.location),1)]),_:1},8,["label"]),n($,{label:A(u)("City / Postcode")},{default:d(({row:F})=>[F.city||F.postcode?(r(),h("span",h_e,m([F.city,F.postcode].filter(Boolean).join(" / ")),1)):(r(),h("span",__e,"—"))]),_:1},8,["label"]),n($,{label:A(u)("Rate"),width:"100"},{default:d(({row:F})=>[R(m(F.rate)+"% ",1)]),_:1},8,["label"]),n($,{label:A(u)("Actions"),width:"110",align:"right"},{default:d(({row:F})=>[o("div",v_e,[n(at,{tag:"button",size:"small",onClick:B=>y(F)},{default:d(()=>[n(Y,{name:"Edit"})]),_:2},1032,["onClick"]),n(at,{tag:"button",size:"small",onClick:B=>v(F),bg:"danger",outline:""},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick"])])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]))])]),_:1})]),_:1}),n(A_e,{modelValue:s.value,"onUpdate:modelValue":[k[0]||(k[0]=F=>s.value=F),k[1]||(k[1]=F=>!F&&(i.value=null))],countries:e.countries,"tax-classes":c.value,"edit-row":i.value,onSaved:_},null,8,["modelValue","countries","tax-classes","edit-row"])],64)}}},y_e={class:"setting-wrap"},b_e={class:"setting-wrap-inner"},w_e={class:"fct-tax-collection-page"},C_e={__name:"EUVatSettings",setup(e){const t=T(!0),a=ze.get("eu_vat_county_options",[]),l=T(""),s=T(""),i=T([]),c=T({}),p=K(()=>!!ze.get("is_tax_enabled"));function f(){return t.value=!0,Ae.get("tax/configuration/settings").then(g=>{var v;const y=((v=g.settings)==null?void 0:v.eu_vat_settings)||{};l.value=g.store_country||"",i.value=y.country_registrations||[],c.value=y,s.value=y.method||""}).catch(g=>{var y;q.error((y=g==null?void 0:g.data)==null?void 0:y.message)}).finally(()=>{t.value=!1})}function _({method:g}){s.value=g||"",f()}return Ie(f),(g,y)=>(r(),h("div",y_e,[n(Ua,{heading:A(u)("VAT collection"),"show-save-button":!1},null,8,["heading"]),o("div",b_e,[n(Ia),o("div",w_e,[t.value?(r(),E(Dme,{key:0})):(r(),h(P,{key:1},[n(c_e,{countries:A(a),"initial-form":c.value,"initial-registrations":i.value,"store-country":l.value,"is-tax-enabled":p.value,onMethodChanged:_},null,8,["countries","initial-form","initial-registrations","store-country","is-tax-enabled"]),n(g_e,{countries:A(a),class:"mt-5"},null,8,["countries"])],64))])])]))}};class k_e extends Vs{getTabs(){return{all:u("All"),active:u("Active"),expired:u("Inactive")}}getToggleableColumns(){return[{label:"Title",value:"title"},{label:"Stackable",value:"stackable"},{label:"Actions",value:"actions"}]}getSearchHint(){return u("Search by id, title, amount, code.")}getFetchUrl(){return"coupons"}parseResponse(t){return t.coupons}getTableName(){return"coupon_table"}getAdvanceFilterOptions(){return null}getSearchGuideOptions(){return[]}with(){return[]}}function kf(e){return k_e.init(e)}const B_e={class:"fct-table-mobile-wrap fct-coupons-table-mobile-wrap"},x_e={class:"fct-table-mobile-header"},S_e={class:"fct-table-mobile-header-left"},F_e={class:"fct-table-id-col"},$_e={class:"fct-table-status-col"},E_e=["onClick"],U_e={class:"title"},I_e={class:"value"},Q_e={key:0,class:"fct-table-action-col"},D_e={class:"more-btn pr-0"},V_e={class:"fct-table-mobile-body"},T_e=["onClick"],M_e={key:0,class:"fct-table-coupon-title-col"},L_e={class:"fct-table-coupon-code-col"},R_e=["onClick"],O_e={class:"fct-table-mobile-footer"},P_e=["onClick"],H_e={class:"fct-table-date-col grid"},N_e={class:"title"},K_e={class:"value"},G_e={key:0,class:"fct-table-stackable-col"},z_e={class:"title"},j_e={class:"value"},q_e={class:"fct-table-amount-col"},Y_e={class:"title"},W_e={class:"value"},J_e={__name:"CouponsTableMobile",props:{table:{type:Object,required:!0},emptyText:{type:String,default:u("No customers found.")}},setup(e){lt.extend(Ai);const t=e,a=s=>{if(!s||s==="0000-00-00 00:00:00")return!1;const i=lt.utc(s).local();return i.isValid()?i.isBefore(lt()):!1},l=s=>{let i=u("Are you sure you want to delete this %s coupon. This action is not recoverable",s.coupon.title);s.action==="delete"&&ul(i,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Ae.delete("coupons/"+s.coupon.id).then(c=>{q.success(c.message),t.table.fetch()}).catch(c=>{q.error(c)}).finally(()=>{})}).catch(()=>{})};return(s,i)=>{const c=C("router-link"),p=C("el-tooltip"),f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",B_e,[(r(!0),h(P,null,te(e.table.getTableData(),(y,v)=>(r(),h("div",{key:y.id,class:"fct-table-mobile-row"},[o("div",x_e,[o("div",S_e,[o("div",F_e,[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id}},class:"id"},{default:d(()=>[R(" #"+m(y.id),1)]),_:2},1032,["to"])]),o("div",$_e,[n(fa,{status:y.status},{default:d(()=>[R(m(a(y.end_date)?A(u)("Expired"):y.status),1)]),_:2},1032,["status"]),y.status==="scheduled"?(r(),E(p,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(m(A(u)("Available On: %s",A(Us)(y.start_date,!0))),1)]),default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),o("div",{class:"fct-table-usage-col",onClick:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",U_e,m(A(u)("Usage:")),1),o("div",I_e,[R(m(y.use_count??0)+" ",1),i[0]||(i[0]=o("span",null,"/",-1)),R(" "+m(y.conditions.max_uses>0?y.conditions.max_uses:A(u)("Unlimited")),1)])],8,E_e)]),e.table.isColumnVisible("actions")?(r(),h("div",Q_e,[n(g,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(_,null,{default:d(()=>[y.id?(r(),E(f,{key:0,class:"item-link"},{default:d(()=>[n(c,{to:{name:"add_or_edit_coupon",params:{coupon_id:y.id,action:"edit"}}},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),n(f,{command:{action:"delete",coupon:y},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",D_e,[n(Y,{name:"More"})])]),_:2},1024)])):x("",!0)]),o("div",V_e,[o("div",{class:"fct-table-coupon-code-wrapper-col",onClick:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[e.table.isColumnVisible("title")?(r(),h("div",M_e,m(y.title),1)):x("",!0),o("div",L_e,[o("code",{class:"copyable-content",onClick:w=>{A(as).copy(y.code)}},m(y.code),9,R_e)])],8,T_e)]),o("div",O_e,[o("div",{class:"fct-table-mobile-footer-row items-start",onClick:w=>s.$router.push({name:"add_or_edit_coupon",params:{coupon_id:y.id}})},[o("div",H_e,[o("div",N_e,m(A(u)("Expiry Date")),1),o("div",K_e,[isNaN(Date.parse(y.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Pa,{key:0,"date-time":y.end_date,"with-time":!0},null,8,["date-time"]))])]),e.table.isColumnVisible("stackable")?(r(),h("div",G_e,[o("div",z_e,m(A(u)("Stackable")),1),o("div",j_e,m(y.stackable),1)])):x("",!0),o("div",q_e,[o("div",Y_e,m(A(u)("Amount")),1),o("div",W_e,m(y.type!=="percentage"?A(Kt)(y.amount,!0):y.amount+"%"),1)])],8,P_e)])]))),128))])}}},X_e={},Z_e={class:"px-4 py-3"},eve={class:"grid grid-cols-3 gap-5 mt-5"};function tve(e,t){const a=C("el-skeleton-item"),l=C("el-skeleton");return r(),E(l,{animated:""},{template:d(()=>[o("div",Z_e,[(r(),h(P,null,te(2,s=>o("div",{key:s,class:"flex items-center justify-between mb-3"},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64)),o("div",eve,[(r(),h(P,null,te(3,s=>o("div",{key:s},[n(a,{varient:"p",class:"w-1/2"}),n(a,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const ave=nt(X_e,[["render",tve]]),lve={class:"fct-all-coupons-page fct-layout-width"},sve={class:"fct-all-coupons-wrap"},nve={key:1},ove=["onClick"],ive={class:"capitalize"},rve={class:"more-btn mr-2"},Fc={__name:"AllCoupons",setup(e){lt.extend(Ai);const t=kf(),a=T(!1),l=c=>{let p=u("Are you sure you want to delete this %s coupon. This action is not recoverable",c.coupon.title);c.action==="delete"&&ul(p,u("Confirm Delete!"),{confirmButtonText:u("Yes, Delete!"),cancelButtonText:u("Cancel"),type:"warning"}).then(()=>{Ae.delete("coupons/"+c.coupon.id).then(f=>{q.success(f.message),t.fetch()}).catch(f=>{var _;f.status_code=="422"?q.validationErrors(f):q.error((_=f.data)==null?void 0:_.message)}).finally(()=>{})}).catch(()=>{})},s=()=>{Ae.get("coupons/getSettings").then(c=>{a.value=!!parseInt(c.show_on_checkout)}).catch(c=>{var p;c.status_code=="422"?q.validationErrors(c):q.error((p=c.data)==null?void 0:p.message)}).finally(()=>{})},i=c=>{if(!c||c==="0000-00-00 00:00:00")return!1;const p=lt.utc(c).local();return p.isValid()?p.isBefore(lt()):!1};return Ie(()=>{s()}),(c,p)=>{const f=C("el-button"),_=C("el-table-column"),g=C("el-tooltip"),y=C("router-link"),v=C("el-dropdown-item"),w=C("el-dropdown-menu"),k=C("el-dropdown"),b=C("el-table");return r(),E(Ot,{permission:"coupons/view"},{default:d(()=>[o("div",lve,[n(ol,{title:A(u)("Coupons")},{action:d(()=>[n(f,{tag:"router-link",type:"primary",to:{name:"add_or_edit_coupon"}},{default:d(()=>[R(m(A(u)("Add Coupon")),1)]),_:1})]),_:1},8,["title"]),o("div",sve,[n(Ts,{table:A(t),"has-mobile-slot":!0},{mobile:d(()=>[A(t).isLoading()?(r(),E(ave,{key:0})):x("",!0),A(t).isLoading()?x("",!0):(r(),E(J_e,{key:1,table:A(t)},null,8,["table"]))]),default:d(()=>[A(t).isLoading()?(r(),E(sme,{key:0,couponTable:A(t),"next-page-count":A(t).nextPageCount},null,8,["couponTable","next-page-count"])):(r(),h("div",nve,[n(b,{data:A(t).getTableData(),class:"w-full compact-table full-compact"},{empty:d(()=>[n(Ct,{icon:"Empty/Order","has-dark":"",text:A(u)("No coupons available at the moment.")},null,8,["text"])]),default:d(()=>[n(_,{width:100,label:A(u)("ID")},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id}}},{default:d(()=>[R(" #"+m(A(sa)(S.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("title")?(r(),E(_,{key:0,label:A(u)("Title"),width:220},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[R(m(S.row.title),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),n(_,{label:A(u)("Code"),width:200},{default:d(S=>[o("code",{class:"copyable-content",onClick:$=>{A(as).copy(S.row.code)}},m(S.row.code),9,ove)]),_:1},8,["label"]),n(_,{label:A(u)("Amount"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[R(m(S.row.type!=="percentage"?A(Kt)(S.row.amount,!0):S.row.amount+"%"),1)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Usage"),width:150},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",null,m(A(sa)(S.row.use_count??0)),1),p[0]||(p[0]=o("span",{class:"px-1"},"/",-1)),o("span",null,m(S.row.conditions.max_uses>0?S.row.conditions.max_uses:A(u)("Unlimited")),1)]),_:2,__:[0]},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("stackable")?(r(),E(_,{key:1,label:A(u)("Stackable"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",ive,m(S.row.stackable),1)]),_:2},1032,["to"])]),_:1},8,["label"])):x("",!0),n(_,{label:A(u)("Status"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[n(fa,{status:S.row.status},{default:d(()=>[R(m(i(S.row.end_date)?A(u)("Expired"):S.row.status),1)]),_:2},1032,["status"]),S.row.status==="scheduled"?(r(),E(g,{key:0,effect:"dark",placement:"top","popper-class":"fct-label-hint-popover fct-tooltip","show-after":400,"hide-after":0},{content:d(()=>[R(m(A(u)("Available On: %s",A(Us)(S.row.start_date,!0))),1)]),default:d(()=>[n(Y,{name:"InformationFill",class:"w-4 h-4 flex-none"})]),_:2},1024)):x("",!0)]),_:2},1032,["to"])]),_:1},8,["label"]),n(_,{label:A(u)("Expiry Date"),width:120},{default:d(S=>[n(Ba,{class:"hover:no-underline",to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[o("span",null,[isNaN(Date.parse(S.row.end_date))?(r(),h(P,{key:1},[R("n/a")],64)):(r(),E(Pa,{key:0,"date-time":S.row.end_date,"with-time":!0},null,8,["date-time"]))])]),_:2},1032,["to"])]),_:1},8,["label"]),A(t).isColumnVisible("actions")?(r(),E(_,{key:2,label:A(u)("Actions"),width:100,align:"right",fixed:"right"},{default:d(S=>[n(k,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:l,placement:"bottom-end"},{dropdown:d(()=>[n(w,null,{default:d(()=>[S.row.id?(r(),E(v,{key:0,class:"item-link"},{default:d(()=>[n(y,{to:{name:"add_or_edit_coupon",params:{coupon_id:S.row.id,action:"edit"}}},{default:d(()=>[n(Y,{name:"Edit"}),R(" "+m(A(u)("Edit")),1)]),_:2},1032,["to"])]),_:2},1024)):x("",!0),n(v,{command:{action:"delete",coupon:S.row},class:"item-destructive"},{default:d(()=>[n(Y,{name:"Delete"}),R(" "+m(A(u)("Delete")),1)]),_:2},1032,["command"])]),_:2},1024)]),default:d(()=>[o("span",rve,[n(Y,{name:"More"})])]),_:2},1024)]),_:1},8,["label"])):x("",!0)]),_:1},8,["data"])]))]),_:1},8,["table"])])])]),_:1})}}},dve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},uve={class:"single-page-header"},cve={class:"single-page-body"},Ave={class:"fct-add-edit-coupon"},pve={class:"fct-add-edit-coupon-main"},fve={class:"fct-add-edit-coupon-aside"},mve={class:"fct-admin-sidebar"},hve={__name:"SingleCouponLoader",setup(e){return(t,a)=>{const l=C("el-skeleton-item"),s=C("el-skeleton"),i=C("el-breadcrumb-item"),c=C("el-breadcrumb");return r(),h("div",dve,[o("div",uve,[n(c,{"separator-icon":A(Al)},{default:d(()=>[n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[90px] h-4"})]),_:1})]),_:1}),n(i,null,{default:d(()=>[n(s,{animated:!0},{template:d(()=>[n(l,{variant:"p",class:"w-[60px] h-4"})]),_:1})]),_:1})]),_:1},8,["separator-icon"])]),o("div",cve,[o("div",Ave,[o("div",pve,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Discount Value"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1}),n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"}),n(l,{variant:"p",class:"max-w-[400px] h-4"}),n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})]),o("div",fve,[o("div",mve,[n(Se,null,{default:d(()=>[n(Ve,{title:A(u)("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n(ke,null,{default:d(()=>[n(s,{animated:!0,class:"flex flex-col gap-3"},{template:d(()=>[n(l,{variant:"p",class:"w-full h-4"}),n(l,{variant:"p",class:"w-2/3 h-4"}),n(l,{variant:"p",class:"w-1/3 h-4"})]),_:1})]),_:1})]),_:1})])])])])])}}};lt.extend(Ai);lt.extend(pA);const _ve={name:"AddOrEditCoupon",components:{CardContainer:Se,CardHeader:Ve,CardBody:ke,LabelHint:pa,ValidationError:Aa,CopyToClipboard:Ea,DynamicTemplates:pn,SaveBar:un,ProductVariationSelector:fA,SingleCouponLoader:hve,Activity:iA},beforeRouteLeave(e,t,a){var l;(l=this.keyboardShortcuts)!=null&&l.unbind&&this.keyboardShortcuts.unbind("mod+s"),a()},props:{coupon_id:{type:[String,Number],required:!0}},data(){return{changes_made:0,creating:!1,updating:!1,keyboardShortcuts:null,coupon:{type:"fixed",status:"active",stackable:"no",show_on_checkout:"no",title:"",code:"",priority:0,amount:0,start_date:"",end_date:"",notes:"",conditions:{buy_quantity:1,get_quantity:1,excluded_categories:[],included_categories:[],excluded_products:[],included_products:[],min_purchase_amount:"",max_purchase_amount:"",min_amount_basis:"subtotal",allowed_user_ids:[],allowed_user_roles:[],apply_to_quantity:"no",apply_to_whole_cart:"yes",max_per_customer:"",max_discount_amount:"",max_uses:"",buy_products:[],get_products:[],is_recurring:"no"}},validationErrors:{},minQuantity:1,maxQuantity:100,minPurchaseAmount:0,maxPurchaseAmount:1e4,minDiscountAmount:0,minLimit:0,maxLimit:1e3,categories:[],usageError:!1,isEndDateEnabled:!1,fetchingCoupon:!1,isInitialLoading:!1,showDynamicTemplates:!1,showManageActivity:!1}},computed:{ArrowRight(){return Al},maxDiscountAmount(){return this.coupon.type==="percentage"?100:999999}},watch:{coupon:{handler(){this.handleChangesMade()},deep:!0}},mounted(){this.keyboardShortcuts=bs(),this.fetchTerms(),this.coupon_id?(this.fetchCoupon(),this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.updateCoupon()}),window.onbeforeunload=()=>{if(this.changes_made>1)return!0}):this.keyboardShortcuts.bind(["mod+s"],e=>{e.preventDefault(),this.addCoupon()})},methods:{translate:u,generateRandomCouponCode(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let t="";for(let a=0;a<8;a++)t+=e.charAt(Math.floor(Math.random()*e.length));this.coupon.code=t},onChangeCouponInput(e,t){if(t=parseInt(t),isNaN(t)||t===""){this.coupon[e]="";return}if(e==="priority"&&(t<0||t>100)){this.coupon[e]=0;return}if((e==="buy_quantity"||e==="get_quantity")&&(t<this.minQuantity||t>this.maxQuantity)){this.coupon[e]=this.minQuantity;return}if((e==="min_purchase_amount"||e==="max_discount_amount")&&(t<this.minPurchaseAmount||t>this.maxPurchaseAmount)){this.coupon.conditions[e]=this.minPurchaseAmount;return}if(e==="amount"){if(this.coupon.type==="fixed"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}if(this.coupon.type==="percentage"&&(t<this.minDiscountAmount||t>this.maxDiscountAmount)){this.coupon[e]=this.minDiscountAmount;return}}if((e==="max_uses"||e==="max_per_customer")&&(t<this.minLimit||t>this.maxLimit)){this.coupon[e]=this.minLimit;return}},preventInvalidChars(e,t=!1){let a=["-",".","+"];t&&(a=["-","+"]),a.includes(e.key)&&e.preventDefault()},handleChangesMade(){this.changes_made++},setDefaultStatus(){const e=new Date,t=this.coupon.start_date?new Date(this.coupon.start_date):null,a=this.coupon.end_date?new Date(this.coupon.end_date):null;this.coupon.status!=="disabled"&&(a===null&&(this.isEndDateEnabled=!1),!t&&!a?this.coupon.status="active":t&&e<t?this.coupon.status="scheduled":a&&e>a?this.coupon.status="expired":this.coupon.status="active")},disabledStartDate(e){const t=new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},disabledEndDate(e){const t=this.coupon.start_date?new Date(this.coupon.start_date):new Date;return t.setHours(0,0,0,0),e&&e.getTime()<t.getTime()},formatDate(e){return!e||e==="0000-00-00 00:00:00"?null:lt(e).format("YYYY-MM-DD HH:mm:ssZ")},formatAmount(){this.coupon.amount!==null&&(this.coupon.type!=="percentage"&&(this.coupon.amount=Kt(this.coupon.amount,!1)),this.coupon.conditions.min_purchase_amount!==null&&(this.coupon.conditions.min_purchase_amount?this.coupon.conditions.min_purchase_amount=Kt(this.coupon.conditions.min_purchase_amount,!1):this.coupon.conditions.min_purchase_amount=""),this.coupon.conditions.max_discount_amount!==null&&(this.coupon.conditions.max_discount_amount?this.coupon.conditions.max_discount_amount=Kt(this.coupon.conditions.max_discount_amount,!1):this.coupon.conditions.max_discount_amount=""),this.coupon.conditions.max_purchase_amount||(this.coupon.conditions.max_purchase_amount=""),this.coupon.conditions.max_uses||(this.coupon.conditions.max_uses=""),this.coupon.conditions.max_per_customer||(this.coupon.conditions.max_per_customer=""),this.coupon.conditions.min_purchase_amount||(this.coupon.conditions.min_purchase_amount=""))},parseProductIds(e){return Array.isArray(e)?e.map(t=>parseInt(t,10)):[]},reloadPage(){return window.location.reload()},validateAndFormatDate(e){let t=this.formatDate(e);return t!==null&&t!=="Invalid date"?t:null},validateDate(){this.coupon.start_date=this.validateAndFormatDate(this.coupon.start_date),this.coupon.end_date=this.validateAndFormatDate(this.coupon.end_date)},fetchTerms(){Ae.get("products/fetch-term").then(e=>{this.categories=e.taxonomies["product-categories"].terms}).catch(e=>{var t;e.status_code=="422"?q.validationErrors(e):q.error((t=e.data)==null?void 0:t.message)}).finally(()=>{})},fetchCoupon(){this.fetchingCoupon=!0,this.isInitialLoading=!0,Ae.get(`coupons/${this.coupon_id}`,{}).then(e=>{var l,s;const t=(l=e==null?void 0:e.coupon)==null?void 0:l.start_date,a=(s=e==null?void 0:e.coupon)==null?void 0:s.end_date;t&&t!=="0000-00-00 00:00:00"&&(e.coupon.start_date=lt.utc(t).tz(lt.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),a&&a!=="0000-00-00 00:00:00"&&(e.coupon.end_date=lt.utc(a).tz(lt.tz.guess()).format("YYYY-MM-DD HH:mm:ss")),e=e.coupon,this.coupon=e,this.coupon.start_date=this.formatDate(this.coupon.start_date),this.coupon.end_date=this.formatDate(this.coupon.end_date),this.coupon.end_date!==null&&(this.isEndDateEnabled=!0),this.coupon.end_date=this.coupon.end_date!==null&&this.coupon.end_date!=="Invalid date"?this.coupon.end_date:null,this.coupon.conditions.excluded_products=this.parseProductIds(e.conditions.excluded_products),this.coupon.conditions.included_products=this.parseProductIds(e.conditions.included_products),this.coupon.conditions.min_amount_basis||(this.coupon.conditions.min_amount_basis="total"),this.formatAmount(),this.setDefaultStatus(),this.showDynamicTemplates=!0}).catch(e=>{var t;errors.status_code=="422"?q.validationErrors(errors):q.error((t=errors.data)==null?void 0:t.message)}).finally(()=>{this.fetchingCoupon=!1,this.isInitialLoading=!1,this.changes_made=0})},updateCoupon(){var e,t;this.updating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),Ae.put(`coupons/${this.coupon_id}`,{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.validationErrors={},this.setDefaultStatus(),this.changes_made=0}).catch(a=>{var l;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.updating=!1,this.changes_made=0})},addCoupon(){var e,t;this.creating=!0,this.validateDate(),(e=this.$refs.dynamic_templates)==null||e.beforeUpdatingData({data:{coupon:this.coupon}}),Ae.post("coupons",{...this.coupon,metaValue:(t=this.$refs.dynamic_templates)==null?void 0:t.getFormStates()}).then(a=>{var l;(l=this.$refs.dynamic_templates)==null||l.afterUpdatingData({coupon:this.coupon,response:a}),q.success(a.message),this.$router.push({name:"coupons"}),this.validationErrors={}}).catch(a=>{var l;a.status_code=="422"?(q.validationErrors(a),this.validationErrors=a):q.error((l=a.data)==null?void 0:l.message)}).finally(()=>{this.creating=!1})}}},vve={class:"fct-add-edit-coupon-wrapper fct-layout-width"},gve={class:"single-page-header"},yve={class:"single-page-body"},bve={class:"fct-add-edit-coupon"},wve={class:"fct-add-edit-coupon-main"},Cve={class:"flex gap-2 items-center justify-between w-full mb-2.5"},kve={class:"form-note"},Bve=["innerHTML"],xve={key:1},Sve=["innerHTML"],Fve=["innerHTML"],$ve=["innerHTML"],Eve={class:"fct-add-edit-coupon-aside"},Uve={class:"fct-admin-sidebar"},Ive={class:"fct-admin-sidebar-item"},Qve={key:0,class:"flex items-center gap-1"},Dve={class:"text-sm font-medium text-system-dark dark:text-gray-300"},Vve={key:1},Tve={class:"fct-admin-sidebar-item mt-5 hidden"},Mve={class:"sidebar-title mb-3"},Lve={class:"fct-bullet-lists"},Rve={class:"fct-admin-sidebar-item mt-5 hidden"},Ove={class:"sidebar-title mb-3"},Pve={class:"fct-bullet-lists"},Hve={key:0};function Nve(e,t,a,l,s,i){const c=C("SaveBar"),p=C("SingleCouponLoader"),f=C("el-breadcrumb-item"),_=C("el-breadcrumb"),g=C("CardHeader"),y=C("el-input"),v=C("ValidationError"),w=C("el-form-item"),k=C("el-col"),b=C("LabelHint"),S=C("el-row"),$=C("CardBody"),D=C("CardContainer"),F=C("el-option"),B=C("el-select"),U=C("el-radio"),Q=C("el-radio-group"),V=C("ProductVariationSelector"),I=C("el-checkbox"),M=C("el-form"),O=C("CopyToClipboard"),L=C("el-date-picker"),H=C("DynamicTemplates"),j=C("Activity");return r(),h("div",vve,[n(c,{isActive:s.changes_made>0?"is-active":"",loading:a.coupon_id?s.updating:s.creating,onSave:t[0]||(t[0]=W=>a.coupon_id?i.updateCoupon():i.addCoupon()),onDiscard:i.reloadPage,"show-cmnd-icon":!0,saveButtonText:a.coupon_id?i.translate("Update"):i.translate("Create")},null,8,["isActive","loading","onDiscard","saveButtonText"]),s.fetchingCoupon?(r(),E(p,{key:0})):x("",!0),s.fetchingCoupon?x("",!0):(r(),h(P,{key:1},[o("div",gve,[n(_,{"separator-icon":i.ArrowRight},{default:d(()=>[n(f,{to:{name:"coupons"}},{default:d(()=>[R(m(i.translate("Coupons")),1)]),_:1}),n(f,null,{default:d(()=>[R(m(a.coupon_id?i.translate("Edit Coupon"):i.translate("Add Coupon")),1)]),_:1}),a.coupon_id?(r(),E(f,{key:0},{default:d(()=>[R(m(s.coupon.title),1)]),_:1})):x("",!0)]),_:1},8,["separator-icon"])]),o("div",yve,[o("div",bve,[o("div",wve,[n(M,{model:s.coupon,"label-position":"top","require-asterisk-position":"right"},{default:d(()=>[n(D,null,{default:d(()=>[n(g,{title:i.translate("Basic Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Title"),required:""},{default:d(()=>{var W,G;return[n(y,{modelValue:s.coupon.title,"onUpdate:modelValue":t[1]||(t[1]=Z=>s.coupon.title=Z),placeholder:i.translate("Enter title"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("title")?"is-error":""),maxlength:"50",id:"title"},null,8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("title")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"title"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),n(k,{lg:12},{default:d(()=>[n(w,null,{default:d(()=>{var W,G;return[o("div",Cve,[n(b,{title:i.translate("Code"),required:""},null,8,["title"]),o("span",{class:"text-system-dark text-xs cursor-pointer hover:underline dark:text-gray-50 underline",onClick:t[2]||(t[2]=(...Z)=>i.generateRandomCouponCode&&i.generateRandomCouponCode(...Z))},m(i.translate("Generate Random Code")),1)]),n(y,{modelValue:s.coupon.code,"onUpdate:modelValue":t[3]||(t[3]=Z=>s.coupon.code=Z),placeholder:i.translate("Eg. COUPON10"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("code")?"is-error":""),maxlength:"20"},null,8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("code")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"code"},null,8,["validation-errors"])):x("",!0),o("div",kve,[o("p",null,m(i.translate("Customers must enter this code at checkout.")),1)])]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Coupon Priority"),content:i.translate("Coupons will be calculated based on their priority. The lower the number the higher the priority is.")},null,8,["title","content"])]),default:d(()=>{var W,G;return[n(y,{modelValue:s.coupon.priority,"onUpdate:modelValue":t[4]||(t[4]=Z=>s.coupon.priority=Z),type:"number",placeholder:i.translate("Enter priority"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("priority")?"is-error":""),min:"0",max:"100",onInput:t[5]||(t[5]=Z=>{i.onChangeCouponInput("priority",Z)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","onKeypress"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("priority")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"priority"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(D,null,{default:d(()=>[n(g,{title:i.translate("Discount Details"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:8},{default:d(()=>[n(w,{label:i.translate("Type"),required:""},{default:d(()=>{var W;return[n(B,{modelValue:s.coupon.type,"onUpdate:modelValue":t[6]||(t[6]=G=>s.coupon.type=G),placeholder:i.translate("Select coupon type"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("type")?"is-error":""),"default-first-option":""},{default:d(()=>[n(F,{label:i.translate("Fixed"),value:"fixed"},null,8,["label"]),n(F,{label:i.translate("Percentage"),value:"percentage"},null,8,["label"])]),_:1},8,["modelValue","placeholder","class"])]}),_:1},8,["label"])]),_:1}),s.coupon.type==="fixed"||s.coupon.type==="percentage"?(r(),h(P,{key:0},[n(k,{lg:8},{default:d(()=>[n(w,{label:s.coupon.type==="percentage"?i.translate("Discount Percentage (%)"):i.translate("Discount Amount"),required:""},{default:d(()=>{var W;return[n(y,{modelValue:s.coupon.amount,"onUpdate:modelValue":t[7]||(t[7]=G=>s.coupon.amount=G),type:"number",placeholder:"0.00",min:s.minDiscountAmount,max:i.maxDiscountAmount,step:"0.01",onInput:t[8]||(t[8]=G=>{i.onChangeCouponInput("amount",G)}),onKeypress:t[9]||(t[9]=G=>i.preventInvalidChars(G,!0))},{prefix:d(()=>[s.coupon.type==="fixed"?(r(),h("span",{key:0,innerHTML:e.appVars.shop.currency_sign},null,8,Bve)):(r(),h("span",xve,"%"))]),_:1},8,["modelValue","min","max"]),(W=s.validationErrors)!=null&&W.hasOwnProperty("amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"amount"},null,8,["validation-errors"])):x("",!0)]}),_:1},8,["label"])]),_:1}),s.coupon.type==="percentage"?(r(),E(k,{key:0,lg:8},{default:d(()=>[n(w,{label:i.translate("Max Discount Amount")},{default:d(()=>{var W;return[n(y,{modelValue:s.coupon.conditions.max_discount_amount,"onUpdate:modelValue":t[10]||(t[10]=G=>s.coupon.conditions.max_discount_amount=G),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("max_discount_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Sve)]),_:1},8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_discount_amount"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1})):x("",!0)],64)):x("",!0)]),_:1})]),_:1})]),_:1}),n(D,null,{default:d(()=>[n(g,{title:i.translate("Usage Restrictions"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Min Spend Amount"),content:i.translate("Minimum spend (subtotal) allowed to use the coupon.")},null,8,["title","content"])]),default:d(()=>{var W,G;return[n(y,{modelValue:s.coupon.conditions.min_purchase_amount,"onUpdate:modelValue":t[11]||(t[11]=Z=>s.coupon.conditions.min_purchase_amount=Z),type:"number",placeholder:"0.00",class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("min_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,Fve)]),_:1},8,["modelValue","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("min_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"min_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Max Spend Amount"),content:i.translate("Set the maximum spend (subtotal) allowed when using the coupon.")},null,8,["title","content"])]),default:d(()=>{var W,G;return[n(y,{modelValue:s.coupon.conditions.max_purchase_amount,"onUpdate:modelValue":t[12]||(t[12]=Z=>s.coupon.conditions.max_purchase_amount=Z),type:"number",placeholder:i.translate("leave empty or 0 for no max limit"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("max_purchase_amount")?"is-error":"")},{prefix:d(()=>[o("span",{innerHTML:e.appVars.shop.currency_sign},null,8,$ve)]),_:1},8,["modelValue","placeholder","class"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("max_purchase_amount")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_purchase_amount"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),n(k,{lg:24},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Spend Amount Based On"),content:i.translate("Choose what the min/max spend limits are measured against: the cart subtotal (items only) or the order total (including shipping and fees). Applies at checkout.")},null,8,["title","content"])]),default:d(()=>[n(Q,{modelValue:s.coupon.conditions.min_amount_basis,"onUpdate:modelValue":t[13]||(t[13]=W=>s.coupon.conditions.min_amount_basis=W)},{default:d(()=>[n(U,{value:"subtotal",label:i.translate("Subtotal (items only)")},null,8,["label"]),n(U,{value:"total",label:i.translate("Total (includes shipping & fees)")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1})]),_:1}),n(k,{md:12},{default:d(()=>[n(w,{label:i.translate("Include Categories")},{default:d(()=>[n(B,{modelValue:s.coupon.conditions.included_categories,"onUpdate:modelValue":t[14]||(t[14]=W=>s.coupon.conditions.included_categories=W),multiple:"",placeholder:i.translate("Any Category"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(P,null,te(s.categories,W=>(r(),E(F,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:12},{default:d(()=>[n(w,{label:i.translate("Exclude Categories")},{default:d(()=>[n(B,{modelValue:s.coupon.conditions.excluded_categories,"onUpdate:modelValue":t[15]||(t[15]=W=>s.coupon.conditions.excluded_categories=W),multiple:"",placeholder:i.translate("No Categories"),filterable:"",remote:"","reserve-keyword":!1},{default:d(()=>[(r(!0),h(P,null,te(s.categories,W=>(r(),E(F,{key:W.value,label:W.label,value:W.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,{label:i.translate("Include Products")},{default:d(()=>[n(V,{modelValue:s.coupon.conditions.included_products,"onUpdate:modelValue":t[16]||(t[16]=W=>s.coupon.conditions.included_products=W)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,{label:i.translate("Excluded Products")},{default:d(()=>[n(V,{modelValue:s.coupon.conditions.excluded_products,"onUpdate:modelValue":t[17]||(t[17]=W=>s.coupon.conditions.excluded_products=W)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),n(k,{md:24},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("By Email Address"),content:i.translate("List of email addresses that can use the coupon. Separate multiple emails with commas. You may also use regular expressions.")},null,8,["title","content"])]),default:d(()=>{var W;return[n(y,{autocomplete:"off",modelValue:s.coupon.conditions.email_restrictions,"onUpdate:modelValue":t[18]||(t[18]=G=>s.coupon.conditions.email_restrictions=G),type:"text",placeholder:i.translate("[email protected], *@special.com, ... or regex pattern")},null,8,["modelValue","placeholder"]),(W=s.validationErrors)!=null&&W.hasOwnProperty("email_restrictions")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"email_restrictions"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),n(k,{md:24},{default:d(()=>{var W;return[n(w,null,{label:d(()=>[n(b,{title:i.translate("Recurring Coupon"),content:i.translate("Mark this coupon as recurring to apply it automatically to every future subscription order. This discount will automatically apply on every renewal. However, the coupon will not be applied if it reduces the payable amount to zero.")},null,8,["title","content"])]),default:d(()=>[n(I,{modelValue:s.coupon.conditions.is_recurring,"onUpdate:modelValue":t[19]||(t[19]=G=>s.coupon.conditions.is_recurring=G),label:i.translate("Make this coupon recurring"),"true-value":"yes","false-value":"no"},null,8,["modelValue","label"])]),_:1}),(W=s.validationErrors)!=null&&W.hasOwnProperty("is_recurring")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"is_recurring"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1}),n(D,null,{default:d(()=>[n(g,{title:i.translate("Maximum Discount Uses"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Total Limit"),content:i.translate("Total number of times this coupon can be redeemed across the entire store.")},null,8,["title","content"])]),default:d(()=>{var W,G;return[n(y,{modelValue:s.coupon.conditions.max_uses,"onUpdate:modelValue":t[20]||(t[20]=Z=>s.coupon.conditions.max_uses=Z),type:"number",placeholder:i.translate("Total limit"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("max_uses")?"is-error":s.usageError),min:s.minLimit,max:s.maxLimit,onInput:t[21]||(t[21]=Z=>{i.onChangeCouponInput("max_uses",Z)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),(G=s.validationErrors)!=null&&G.hasOwnProperty("max_uses")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"max_uses"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1}),n(k,{lg:12},{default:d(()=>[n(w,null,{label:d(()=>[n(b,{title:i.translate("Per Logged in User Limit"),content:i.translate("Maximum an logged in user can use. 0 means unlimited. Only logged in user can use this coupon.")},null,8,["title","content"])]),default:d(()=>[n(y,{modelValue:s.coupon.conditions.max_per_customer,"onUpdate:modelValue":t[22]||(t[22]=W=>s.coupon.conditions.max_per_customer=W),type:"number",placeholder:i.translate("Max limit per logged in user"),class:de(s.validationErrors.hasOwnProperty("max_per_customer")?"is-error":""),min:s.minLimit,max:s.maxLimit,onInput:t[23]||(t[23]=W=>{i.onChangeCouponInput("max_per_customer",W)}),onKeypress:i.preventInvalidChars},null,8,["modelValue","placeholder","class","min","max","onKeypress"]),n(v,{"validation-errors":s.validationErrors,"field-key":"max_per_customer"},null,8,["validation-errors"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),n(D,null,{default:d(()=>[n(g,{title:i.translate("Additional Information"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Status")},{default:d(()=>[n(Q,{modelValue:s.coupon.status,"onUpdate:modelValue":t[24]||(t[24]=W=>s.coupon.status=W)},{default:d(()=>[n(U,{value:"active",label:i.translate("Active")},null,8,["label"]),n(U,{value:"disabled",label:i.translate("Disabled")},null,8,["label"]),n(U,{disabled:"",value:"expired",label:i.translate("Expired")},null,8,["label"])]),_:1},8,["modelValue"]),n(v,{"validation-errors":s.validationErrors,"field-key":"status"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Internal Notes")},{default:d(()=>{var W;return[n(y,{modelValue:s.coupon.notes,"onUpdate:modelValue":t[25]||(t[25]=G=>s.coupon.notes=G),type:"textarea",placeholder:i.translate("Enter note"),class:de((W=s.validationErrors)!=null&&W.hasOwnProperty("notes")?"is-error":"")},null,8,["modelValue","placeholder","class"]),n(v,{"validation-errors":s.validationErrors,"field-key":"notes"},null,8,["validation-errors"])]}),_:1},8,["label"])]),_:1}),n(k,{lg:24},{default:d(()=>{var W;return[n(w,null,{label:d(()=>[n(b,{title:i.translate("Stackable"),content:i.translate("Yes means the coupon can be applied with other coupons")},null,8,["title","content"])]),default:d(()=>[n(Q,{modelValue:s.coupon.stackable,"onUpdate:modelValue":t[26]||(t[26]=G=>s.coupon.stackable=G)},{default:d(()=>[n(U,{value:"yes"},{default:d(()=>[R(m(i.translate("Yes")),1)]),_:1}),n(U,{value:"no"},{default:d(()=>[R(m(i.translate("No")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1}),(W=s.validationErrors)!=null&&W.hasOwnProperty("stackable")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"stackable"},null,8,["validation-errors"])):x("",!0)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["model"])]),o("div",Eve,[o("div",Uve,[n(D,null,{default:d(()=>[n(g,{title:i.translate("Summary"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,null,{default:d(()=>[o("div",Ive,[s.coupon.code?(r(),h("div",Qve,[o("span",Dve,m(i.translate("Coupon code"))+": "+m(s.coupon.code),1),n(O,{text:s.coupon.code,showMode:"basic_copy_btn",tooltipText:i.translate("Copy discount code")},null,8,["text","tooltipText"])])):(r(),h("div",Vve,m(i.translate("No discount code yet")),1))]),o("div",Tve,[o("h4",Mve,m(i.translate("Type & Method")),1),o("ul",Lve,[o("li",null,[o("span",null,m(i.translate("Amount off Products")),1)]),o("li",null,[o("span",null,m(i.translate("Code")),1)])])]),o("div",Rve,[o("h4",Ove,m(i.translate("Details")),1),o("ul",Pve,[o("li",null,[o("span",null,m(i.translate("For Online Store")),1)]),o("li",null,[o("span",null,m(i.translate("No Min Purchase Requirement")),1)]),o("li",null,[o("span",null,m(i.translate("All Customers")),1)])])])]),_:1})]),_:1}),n(D,null,{default:d(()=>[n(g,{title:i.translate("Schedule"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,{class:"pb-1.5"},{default:d(()=>[n(M,{"label-position":"top"},{default:d(()=>[n(S,{gutter:20},{default:d(()=>[n(k,{lg:24},{default:d(()=>[n(w,{label:i.translate("Start Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.start_date,"onUpdate:modelValue":t[27]||(t[27]=W=>s.coupon.start_date=W),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("Start date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledStartDate},null,8,["modelValue","placeholder","onChange","disabled-date"])]),_:1},8,["label"])]),_:1}),n(k,{lg:24},{default:d(()=>[n(w,null,{default:d(()=>[n(I,{modelValue:s.isEndDateEnabled,"onUpdate:modelValue":t[28]||(t[28]=W=>s.isEndDateEnabled=W),label:i.translate("Set end date & time"),onChange:t[29]||(t[29]=W=>{W||(s.coupon.end_date=null)})},null,8,["modelValue","label"])]),_:1})]),_:1}),s.isEndDateEnabled?(r(),E(k,{key:0,lg:24},{default:d(()=>[n(w,{label:i.translate("End Date & Time")},{default:d(()=>[n(L,{modelValue:s.coupon.end_date,"onUpdate:modelValue":t[30]||(t[30]=W=>s.coupon.end_date=W),type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",placeholder:i.translate("End date & time"),onChange:i.setDefaultStatus,"disabled-date":i.disabledEndDate},null,8,["modelValue","placeholder","onChange","disabled-date"]),s.validationErrors.hasOwnProperty("end_date")?(r(),E(v,{key:0,"validation-errors":s.validationErrors,"field-key":"end_date"},null,8,["validation-errors"])):x("",!0)]),_:1},8,["label"])]),_:1})):x("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),s.showDynamicTemplates?(r(),h("div",Hve,[n(H,{filter:"fluent_cart_single_coupon_page",ref:"dynamic_templates",data:{coupon:s.coupon},widgetsQuery:{coupon_id:s.coupon.id},onChange:i.handleChangesMade},null,8,["data","widgetsQuery","onChange"])])):x("",!0),n(D,null,{default:d(()=>[n(g,{title:i.translate("Activity"),border_bottom:"",title_size:"small"},null,8,["title"]),n($,null,{default:d(()=>[n(j,{onReload:i.fetchCoupon,activities:s.coupon.activities||[],showManageActivity:s.showManageActivity},null,8,["onReload","activities","showManageActivity"])]),_:1})]),_:1})])])])],64))])}const Kve=nt(_ve,[["render",Nve]]),Gve={name:"CheckoutFields",components:{Animation:ya,CardHeader:Ve,Card:Se,CardBody:ke,SettingsHeader:Ua,AdminNotice:Ia},data(){return{fields:{},settings:{},saving:!1,fetching:!1}},watch:{"settings.basic_info.last_name.enabled"(e){var t,a;e==="yes"&&((a=(t=this.settings.basic_info)==null?void 0:t.first_name)==null?void 0:a.enabled)==="no"&&(this.settings.basic_info.first_name.enabled="yes")},"settings.business_details":{deep:!0,handler(e){var a,l,s;if(!e||!e.b2b_only_mode)return;((a=e.company_name)==null?void 0:a.enabled)==="yes"||((l=e.vat_number)==null?void 0:l.enabled)==="yes"||((s=e.legal_registration_id)==null?void 0:s.enabled)==="yes"||(e.b2b_only_mode.enabled="no")}}},mounted(){this.getFields()},methods:{translate:u,isFirstNameDisabled(e,t){var a,l;return e==="basic_info"&&t==="first_name"&&((l=(a=this.settings.basic_info)==null?void 0:a.last_name)==null?void 0:l.enabled)==="yes"},isB2BOnlyModeDisabled(e,t){var l,s,i;if(e!=="business_details"||t!=="b2b_only_mode")return!1;const a=this.settings.business_details||{};return((l=a.company_name)==null?void 0:l.enabled)!=="yes"&&((s=a.vat_number)==null?void 0:s.enabled)!=="yes"&&((i=a.legal_registration_id)==null?void 0:i.enabled)!=="yes"},shouldDimLabel(e,t){var a,l,s,i,c,p,f;return((s=(l=(a=this.settings)==null?void 0:a[e])==null?void 0:l[t])==null?void 0:s.enabled)==="no"?!0:e==="basic_info"&&t==="full_name"?((c=(i=this.settings.basic_info)==null?void 0:i.first_name)==null?void 0:c.enabled)==="yes"||((f=(p=this.settings.basic_info)==null?void 0:p.last_name)==null?void 0:f.enabled)==="yes":!1},isVisible(e,t){var a,l,s,i;return t==="full_name"?((l=(a=this.settings.basic_info)==null?void 0:a.first_name)==null?void 0:l.enabled)!=="yes"&&((i=(s=this.settings.basic_info)==null?void 0:s.last_name)==null?void 0:i.enabled)!=="yes":!0},getFields(){this.fetching=!0,this.$get("checkout-fields/get-fields").then(e=>{this.fields=e.fields||{},this.settings=e.settings||{}}).catch(e=>{this.handleError(e)}).finally(()=>{this.fetching=!1})},saveFields(){this.saving=!0,this.$post("checkout-fields/save-fields",{settings:this.settings}).then(e=>{this.$notify.success(e.message||this.$t("Settings saved successfully!")),this.getFields()}).catch(e=>{this.handleError(e)}).finally(()=>{this.saving=!1})},formatSectionTitle(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}}},zve={class:"setting-wrap"},jve={class:"setting-wrap-inner"},qve={class:"fct-checkout-fields-wrapp"},Yve={class:"field-heading"},Wve={class:"fct-checkout-fields"},Jve={key:0,class:"fct-checkout-field"},Xve={class:"fct-checkout-field-info"},Zve={class:"fct-checkout-field-label-wrap"},ege={class:"fct-checkout-field-tags"},tge={key:0,class:"fct-checkout-field-info-desc"},age={key:0,class:"fct-checkout-field-action"},lge={key:1,class:"fct-checkout-field-input"},sge={class:"fct-checkout-field-info"},nge={class:"fct-checkout-field-label-wrap"},oge={key:1,class:"fct-checkout-field-tags"},ige={key:0,class:"fct-checkout-field-info-desc"},rge={key:0,class:"fct-checkout-field-action"},dge={class:"form-section-save-action"};function uge(e,t,a,l,s,i){const c=C("SettingsHeader"),p=C("AdminNotice"),f=C("el-skeleton"),_=C("el-switch"),g=C("el-tag"),y=C("el-checkbox"),v=C("el-input"),w=C("CardBody"),k=C("Card"),b=C("el-button");return r(),h("div",zve,[n(c,{heading:i.translate("Checkout Fields"),loading:s.saving,onOnSave:i.saveFields},null,8,["heading","loading","onOnSave"]),o("div",jve,[n(p),o("div",qve,[n(k,null,{default:d(()=>[n(w,null,{default:d(()=>[n(f,{loading:s.fetching,animated:"",rows:5},null,8,["loading"]),s.fetching?x("",!0):(r(!0),h(P,{key:0},te(s.fields,(S,$)=>(r(),h("div",{key:$,class:"fct-checkout-field-section"},[o("h3",Yve,m(i.formatSectionTitle($)),1),o("div",Wve,[S.label?(r(),h("div",Jve,[o("div",Xve,[o("div",Zve,[S.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$].enabled,"onUpdate:modelValue":D=>s.settings[$].enabled=D,"active-value":"yes","inactive-value":"no"},null,8,["modelValue","onUpdate:modelValue"])):x("",!0),o("span",{class:de(`fct-checkout-field-label ${s.settings[$].enabled==="no"?"opacity-50":""}`)},m(S.label),3),o("div",ege,[S.can_alter!=="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[R(m(i.translate("System")),1)]),_:1})):x("",!0),s.settings[$].required==="yes"&&s.settings[$].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:1})):x("",!0)])]),S.help_text?(r(),h("div",tge,m(S.help_text),1)):x("",!0)]),S.can_alter==="yes"?(r(),h("div",age,[n(y,{modelValue:s.settings[$].required,"onUpdate:modelValue":D=>s.settings[$].required=D,"true-label":"yes","false-label":"no",disabled:s.settings[$].enabled!=="yes"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),s.settings[$].hasOwnProperty("text")&&s.settings[$].enabled==="yes"?(r(),h("div",lge,[n(v,{type:"textarea",modelValue:s.settings[$].text,"onUpdate:modelValue":D=>s.settings[$].text=D,disabled:s.settings[$].enabled!=="yes"},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)])):(r(!0),h(P,{key:1},te(S,(D,F)=>(r(),h("div",{key:F,class:"fct-checkout-field"},[o("div",sge,[o("div",nge,[D.can_alter==="yes"?(r(),E(_,{key:0,modelValue:s.settings[$][F].enabled,"onUpdate:modelValue":B=>s.settings[$][F].enabled=B,"active-value":"yes","inactive-value":"no",disabled:i.isFirstNameDisabled($,F)||i.isB2BOnlyModeDisabled($,F)},null,8,["modelValue","onUpdate:modelValue","disabled"])):x("",!0),o("span",{class:de(["fct-checkout-field-label",i.shouldDimLabel($,F)?"opacity-50":""])},m(D.label),3),i.isVisible(D,F)?(r(),h("div",oge,[D.can_alter!=="yes"&&s.settings[$][F].enabled==="yes"?(r(),E(g,{key:0,size:"small"},{default:d(()=>[R(m(i.translate("System")),1)]),_:1})):x("",!0),s.settings[$][F].required==="yes"&&s.settings[$][F].enabled==="yes"?(r(),E(g,{key:1,size:"small"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:1})):x("",!0)])):x("",!0)]),D.help_text?(r(),h("div",ige,m(D.help_text),1)):x("",!0)]),D.can_alter==="yes"&&F!=="first_name"&&F!=="b2b_only_mode"?(r(),h("div",rge,[n(y,{modelValue:s.settings[$][F].required,"onUpdate:modelValue":B=>s.settings[$][F].required=B,"true-label":"yes","false-label":"no",disabled:s.settings[$][F].enabled!=="yes"},{default:d(()=>[R(m(i.translate("Required")),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0)]))),128))])]))),128))]),_:1})]),_:1}),o("div",dge,[n(b,{type:"primary",onClick:i.saveFields,loading:s.saving},{default:d(()=>[R(m(i.translate("Save")),1)]),_:1},8,["onClick","loading"])])])])])}const cge=nt(Gve,[["render",uge]]);var Uo={exports:{}};/* @license | |
| 280 | 286 | Papa Parse |
| 281 | 287 | v5.5.3 |
| 282 | 288 | https://github.com/mholt/PapaParse |
| 283 | 289 | License: MIT |
| 284 | -*/var Jhe=wo.exports,uc;function Zhe(){return uc||(uc=1,function(e,t){((a,l)=>{e.exports=l()})(Jhe,function a(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},s,i=!l.document&&!!l.postMessage,c=l.IS_PAPA_WORKER||!1,p={},m=0,_={};function g(Q){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(E){var D=M(E);D.chunkSize=parseInt(D.chunkSize),E.step||E.chunk||(D.chunkSize=null),this._handle=new w(D),(this._handle.streamer=this)._config=D}).call(this,Q),this.parseChunk=function(E,D){var H=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<H){let G=this._config.newline;G||(P=this._config.quoteChar||'"',G=this._handle.guessLineEndings(E,P)),E=[...E.split(G).slice(H)].join(G)}this.isFirstChunk&&T(this._config.beforeFirstChunk)&&(P=this._config.beforeFirstChunk(E))!==void 0&&(E=P),this.isFirstChunk=!1,this._halted=!1;var H=this._partialLine+E,P=(this._partialLine="",this._handle.parse(H,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(E=P.meta.cursor,H=(this._finished||(this._partialLine=H.substring(E-this._baseIndex),this._baseIndex=E),P&&P.data&&(this._rowCount+=P.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),c)l.postMessage({results:P,workerId:_.WORKER_ID,finished:H});else if(T(this._config.chunk)&&!D){if(this._config.chunk(P,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=P=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(P.data),this._completeResults.errors=this._completeResults.errors.concat(P.errors),this._completeResults.meta=P.meta),this._completed||!H||!T(this._config.complete)||P&&P.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),H||P&&P.meta.paused||this._nextChunk(),P}this._halted=!0},this._sendError=function(E){T(this._config.error)?this._config.error(E):c&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:E,finished:!1})}}function y(Q){var E;(Q=Q||{}).chunkSize||(Q.chunkSize=_.RemoteChunkSize),g.call(this,Q),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(D){this._input=D,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(E=new XMLHttpRequest,this._config.withCredentials&&(E.withCredentials=this._config.withCredentials),i||(E.onload=I(this._chunkLoaded,this),E.onerror=I(this._chunkError,this)),E.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var D,H=this._config.downloadRequestHeaders;for(D in H)E.setRequestHeader(D,H[D])}var P;this._config.chunkSize&&(P=this._start+this._config.chunkSize-1,E.setRequestHeader("Range","bytes="+this._start+"-"+P));try{E.send(this._config.downloadRequestBody)}catch(G){this._chunkError(G.message)}i&&E.status===0&&this._chunkError()}},this._chunkLoaded=function(){E.readyState===4&&(E.status<200||400<=E.status?this._chunkError():(this._start+=this._config.chunkSize||E.responseText.length,this._finished=!this._config.chunkSize||this._start>=(D=>(D=D.getResponseHeader("Content-Range"))!==null?parseInt(D.substring(D.lastIndexOf("/")+1)):-1)(E),this.parseChunk(E.responseText)))},this._chunkError=function(D){D=E.statusText||D,this._sendError(new Error(D))}}function v(Q){(Q=Q||{}).chunkSize||(Q.chunkSize=_.LocalChunkSize),g.call(this,Q);var E,D,H=typeof FileReader<"u";this.stream=function(P){this._input=P,D=P.slice||P.webkitSlice||P.mozSlice,H?((E=new FileReader).onload=I(this._chunkLoaded,this),E.onerror=I(this._chunkError,this)):E=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var P=this._input,G=(this._config.chunkSize&&(G=Math.min(this._start+this._config.chunkSize,this._input.size),P=D.call(P,this._start,G)),E.readAsText(P,this._config.encoding));H||this._chunkLoaded({target:{result:G}})},this._chunkLoaded=function(P){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(P.target.result)},this._chunkError=function(){this._sendError(E.error)}}function C(Q){var E;g.call(this,Q=Q||{}),this.stream=function(D){return E=D,this._nextChunk()},this._nextChunk=function(){var D,H;if(!this._finished)return D=this._config.chunkSize,E=D?(H=E.substring(0,D),E.substring(D)):(H=E,""),this._finished=!E,this.parseChunk(H)}}function b(Q){g.call(this,Q=Q||{});var E=[],D=!0,H=!1;this.pause=function(){g.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){g.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(P){this._input=P,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){H&&E.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),E.length?this.parseChunk(E.shift()):D=!0},this._streamData=I(function(P){try{E.push(typeof P=="string"?P:P.toString(this._config.encoding)),D&&(D=!1,this._checkIsFinished(),this.parseChunk(E.shift()))}catch(G){this._streamError(G)}},this),this._streamError=I(function(P){this._streamCleanUp(),this._sendError(P)},this),this._streamEnd=I(function(){this._streamCleanUp(),H=!0,this._streamData("")},this),this._streamCleanUp=I(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function w(Q){var E,D,H,P,G=Math.pow(2,53),J=-G,oe=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Z=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,W=this,pe=0,N=0,j=!1,q=!1,X=[],ie={data:[],errors:[],meta:{}};function ge(me){return Q.skipEmptyLines==="greedy"?me.join("").trim()==="":me.length===1&&me[0].length===0}function fe(){if(ie&&H&&(le("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),H=!1),Q.skipEmptyLines&&(ie.data=ie.data.filter(function(be){return!ge(be)})),he()){let be=function(qe,gt){T(Q.transformHeader)&&(qe=Q.transformHeader(qe,gt)),X.push(qe)};if(ie)if(Array.isArray(ie.data[0])){for(var me=0;he()&&me<ie.data.length;me++)ie.data[me].forEach(be);ie.data.splice(0,1)}else ie.data.forEach(be)}function Ue(be,qe){for(var gt=Q.header?{}:[],Ze=0;Ze<be.length;Ze++){var Fe=Ze,Ee=be[Ze],Ee=((Pe,Me)=>(ht=>(Q.dynamicTypingFunction&&Q.dynamicTyping[ht]===void 0&&(Q.dynamicTyping[ht]=Q.dynamicTypingFunction(ht)),(Q.dynamicTyping[ht]||Q.dynamicTyping)===!0))(Pe)?Me==="true"||Me==="TRUE"||Me!=="false"&&Me!=="FALSE"&&((ht=>{if(oe.test(ht)&&(ht=parseFloat(ht),J<ht&&ht<G))return 1})(Me)?parseFloat(Me):Z.test(Me)?new Date(Me):Me===""?null:Me):Me)(Fe=Q.header?Ze>=X.length?"__parsed_extra":X[Ze]:Fe,Ee=Q.transform?Q.transform(Ee,Fe):Ee);Fe==="__parsed_extra"?(gt[Fe]=gt[Fe]||[],gt[Fe].push(Ee)):gt[Fe]=Ee}return Q.header&&(Ze>X.length?le("FieldMismatch","TooManyFields","Too many fields: expected "+X.length+" fields but parsed "+Ze,N+qe):Ze<X.length&&le("FieldMismatch","TooFewFields","Too few fields: expected "+X.length+" fields but parsed "+Ze,N+qe)),gt}var et;ie&&(Q.header||Q.dynamicTyping||Q.transform)&&(et=1,!ie.data.length||Array.isArray(ie.data[0])?(ie.data=ie.data.map(Ue),et=ie.data.length):ie.data=Ue(ie.data,0),Q.header&&ie.meta&&(ie.meta.fields=X),N+=et)}function he(){return Q.header&&X.length===0}function le(me,Ue,et,be){me={type:me,code:Ue,message:et},be!==void 0&&(me.row=be),ie.errors.push(me)}T(Q.step)&&(P=Q.step,Q.step=function(me){ie=me,he()?fe():(fe(),ie.data.length!==0&&(pe+=me.data.length,Q.preview&&pe>Q.preview?D.abort():(ie.data=ie.data[0],P(ie,W))))}),this.parse=function(me,Ue,et){var be=Q.quoteChar||'"',be=(Q.newline||(Q.newline=this.guessLineEndings(me,be)),H=!1,Q.delimiter?T(Q.delimiter)&&(Q.delimiter=Q.delimiter(me),ie.meta.delimiter=Q.delimiter):((be=((qe,gt,Ze,Fe,Ee)=>{var Pe,Me,ht,At;Ee=Ee||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Mt=0;Mt<Ee.length;Mt++){for(var Ft,$t=Ee[Mt],ct=0,Ut=0,St=0,Dt=(ht=void 0,new F({comments:Fe,delimiter:$t,newline:gt,preview:10}).parse(qe)),Et=0;Et<Dt.data.length;Et++)Ze&&ge(Dt.data[Et])?St++:(Ft=Dt.data[Et].length,Ut+=Ft,ht===void 0?ht=Ft:0<Ft&&(ct+=Math.abs(Ft-ht),ht=Ft));0<Dt.data.length&&(Ut/=Dt.data.length-St),(Me===void 0||ct<=Me)&&(At===void 0||At<Ut)&&1.99<Ut&&(Me=ct,Pe=$t,At=Ut)}return{successful:!!(Q.delimiter=Pe),bestDelimiter:Pe}})(me,Q.newline,Q.skipEmptyLines,Q.comments,Q.delimitersToGuess)).successful?Q.delimiter=be.bestDelimiter:(H=!0,Q.delimiter=_.DefaultDelimiter),ie.meta.delimiter=Q.delimiter),M(Q));return Q.preview&&Q.header&&be.preview++,E=me,D=new F(be),ie=D.parse(E,Ue,et),fe(),j?{meta:{paused:!0}}:ie||{meta:{paused:!1}}},this.paused=function(){return j},this.pause=function(){j=!0,D.abort(),E=T(Q.chunk)?"":E.substring(D.getCharIndex())},this.resume=function(){W.streamer._halted?(j=!1,W.streamer.parseChunk(E,!0)):setTimeout(W.resume,3)},this.aborted=function(){return q},this.abort=function(){q=!0,D.abort(),ie.meta.aborted=!0,T(Q.complete)&&Q.complete(ie),E=""},this.guessLineEndings=function(qe,be){qe=qe.substring(0,1048576);var be=new RegExp(x(be)+"([^]*?)"+x(be),"gm"),et=(qe=qe.replace(be,"")).split("\r"),be=qe.split(` | |
| 285 | -`),qe=1<be.length&&be[0].length<et[0].length;if(et.length===1||qe)return` | |
| 286 | -`;for(var gt=0,Ze=0;Ze<et.length;Ze++)et[Ze][0]===` | |
| 287 | -`&>++;return gt>=et.length/2?`\r | |
| 288 | -`:"\r"}}function x(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F(Q){var E=(Q=Q||{}).delimiter,D=Q.newline,H=Q.comments,P=Q.step,G=Q.preview,J=Q.fastMode,oe=null,Z=!1,W=Q.quoteChar==null?'"':Q.quoteChar,pe=W;if(Q.escapeChar!==void 0&&(pe=Q.escapeChar),(typeof E!="string"||-1<_.BAD_DELIMITERS.indexOf(E))&&(E=","),H===E)throw new Error("Comment character same as delimiter");H===!0?H="#":(typeof H!="string"||-1<_.BAD_DELIMITERS.indexOf(H))&&(H=!1),D!==` | |
| 289 | -`&&D!=="\r"&&D!==`\r | |
| 290 | -`&&(D=` | |
| 291 | -`);var N=0,j=!1;this.parse=function(q,X,ie){if(typeof q!="string")throw new Error("Input must be a string");var ge=q.length,fe=E.length,he=D.length,le=H.length,me=T(P),Ue=[],et=[],be=[],qe=N=0;if(!q)return ct();if(J||J!==!1&&q.indexOf(W)===-1){for(var gt=q.split(D),Ze=0;Ze<gt.length;Ze++){if(be=gt[Ze],N+=be.length,Ze!==gt.length-1)N+=D.length;else if(ie)return ct();if(!H||be.substring(0,le)!==H){if(me){if(Ue=[],At(be.split(E)),Ut(),j)return ct()}else At(be.split(E));if(G&&G<=Ze)return Ue=Ue.slice(0,G),ct(!0)}}return ct()}for(var Fe=q.indexOf(E,N),Ee=q.indexOf(D,N),Pe=new RegExp(x(pe)+x(W),"g"),Me=q.indexOf(W,N);;)if(q[N]===W)for(Me=N,N++;;){if((Me=q.indexOf(W,Me+1))===-1)return ie||et.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Ue.length,index:N}),Ft();if(Me===ge-1)return Ft(q.substring(N,Me).replace(Pe,W));if(W===pe&&q[Me+1]===pe)Me++;else if(W===pe||Me===0||q[Me-1]!==pe){Fe!==-1&&Fe<Me+1&&(Fe=q.indexOf(E,Me+1));var ht=Mt((Ee=Ee!==-1&&Ee<Me+1?q.indexOf(D,Me+1):Ee)===-1?Fe:Math.min(Fe,Ee));if(q.substr(Me+1+ht,fe)===E){be.push(q.substring(N,Me).replace(Pe,W)),q[N=Me+1+ht+fe]!==W&&(Me=q.indexOf(W,N)),Fe=q.indexOf(E,N),Ee=q.indexOf(D,N);break}if(ht=Mt(Ee),q.substring(Me+1+ht,Me+1+ht+he)===D){if(be.push(q.substring(N,Me).replace(Pe,W)),$t(Me+1+ht+he),Fe=q.indexOf(E,N),Me=q.indexOf(W,N),me&&(Ut(),j))return ct();if(G&&Ue.length>=G)return ct(!0);break}et.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Ue.length,index:N}),Me++}}else if(H&&be.length===0&&q.substring(N,N+le)===H){if(Ee===-1)return ct();N=Ee+he,Ee=q.indexOf(D,N),Fe=q.indexOf(E,N)}else if(Fe!==-1&&(Fe<Ee||Ee===-1))be.push(q.substring(N,Fe)),N=Fe+fe,Fe=q.indexOf(E,N);else{if(Ee===-1)break;if(be.push(q.substring(N,Ee)),$t(Ee+he),me&&(Ut(),j))return ct();if(G&&Ue.length>=G)return ct(!0)}return Ft();function At(St){Ue.push(St),qe=N}function Mt(St){var Dt=0;return Dt=St!==-1&&(St=q.substring(Me+1,St))&&St.trim()===""?St.length:Dt}function Ft(St){return ie||(St===void 0&&(St=q.substring(N)),be.push(St),N=ge,At(be),me&&Ut()),ct()}function $t(St){N=St,At(be),be=[],Ee=q.indexOf(D,N)}function ct(St){if(Q.header&&!X&&Ue.length&&!Z){var Dt=Ue[0],Et=Object.create(null),It=new Set(Dt);let Ht=!1;for(let Bt=0;Bt<Dt.length;Bt++){let ra=Dt[Bt];if(Et[ra=T(Q.transformHeader)?Q.transformHeader(ra,Bt):ra]){let ve,$e=Et[ra];for(;ve=ra+"_"+$e,$e++,It.has(ve););It.add(ve),Dt[Bt]=ve,Et[ra]++,Ht=!0,(oe=oe===null?{}:oe)[ve]=ra}else Et[ra]=1,Dt[Bt]=ra;It.add(ra)}Ht&&console.warn("Duplicate headers found and renamed."),Z=!0}return{data:Ue,errors:et,meta:{delimiter:E,linebreak:D,aborted:j,truncated:!!St,cursor:qe+(X||0),renamedHeaders:oe}}}function Ut(){P(ct()),Ue=[],et=[]}},this.abort=function(){j=!0},this.getCharIndex=function(){return N}}function L(Q){var E=Q.data,D=p[E.workerId],H=!1;if(E.error)D.userError(E.error,E.file);else if(E.results&&E.results.data){var P={abort:function(){H=!0,U(E.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:S,resume:S};if(T(D.userStep)){for(var G=0;G<E.results.data.length&&(D.userStep({data:E.results.data[G],errors:E.results.errors,meta:E.results.meta},P),!H);G++);delete E.results}else T(D.userChunk)&&(D.userChunk(E.results,P,E.file),delete E.results)}E.finished&&!H&&U(E.workerId,E.results)}function U(Q,E){var D=p[Q];T(D.userComplete)&&D.userComplete(E),D.terminate(),delete p[Q]}function S(){throw new Error("Not implemented.")}function M(Q){if(typeof Q!="object"||Q===null)return Q;var E,D=Array.isArray(Q)?[]:{};for(E in Q)D[E]=M(Q[E]);return D}function I(Q,E){return function(){Q.apply(E,arguments)}}function T(Q){return typeof Q=="function"}return _.parse=function(Q,E){var D=(E=E||{}).dynamicTyping||!1;if(T(D)&&(E.dynamicTypingFunction=D,D={}),E.dynamicTyping=D,E.transform=!!T(E.transform)&&E.transform,!E.worker||!_.WORKERS_SUPPORTED)return D=null,_.NODE_STREAM_INPUT,typeof Q=="string"?(Q=(H=>H.charCodeAt(0)!==65279?H:H.slice(1))(Q),D=new(E.download?y:C)(E)):Q.readable===!0&&T(Q.read)&&T(Q.on)?D=new b(E):(l.File&&Q instanceof File||Q instanceof Object)&&(D=new v(E)),D.stream(Q);(D=(()=>{var H;return!!_.WORKERS_SUPPORTED&&(H=(()=>{var P=l.URL||l.webkitURL||null,G=a.toString();return _.BLOB_URL||(_.BLOB_URL=P.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",G,")();"],{type:"text/javascript"})))})(),(H=new l.Worker(H)).onmessage=L,H.id=m++,p[H.id]=H)})()).userStep=E.step,D.userChunk=E.chunk,D.userComplete=E.complete,D.userError=E.error,E.step=T(E.step),E.chunk=T(E.chunk),E.complete=T(E.complete),E.error=T(E.error),delete E.worker,D.postMessage({input:Q,config:E,workerId:D.id})},_.unparse=function(Q,E){var D=!1,H=!0,P=",",G=`\r | |
| 292 | -`,J='"',oe=J+J,Z=!1,W=null,pe=!1,N=((()=>{if(typeof E=="object"){if(typeof E.delimiter!="string"||_.BAD_DELIMITERS.filter(function(X){return E.delimiter.indexOf(X)!==-1}).length||(P=E.delimiter),typeof E.quotes!="boolean"&&typeof E.quotes!="function"&&!Array.isArray(E.quotes)||(D=E.quotes),typeof E.skipEmptyLines!="boolean"&&typeof E.skipEmptyLines!="string"||(Z=E.skipEmptyLines),typeof E.newline=="string"&&(G=E.newline),typeof E.quoteChar=="string"&&(J=E.quoteChar),typeof E.header=="boolean"&&(H=E.header),Array.isArray(E.columns)){if(E.columns.length===0)throw new Error("Option columns is empty");W=E.columns}E.escapeChar!==void 0&&(oe=E.escapeChar+J),E.escapeFormulae instanceof RegExp?pe=E.escapeFormulae:typeof E.escapeFormulae=="boolean"&&E.escapeFormulae&&(pe=/^[=+\-@\t\r].*$/)}})(),new RegExp(x(J),"g"));if(typeof Q=="string"&&(Q=JSON.parse(Q)),Array.isArray(Q)){if(!Q.length||Array.isArray(Q[0]))return j(null,Q,Z);if(typeof Q[0]=="object")return j(W||Object.keys(Q[0]),Q,Z)}else if(typeof Q=="object")return typeof Q.data=="string"&&(Q.data=JSON.parse(Q.data)),Array.isArray(Q.data)&&(Q.fields||(Q.fields=Q.meta&&Q.meta.fields||W),Q.fields||(Q.fields=Array.isArray(Q.data[0])?Q.fields:typeof Q.data[0]=="object"?Object.keys(Q.data[0]):[]),Array.isArray(Q.data[0])||typeof Q.data[0]=="object"||(Q.data=[Q.data])),j(Q.fields||[],Q.data||[],Z);throw new Error("Unable to serialize unrecognized input");function j(X,ie,ge){var fe="",he=(typeof X=="string"&&(X=JSON.parse(X)),typeof ie=="string"&&(ie=JSON.parse(ie)),Array.isArray(X)&&0<X.length),le=!Array.isArray(ie[0]);if(he&&H){for(var me=0;me<X.length;me++)0<me&&(fe+=P),fe+=q(X[me],me);0<ie.length&&(fe+=G)}for(var Ue=0;Ue<ie.length;Ue++){var et=(he?X:ie[Ue]).length,be=!1,qe=he?Object.keys(ie[Ue]).length===0:ie[Ue].length===0;if(ge&&!he&&(be=ge==="greedy"?ie[Ue].join("").trim()==="":ie[Ue].length===1&&ie[Ue][0].length===0),ge==="greedy"&&he){for(var gt=[],Ze=0;Ze<et;Ze++){var Fe=le?X[Ze]:Ze;gt.push(ie[Ue][Fe])}be=gt.join("").trim()===""}if(!be){for(var Ee=0;Ee<et;Ee++){0<Ee&&!qe&&(fe+=P);var Pe=he&&le?X[Ee]:Ee;fe+=q(ie[Ue][Pe],Ee)}Ue<ie.length-1&&(!ge||0<et&&!qe)&&(fe+=G)}}return fe}function q(X,ie){var ge,fe;return X==null?"":X.constructor===Date?JSON.stringify(X).slice(1,25):(fe=!1,pe&&typeof X=="string"&&pe.test(X)&&(X="'"+X,fe=!0),ge=X.toString().replace(N,oe),(fe=fe||D===!0||typeof D=="function"&&D(X,ie)||Array.isArray(D)&&D[ie]||((he,le)=>{for(var me=0;me<le.length;me++)if(-1<he.indexOf(le[me]))return!0;return!1})(ge,_.BAD_DELIMITERS)||-1<ge.indexOf(P)||ge.charAt(0)===" "||ge.charAt(ge.length-1)===" ")?J+ge+J:ge)}},_.RECORD_SEP="",_.UNIT_SEP="",_.BYTE_ORDER_MARK="\uFEFF",_.BAD_DELIMITERS=["\r",` | |
| 293 | -`,'"',_.BYTE_ORDER_MARK],_.WORKERS_SUPPORTED=!i&&!!l.Worker,_.NODE_STREAM_INPUT=1,_.LocalChunkSize=10485760,_.RemoteChunkSize=5242880,_.DefaultDelimiter=",",_.Parser=F,_.ParserHandle=w,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=C,_.ReadableStreamStreamer=b,l.jQuery&&((s=l.jQuery).fn.parse=function(Q){var E=Q.config||{},D=[];return this.each(function(G){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var J=0;J<this.files.length;J++)D.push({file:this.files[J],inputElem:this,instanceConfig:s.extend({},E)})}),H(),this;function H(){if(D.length===0)T(Q.complete)&&Q.complete();else{var G,J,oe,Z,W=D[0];if(T(Q.before)){var pe=Q.before(W.file,W.inputElem);if(typeof pe=="object"){if(pe.action==="abort")return G="AbortError",J=W.file,oe=W.inputElem,Z=pe.reason,void(T(Q.error)&&Q.error({name:G},J,oe,Z));if(pe.action==="skip")return void P();typeof pe.config=="object"&&(W.instanceConfig=s.extend(W.instanceConfig,pe.config))}else if(pe==="skip")return void P()}var N=W.instanceConfig.complete;W.instanceConfig.complete=function(j){T(N)&&N(j,W.file,W.inputElem),P()},_.parse(W.file,W.instanceConfig)}}function P(){D.splice(0,1),H()}}),c&&(l.onmessage=function(Q){Q=Q.data,_.WORKER_ID===void 0&&Q&&(_.WORKER_ID=Q.workerId),typeof Q.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(Q.input,Q.config),finished:!0}):(l.File&&Q.input instanceof File||Q.input instanceof Object)&&(Q=_.parse(Q.input,Q.config))&&l.postMessage({workerId:_.WORKER_ID,results:Q,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(C.prototype=Object.create(C.prototype)).constructor=C,(b.prototype=Object.create(g.prototype)).constructor=b,_})}(wo)),wo.exports}var e_e=Zhe();const cc=Uf(e_e),t_e={class:"el-upload__text"},a_e={class:"fct-import-map-table-wrap"},l_e={class:"fct-import-map-heading"},s_e={class:"fct-import-map-table"},n_e={width:"50%"},o_e={class:"dialog-footer"},i_e={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=zt().ctx,l=V(!1),s=V(),i=V(),c=V([]),p=V([]),m=V({}),_=V({}),g=V(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const C=V(!1),b=G=>{G&&cc.parse(G,{header:!0,complete:function(J){p.value=J.data,c.value=J.meta.fields,g.value=c.value.includes("Type")&&c.value.includes("Parent"),x(),g.value&&U(),C.value=!0}})},w=()=>{_.value={},c.value=[],p.value=[],C.value=!1,g.value=!1},x=()=>{const G=[],J=[];let oe=0;c.value.forEach(Z=>{let W=null,pe=null;const N=Z.toString();for(const[j,q]of y.entries())if(N.toLocaleLowerCase().startsWith(q)){const X=Z.toString().match(/ \d+ /g);if(Array.isArray(X)&&X.length===1){let ie=X[0];oe=ie>oe?ie:oe,W=Z.toString().replace(X[0]," %d "),pe=Z.toString().replace(X[0]," ");break}}W!=null?G.includes(W)||(G.push(W),J.push({title:pe,value:W})):J.push({title:Z,value:Z})}),_.value=J,v=oe},F=()=>window.fluentCartRestVars.rest.url+"/files/upload",L={post_id:["ID"],post_title:["Name"],post_name:["SKU"],post_content:["description","Description"],post_excerpt:["Short description","Short Description"],post_status:["Published"],comment_status:["Allow customer reviews?"],item_price:["Regular price","Meta: _subscription_price"],compare_price:["Sale price"],images:["Images"],categories:["Categories"],sku:["SKU"],payment_type:["Payment Type"],repeat_interval:["Subscription Interval","Meta: _subscription_period"],trial_days:["Trial Days","Meta: _subscription_trial_length"],installment:["Installment"],installment_count:["Installment Count"],manage_setup_fee:["Setup Fee"],signup_fee_name:["Setup Fee Name"],signup_fee:["Setup Fee Amount","Meta: _subscription_sign_up_fee"]},U=()=>{for(const[G,J]of Object.entries(L))if(m.value[G]){for(const oe of J)if(c.value.includes(oe)){m.value[G].value=oe;break}}},S=G=>G?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[G.trim().toLowerCase()]||G:"",M=G=>{if(!G)return"";const J=G.split(",").map(oe=>oe.trim().toLowerCase());return J.includes("variation")?"variation":J.includes("variable")?"variable":J.includes("subscription")?"subscription":J.includes("simple")?"simple":J[0]||""},I=(G=!0)=>{const J=[],oe={},Z=m.value,W={description:"",payment_type:"onetime",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},pe=j=>{const q=[];for(let X=1;X<=10;X++){const ie=`Attribute ${X} name`,ge=`Attribute ${X} value(s)`;j[ie]&&j[ge]&&q.push(j[ge])}return q.join(" - ")},N=j=>j==="1"||j===1?"published":j==="0"||j===0?"draft":j||"published";p.value.forEach(j=>{var me,Ue,et,be,qe,gt,Ze,Fe,Ee,Pe,Me,ht,At,Mt,Ft,$t,ct,Ut,St,Dt;const q=M(j.Type);if(q!=="simple"&&q!=="variable"&&q!=="subscription")return;const X={};X._cid=Al(),X.post_title=j[(me=Z.post_title)==null?void 0:me.value]||"",X.post_name=j[(Ue=Z.post_name)==null?void 0:Ue.value]||X.post_title,X.ID=j[(et=Z.post_id)==null?void 0:et.value]||"",X.post_content=j[(be=Z.post_content)==null?void 0:be.value]||"",X.post_excerpt=j[(qe=Z.post_excerpt)==null?void 0:qe.value]||"",X.post_status=N(j[(gt=Z.post_status)==null?void 0:gt.value]);const ie={variation_type:q==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},ge=j[(Ze=Z.images)==null?void 0:Ze.value]||"",fe=[];ge&&ge.split(",").map(Et=>Et.trim()).filter(Boolean).forEach(Et=>{const It=Et.split("/").pop().split("?")[0]||"image";fe.push({id:0,url:Et,title:It})}),X.detail=ie,X.gallery=fe,X.variants=[];const he=j[(Fe=Z.categories)==null?void 0:Fe.value]||"";if(he?X.categories=he.split(",").map(Et=>Et.trim()).filter(Boolean):X.categories=[],q==="simple"||q==="subscription"){const Et=j[(Ee=Z.item_price)==null?void 0:Ee.value]||"",It=j[(Pe=Z.compare_price)==null?void 0:Pe.value]||"",Ht=j[(Me=Z.sku)==null?void 0:Me.value]||"",Bt=q==="subscription"?"subscription":j[(ht=Z.payment_type)==null?void 0:ht.value]||"onetime",ra=S(j[(At=Z.repeat_interval)==null?void 0:At.value]||""),ve=j[(Mt=Z.trial_days)==null?void 0:Mt.value]||"",$e=j[(Ft=Z.installment)==null?void 0:Ft.value]||"",ot=j[($t=Z.installment_count)==null?void 0:$t.value]||"",vt=j[(ct=Z.manage_setup_fee)==null?void 0:ct.value]||"",yt=j[(Ut=Z.signup_fee_name)==null?void 0:Ut.value]||"",Nt=j[(St=Z.signup_fee)==null?void 0:St.value]||"";(Et||X.post_title)&&X.variants.push({_cid:Al(),variation_title:X.post_title,sku:Ht,item_price:Et,compare_price:It,other_info:{...W,payment_type:Bt,repeat_interval:ra,trial_days:ve,installment:$e==="yes"?"yes":"no",times:ot,manage_setup_fee:vt==="yes"?"yes":"no",signup_fee_name:yt,signup_fee:Nt},media:[]})}const le=j[(Dt=Z.sku)==null?void 0:Dt.value]||"";q==="variable"&&le&&(oe[le]=X),J.push(X)}),p.value.forEach(j=>{var Pe,Me,ht,At,Mt,Ft,$t,ct,Ut,St,Dt,Et;if(M(j.Type)!=="variation")return;const q=j.Parent;if(!q||!oe[q])return;const X=pe(j),ie=j[(Pe=Z.item_price)==null?void 0:Pe.value]||"",ge=j[(Me=Z.compare_price)==null?void 0:Me.value]||"",fe=j[(ht=Z.images)==null?void 0:ht.value]||"",he=[];fe&&fe.split(",").map(It=>It.trim()).filter(Boolean).forEach(It=>{const Ht=It.split("/").pop().split("?")[0]||"image";he.push({id:0,url:It,title:Ht})});const le=j[(At=Z.sku)==null?void 0:At.value]||"",me=j[(Mt=Z.payment_type)==null?void 0:Mt.value]||"onetime",Ue=S(j[(Ft=Z.repeat_interval)==null?void 0:Ft.value]||""),et=j[($t=Z.trial_days)==null?void 0:$t.value]||"",be=j[(ct=Z.installment)==null?void 0:ct.value]||"",qe=j[(Ut=Z.installment_count)==null?void 0:Ut.value]||"",gt=j[(St=Z.manage_setup_fee)==null?void 0:St.value]||"",Ze=j[(Dt=Z.signup_fee_name)==null?void 0:Dt.value]||"",Fe=j[(Et=Z.signup_fee)==null?void 0:Et.value]||"",Ee={_cid:Al(),variation_title:X||j.Name||"",sku:le,item_price:ie,compare_price:ge,other_info:{...W,payment_type:me,repeat_interval:Ue,trial_days:et,installment:be==="yes"?"yes":"no",times:qe,manage_setup_fee:gt==="yes"?"yes":"no",signup_fee_name:Ze,signup_fee:Fe},media:he};oe[q].variants.push(Ee)}),P("onDataPopulated",{products:J,concat:G})},T=(G=!0)=>{if(g.value)return I(G);const J=[];p.value.forEach(oe=>{var qe,gt,Ze,Fe,Ee,Pe,Me,ht,At,Mt,Ft,$t;const Z={};Z._cid=Al();const W=m.value;Z.post_title=oe[W.post_title.value]??"",Z.post_name=oe[W.post_name.value]??Z.post_title,Z.ID=oe[W.post_id.value]??"",Z.post_content=oe[W.post_content.value]??"",Z.post_excerpt=oe[W.post_excerpt.value]??"",Z.post_status=oe[(qe=W.post_status)==null?void 0:qe.value]||"published",Z.comment_status="close";const pe=oe[(gt=W.images)==null?void 0:gt.value]||"",N=[];pe&&pe.split(",").map(ct=>ct.trim()).filter(Boolean).forEach(ct=>{const Ut=ct.split("/").pop().split("?")[0]||"image";N.push({id:0,url:ct,title:Ut})});const j=oe[(Ze=W.categories)==null?void 0:Ze.value]||"";j?Z.categories=j.split(",").map(ct=>ct.trim()).filter(Boolean):Z.categories=[];const q=oe[(Fe=W.sku)==null?void 0:Fe.value]||"",X=oe[(Ee=W.payment_type)==null?void 0:Ee.value]||"onetime",ie=oe[(Pe=W.repeat_interval)==null?void 0:Pe.value]||"",ge=oe[(Me=W.trial_days)==null?void 0:Me.value]||"",fe=oe[(ht=W.installment)==null?void 0:ht.value]||"",he=oe[(At=W.installment_count)==null?void 0:At.value]||"",le=oe[(Mt=W.manage_setup_fee)==null?void 0:Mt.value]||"",me=oe[(Ft=W.signup_fee_name)==null?void 0:Ft.value]||"",Ue=oe[($t=W.signup_fee)==null?void 0:$t.value]||"",et={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},be={description:"",payment_type:X,times:he,repeat_interval:ie,trial_days:ge,billing_summary:"",manage_setup_fee:le==="yes"?"yes":"no",signup_fee_name:me,signup_fee:Ue,setup_fee_per_item:"no",installment:fe==="yes"?"yes":"no"};Z.gallery=N,Z.variants=[];for(let ct=1;ct<=v;ct++){const Ut={};["variation_title","item_price","compare_price"].forEach(St=>{var Et;const Dt=((Et=W[St])==null?void 0:Et.value)??"";if(Dt.length>0){const It=Dt.replace("%d",ct.toString());Ut[St]=oe[It]}}),D(Ut)&&(Ut._cid=Al(),Ut.sku=q,Ut.other_info={...be},Ut.media=[],Z.variants.push(Ut))}Z.variants.length>0?(et.variation_type="simple_variations",Z.detail=et,J.push(Z)):D(Z)&&(Z.variants.push({_cid:Al(),variation_title:"",sku:q,item_price:0,compare_price:0,other_info:{...be},media:[]}),Z.detail=et,J.push(Z))}),P("onDataPopulated",{products:J,concat:G})},Q=()=>{l.value=!1,s.value=[],i.value=null,w()},E=(G=!0)=>{T(G),Q()},D=G=>{let J=!1;for(const[oe,Z]of Object.entries(G))if(typeof Z!==null&&typeof Z<"u"&&(Array.isArray(Z)&&Z.length>0||Z.toString().length>0)){J=!0;break}return J};Qe(()=>{m.value={post_id:{title:a.$t("Post ID"),value:""},post_title:{title:a.$t("Post Title"),value:""},post_name:{title:a.$t("Post Name"),value:""},post_content:{title:a.$t("Post Content"),value:""},post_excerpt:{title:a.$t("Post Excerpt"),value:""},post_status:{title:a.$t("Post Status"),value:""},post_date:{title:a.$t("Post Date"),value:""},comment_status:{title:a.$t("Comment Status"),value:""},images:{title:a.$t("Images"),value:""},variation_title:{title:a.$t("Variation Title"),value:""},item_price:{title:a.$t("Variation Price"),value:""},compare_price:{title:a.$t("Variation Compare Price"),value:""},sku:{title:a.$t("SKU"),value:""},categories:{title:a.$t("Categories"),value:""},payment_type:{title:a.$t("Payment Type"),value:""},repeat_interval:{title:a.$t("Subscription Interval"),value:""},trial_days:{title:a.$t("Trial Days"),value:""},installment:{title:a.$t("Installment"),value:""},installment_count:{title:a.$t("Installment Count"),value:""},manage_setup_fee:{title:a.$t("Setup Fee"),value:""},signup_fee_name:{title:a.$t("Setup Fee Name"),value:""},signup_fee:{title:a.$t("Setup Fee Amount"),value:""}}});const H=()=>{const G=[{ID:"",Type:"simple",SKU:"BASIC-TEE-001",Name:"Classic Cotton T-Shirt",Published:1,"Short description":"Comfortable everyday cotton tee",description:"Made from 100% organic cotton. Pre-shrunk and machine washable.",Categories:"Clothing, Clothing > T-Shirts",Images:"https://example.com/images/tee-front.jpg, https://example.com/images/tee-back.jpg",Parent:"","Regular price":"29.99","Sale price":"24.99","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"onetime","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"simple",SKU:"STARTER-PLAN",Name:"Starter Membership Plan",Published:1,"Short description":"Monthly access to premium content",description:"Get access to all premium tutorials and resources. Cancel anytime.",Categories:"Memberships",Images:"",Parent:"","Regular price":"9.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"14",Installment:"","Installment Count":"","Setup Fee":"yes","Setup Fee Name":"Activation Fee","Setup Fee Amount":"4.99"},{ID:"",Type:"simple",SKU:"PRO-YEARLY",Name:"Pro Annual Plan",Published:1,"Short description":"12-month installment plan",description:"Pay in 12 monthly installments for annual access to all pro features.",Categories:"Memberships",Images:"",Parent:"","Regular price":"19.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"",Installment:"yes","Installment Count":"12","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variable",SKU:"HOODIE-PREMIUM",Name:"Premium Zip Hoodie",Published:1,"Short description":"Heavyweight zip-up hoodie",description:"Premium quality hoodie with YKK zipper. Available in multiple colors.",Categories:"Clothing, Clothing > Hoodies",Images:"https://example.com/images/hoodie-main.jpg, https://example.com/images/hoodie-side.jpg, https://example.com/images/hoodie-detail.jpg",Parent:"","Regular price":"","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLK",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"https://example.com/images/hoodie-black.jpg",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"Black","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-WHT",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"White","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLU-LE",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"69.99","Sale price":"64.99","Attribute 1 name":"Color","Attribute 1 value(s)":"Blue","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""}],J=cc.unparse(G),oe=new Blob([J],{type:"text/csv;charset=utf-8;"}),Z=URL.createObjectURL(oe),W=document.createElement("a");W.href=Z,W.download="fluent-cart-sample-import.csv",document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(Z)},P=t;return(G,J)=>{const oe=B("el-button"),Z=B("el-upload"),W=B("el-option"),pe=B("el-select"),N=B("el-dialog");return r(),h(O,null,[n(oe,{onClick:J[0]||(J[0]=j=>l.value=!0)},{default:d(()=>[R(f(G.$t("Import")),1)]),_:1}),n(N,{modelValue:l.value,"onUpdate:modelValue":J[4]||(J[4]=j=>l.value=j),"append-to-body":!0,title:G.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[C.value?k("",!0):(r(),$(Z,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":J[1]||(J[1]=j=>s.value=j),drag:"",action:F(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":j=>{w(),i.value=j,b(j==null?void 0:j.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:d(()=>[n(Xe,{circle:"",bg:"primary",soft:""},{default:d(()=>[n(ee,{name:"Upload"})]),_:1}),o("div",t_e,[R(f(G.$t("Drag & Drop or"))+" ",1),o("em",null,f(G.$t("Browse/Upload")),1),R(" "+f(G.$t("Files"))+" ",1),o("span",null,f(A(u)("Any Format upto %s",A(Lt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),C.value?k("",!0):(r(),$(oe,{key:1,onClick:H,link:""},{default:d(()=>[n(ee,{name:"Download"}),R(" "+f(G.$t("Download a Sample CSV File")),1)]),_:1})),C.value?(r(),h(O,{key:2},[o("div",a_e,[o("h4",l_e,f(G.$t("Map Columns")),1),o("table",s_e,[o("thead",null,[o("tr",null,[o("th",null,f(G.$t("Products Fields")),1),o("th",null,f(G.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(O,null,ae(m.value,(j,q)=>(r(),h("tr",null,[o("td",null,f(j.title),1),o("td",n_e,[n(pe,{modelValue:j.value,"onUpdate:modelValue":X=>j.value=X,filterable:"",clearable:""},{default:d(()=>[(r(!0),h(O,null,ae(_.value,X=>(r(),$(W,{key:X.value,label:X.title,value:X.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",o_e,[n(oe,{onClick:J[2]||(J[2]=j=>E())},{default:d(()=>[R(f(G.$t("Add Products")),1)]),_:1}),n(oe,{onClick:J[3]||(J[3]=j=>E(!1))},{default:d(()=>[R(f(G.$t("Clear and Add Products")),1)]),_:1})])],64)):k("",!0)]),_:1},8,["modelValue","title"])],64)}}};class r_e extends Cd{beforeInit(){this.data.products=[],this.data.saving=!1,this.data.saveProgress={total:0,completed:0,errors:[],createdIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.categoryOptions=[],this.data.dummies.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"published",post_date:new Date,comment_status:"close",categories:[],variants:!1}}populateDummyProduct(){const t={...this.data.dummies.product};t._cid=Al(),t.detail={...this.data.dummies.productDetail},t.gallery=[],t.downloadable_files={...this.data.dummies.downloadableFile},t.variants=[this.getDummyVariation(t)],this.data.products.push(t)}clearProducts(){this.data.products=[]}isSaving(t){return this.data.savingIds.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSaving(t)||this.isSaved(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}chunkArray(t,a){const l=[];for(let s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async saveProducts(){var s,i;const t=this.data.products,a=t.filter(c=>!this.data.savedIds.has(c._cid));if(a.length===0){z.error("No products to save.");return}const l=this.chunkArray(a,10);this.data.saving=!0,this.data.productErrors=new Map,this.data.saveProgress={total:l.length,completed:0,errors:[],createdIds:[]};try{for(const m of l){const _=m.map(g=>g._cid);for(const g of _)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await ce.post("products/bulk-insert",{products:m});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(C=>C._cid===y._cid);v&&(v.ID=y.id,v.view_url=y.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(g.errors&&g.errors.length){this.data.saveProgress.errors.push(...g.errors);for(const y of g.errors)y._cid&&this.data.productErrors.set(y._cid,{message:y.message,fields:y.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(g){const y=(s=g==null?void 0:g.data)==null?void 0:s.errors;if(Array.isArray(y)&&y.length){this.data.saveProgress.errors.push(...y);for(const v of y)v._cid&&this.data.productErrors.set(v._cid,{message:v.message,fields:v.fields||{}})}else{const v=((i=g==null?void 0:g.data)==null?void 0:i.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:v});for(const C of _)this.data.productErrors.set(C,{message:v,fields:{}})}this.data.productErrors=new Map(this.data.productErrors)}for(const g of _)this.data.savingIds.delete(g);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:c,errors:p}=this.data.saveProgress;p.length===0?z.success(`${c.length} product(s) created successfully`):c.length>0?z.info(`${c.length} product(s) created, ${p.length} error(s)`):z.error("All products failed to save")}finally{this.data.saving=!1}}async removeProduct(t){var l;if(t.ID&&this.data.savedIds.has(t._cid)){try{await ce.delete(`products/${t.ID}`)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product from server";z.error(i);return}this.data.savedIds.delete(t._cid),this.data.savedIds=new Set(this.data.savedIds)}const a=this.data.products.indexOf(t);a!==-1&&this.data.products.splice(a,1)}removeVariant(t,a){const l=t.variants.indexOf(a);l!==-1&&t.variants.splice(l,1)}duplicateProduct(t){const a=JSON.parse(JSON.stringify(t));a._cid=Al(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(s=>{s.sku="",s._cid=Al()});const l=this.data.products.indexOf(t);this.data.products.splice(l+1,0,a)}duplicateProductWithVariants(t,a){const l=JSON.parse(JSON.stringify(t));if(l._cid=Al(),l.post_title=l.post_title?l.post_title+" (Copy)":"",l.variants&&Array.isArray(l.variants)){const i=new Set(a);l.variants=l.variants.filter((c,p)=>i.has(p)),l.variants.forEach(c=>{c.sku="",c._cid=Al()})}const s=this.data.products.indexOf(t);this.data.products.splice(s+1,0,l)}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l._cid=Al(),l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="";const s=t.variants.indexOf(a);t.variants.splice(s+1,0,l)}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}resetState(){this.data.products.splice(0),this.data.savedIds=new Set,this.data.savingIds=new Set,this.data.productErrors=new Map}getColumnWidthStorageKey(){return"bulk_insert_column_widths"}getColumnStorageKey(){return"bulk_insert_columns"}getToggleableColumns(){return[{label:"SKU",value:"sku"},{label:"Media",value:"media"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}flattenCategoryTree(t,a=""){var s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await ce.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}}const kt=r_e.init(),d_e={class:"max-w-full overflow-x-scroll"},u_e={class:"relative"},c_e={key:0,class:"bulk-checkbox-cell"},A_e=["onMousedown","onTouchstart"],Np={__name:"ResizeableColumns",props:{columns:{type:Array,required:!0},stickyLast:{type:Boolean,default:!1}},emits:["scroll","resize-end"],setup(e,{emit:t}){const a=t,l=gf(),s=Kr("table"),i=V(null);let c=null;Qe(()=>{Se(()=>{const g=s.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,C)=>{const b=C-y;b<0||b>=p.columns.length||(p.columns[b].width=v.offsetWidth,p.columns[b].minWidth||(p.columns[b].minWidth=v.offsetWidth))}),c=new ResizeObserver(()=>{s.value.style.setProperty("--resizer-height",s.value.offsetHeight+"px");const v=s.value.querySelector("th");v&&s.value.style.setProperty("--header-height",v.offsetHeight+"px")}),c.observe(s.value)})}),vl(()=>{c&&c.disconnect()});const p=e,m=K(()=>{const g=l["header-first"]?40:0;return p.columns.reduce((y,v)=>y+v.width,0)+g}),_=(g,y)=>{g.preventDefault();const v=g.clientX,C=p.columns[y].width,b=p.columns[y].minWidth||50;i.value=y;const w=F=>{const L=C+(F.clientX-v);L>=b&&(p.columns[y].width=L)},x=()=>{i.value=null,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",x),a("resize-end")};document.addEventListener("mousemove",w),document.addEventListener("mouseup",x)};return(g,y)=>(r(),h("div",d_e,[o("div",{class:de(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",u_e,[o("table",{id:"tb",ref_key:"table",ref:s,style:na({tableLayout:"fixed",width:m.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",c_e,[Ca(g.$slots,"header-first")])):k("",!0),(r(!0),h(O,null,ae(e.columns,(v,C)=>(r(),h("th",{class:de({"sticky-col":C===0,"sticky-col sticky-col-right":C===e.columns.length-1&&e.stickyLast}),style:na({width:v.width+"px",zIndex:C===0||C===e.columns.length-1&&e.stickyLast?70:e.columns.length-C+50,left:C===0&&g.$slots["header-first"]?"40px":C===0?"0px":void 0}),key:v.key||C},[C===e.columns.length-1?Ca(g.$slots,"header-last",{key:0},()=>[R(f(v.title),1)]):(r(),h(O,{key:1},[R(f(v.title),1)],64)),C<e.columns.length-1?(r(),h("span",{key:2,class:de(["resizer",{"is-active":i.value===C}]),onMousedown:b=>_(b,C),onTouchstart:b=>_(b,C)},null,42,A_e)):k("",!0)],6))),128))])]),o("tbody",null,[Ca(g.$slots,"default")])],4)])],34)]))}},p_e={class:"bulk-setup-fee-badge"},f_e={key:1,class:"text-gray-300 text-sm flex justify-center"},No={__name:"BulkPriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,s)=>{var p;const i=B("el-tooltip"),c=B("el-input");return e.variant?(r(),$(c,{key:0,size:"small",class:de({"is-error":e.hasError}),modelValue:e.variant.item_price,"onUpdate:modelValue":s[0]||(s[0]=m=>e.variant.item_price=m),placeholder:l.$t("Price"),type:"number",disabled:e.disabled,onInput:s[1]||(s[1]=m=>a("change"))},ta({_:2},[((p=e.variant.other_info)==null?void 0:p.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:d(()=>[n(i,{content:(e.variant.other_info.signup_fee_name||l.$t("Setup fee"))+": "+l.currencySign()+e.variant.other_info.signup_fee,placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o("span",p_e,"+ "+f(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["class","modelValue","placeholder","disabled"])):(r(),h("span",f_e,"—"))}}},m_e=["disabled"],h_e={key:0,class:"fct-bulk-sub-count"},__e={class:"fct-bulk-sub-popover-body"},v_e={class:"fct-bulk-sub-popover-title"},g_e={class:"fct-bulk-sub-section"},y_e={class:"fct-bulk-sub-row"},b_e={class:"fct-bulk-sub-row"},w_e={class:"fct-bulk-sub-label"},C_e={class:"fct-bulk-sub-row"},B_e={class:"fct-bulk-sub-label"},k_e=["innerHTML"],x_e={class:"fct-bulk-sub-section"},S_e={class:"fct-bulk-sub-row"},F_e={class:"fct-bulk-sub-row"},$_e={class:"fct-bulk-sub-label"},E_e={class:"fct-bulk-sub-row"},U_e={class:"fct-bulk-sub-label"},I_e=["innerHTML"],Q_e={class:"fct-bulk-sub-footer"},D_e={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,l=t,s=zt().ctx,i=ze.get(),c=ze.get("app_config.isProActive"),p=V(!1),m=K(()=>{var U;return((U=i==null?void 0:i.shop)==null?void 0:U.currency_sign)||"$"}),_=K(()=>{var U;return((U=a.variant)==null?void 0:U.other_info)||{}}),g=K(()=>_.value.payment_type==="subscription"),y=K(()=>_.value.installment==="yes"),v=K(()=>Number(_.value.times)||1),C=K(()=>{var S;const U=Number((S=a.variant)==null?void 0:S.item_price)||0;return y.value?U*v.value:U}),b=K(()=>{const U=[];if(y.value&&U.push(s.$t("Installment")+": "+v.value+"x"),_.value.manage_setup_fee==="yes"){const S=_.value.signup_fee_name||s.$t("Setup fee"),M=_.value.signup_fee||0;U.push(s.$t("Setup fee")+": "+S+" ("+m.value+M+")")}return U.length>0?U.join(` | |
| 294 | -`):s.$t("Subscription settings")}),w=U=>{U==="no"?a.variant.other_info.times="":a.variant.other_info.times||(a.variant.other_info.times=1),l("changed")},x=U=>{U==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},F=()=>{l("changed")},L=()=>{p.value=!1};return(U,S)=>{const M=B("el-checkbox"),I=B("el-tooltip"),T=B("el-input"),Q=B("el-switch"),E=B("el-button"),D=B("el-popover");return r(),$(I,{content:b.value,placement:"top",disabled:!g.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[n(D,{visible:p.value,"onUpdate:visible":S[6]||(S[6]=H=>p.value=H),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!g.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[o("button",{class:de(["fc-bulk-sub-icon-btn",{"is-active":g.value,"is-configured":g.value&&(y.value||_.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!g.value,onClick:S[0]||(S[0]=Ne(()=>{},["prevent"]))},[S[7]||(S[7]=o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M6 4H21C21.5523 4 22 4.44772 22 5V12H20V6H6V9L1 5.5L6 2V4ZM18 20H3C2.44772 20 2 19.5523 2 19V12H4V18H18V15L23 18.5L18 22V20Z"})],-1)),y.value?(r(),h("span",h_e,f(v.value),1)):k("",!0)],10,m_e)]),default:d(()=>[o("div",__e,[o("h4",v_e,f(U.$t("Subscription Settings")),1),o("div",g_e,[o("div",y_e,[n(M,{"true-value":"yes","false-value":"no",label:U.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":S[1]||(S[1]=H=>e.variant.other_info.installment=H),disabled:!A(c)||e.disabled,onChange:w},null,8,["label","modelValue","disabled"]),A(c)?k("",!0):(r(),$(I,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(f(U.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(ee,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.installment==="yes"?(r(),h(O,{key:0},[o("div",b_e,[o("label",w_e,f(U.$t("Installment Count")),1),n(T,{type:"number",min:1,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":S[2]||(S[2]=H=>e.variant.other_info.times=H),modelModifiers:{number:!0},placeholder:U.$t("Count"),style:{width:"100px"},onInput:F},null,8,["modelValue","placeholder"])]),o("div",C_e,[o("span",B_e,f(U.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:m.value+C.value},null,8,k_e)])],64)):k("",!0)]),o("div",x_e,[o("div",S_e,[n(Q,{"active-text":U.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":S[3]||(S[3]=H=>e.variant.other_info.manage_setup_fee=H),"active-value":"yes","inactive-value":"no",disabled:!A(c)||e.disabled,size:"small",onChange:x},null,8,["active-text","modelValue","disabled"]),A(c)?k("",!0):(r(),$(I,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(f(U.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(ee,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),_.value.manage_setup_fee==="yes"?(r(),h(O,{key:0},[o("div",F_e,[o("label",$_e,f(U.$t("Label")),1),n(T,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":S[4]||(S[4]=H=>e.variant.other_info.signup_fee_name=H),placeholder:U.$t("e.g. Initial Setup"),onInput:F},null,8,["modelValue","placeholder"])]),o("div",E_e,[o("label",U_e,f(U.$t("Amount")),1),n(T,{size:"small",type:"number",min:0,modelValue:e.variant.other_info.signup_fee,"onUpdate:modelValue":S[5]||(S[5]=H=>e.variant.other_info.signup_fee=H),modelModifiers:{number:!0},placeholder:U.$t("Amount"),onInput:F},{prefix:d(()=>[o("span",{innerHTML:m.value},null,8,I_e)]),_:1},8,["modelValue","placeholder"])])],64)):k("",!0)]),o("div",Q_e,[n(E,{size:"small",type:"primary",onClick:L},{default:d(()=>[R(f(U.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},V_e={key:0,class:"flex items-center"},T_e={key:1,class:"text-gray-300 text-sm flex justify-center"},Ko={__name:"BulkPaymentTypeCell",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change","payment-type-change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i;return(i=a.variant)==null?void 0:i.other_info};return(i,c)=>{const p=B("el-option"),m=B("el-select");return e.variant&&s()?(r(),h("div",V_e,[n(m,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("payment-type-change",e.variant))},{default:d(()=>[n(p,{label:i.$t("One Time"),value:"onetime"},null,8,["label"]),n(p,{label:i.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),n(D_e,{variant:e.variant,disabled:e.disabled,onChanged:c[2]||(c[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",T_e,"—"))}}},M_e={key:1,class:"text-gray-300 text-sm flex justify-center"},Go={__name:"BulkIntervalSelect",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=B("el-option"),m=B("el-select");return e.variant&&s()?(r(),$(m,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("change"))},{default:d(()=>[n(p,{label:i.$t("Yearly"),value:"yearly"},null,8,["label"]),n(p,{label:i.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),n(p,{label:i.$t("Quarterly"),value:"quarterly"},null,8,["label"]),n(p,{label:i.$t("Monthly"),value:"monthly"},null,8,["label"]),n(p,{label:i.$t("Weekly"),value:"weekly"},null,8,["label"]),n(p,{label:i.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(r(),h("span",M_e,"—"))}}},L_e={key:1,class:"text-gray-300 text-sm flex justify-center"},jo={__name:"BulkTrialDaysInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=B("el-input");return e.variant&&s()?(r(),$(p,{key:0,class:de(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":c[0]||(c[0]=m=>e.variant.other_info.trial_days=m),placeholder:"0",disabled:e.disabled,onChange:c[1]||(c[1]=m=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",L_e,"—"))}}},R_e={key:1,class:"text-gray-300 text-sm flex justify-center"},zo={__name:"BulkComparePriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,s)=>{const i=B("el-input");return e.variant?(r(),$(i,{key:0,size:"small",class:de({"is-error":e.hasError}),modelValue:e.variant.compare_price,"onUpdate:modelValue":s[0]||(s[0]=c=>e.variant.compare_price=c),placeholder:l.$t("Compare price"),disabled:e.disabled,onInput:s[1]||(s[1]=c=>a("change"))},null,8,["class","modelValue","placeholder","disabled"])):(r(),h("span",R_e,"—"))}}},Kp={__name:"BulkCategorySelect",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=t,l=s=>{a("update:modelValue",s),a("change",s)};return(s,i)=>{const c=B("el-option"),p=B("el-select");return r(),$(p,{"model-value":e.modelValue,multiple:"",filterable:"","allow-create":"","default-first-option":"","collapse-tags":"","collapse-tags-tooltip":!1,"max-collapse-tags":1,size:"small",placeholder:s.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":l},{default:d(()=>[(r(!0),h(O,null,ae(e.options,m=>(r(),$(c,{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},O_e=["textContent"],H_e={key:1,class:"fct-bulk-editor-placeholder"},qo={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(r(),h("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=l=>t.$emit("click"))},[e.value?(r(),h("span",{key:0,class:"bulk-editor-preview",textContent:f(e.value)},null,8,O_e)):(r(),h("span",H_e,f(e.placeholder),1))]))}};function Gp(){const e=V(new Set),t=V(null),a=V(!1),l=(y,v,C)=>{if(v.shiftKey&&t.value!==null){const w=C.indexOf(t.value),x=C.indexOf(y);if(w!==-1&&x!==-1){const F=Math.min(w,x),L=Math.max(w,x),U=new Set(e.value);for(let S=F;S<=L;S++)U.add(C[S]);e.value=U}}else{const w=new Set(e.value);w.has(y)?w.delete(y):w.add(y),e.value=w,t.value=y}},s=y=>{e.value.size===y.length&&y.length>0?e.value=new Set:e.value=new Set(y)},i=y=>{e.value=new Set(y)},c=()=>{e.value=new Set,t.value=null,a.value=!1},p=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};Ce(e,y=>{a.value&&y.size<2&&(a.value=!1)});const m=y=>e.value.has(y),_=K(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:c,toggleLinkMode:p,isSelected:m,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let C=!1;const b=new Set;for(const w of e.value)v.has(w)?b.add(w):C=!0;C&&(e.value=b),t.value&&!v.has(t.value)&&(t.value=null)}}}const P_e={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},jp={title:{product:{get:e=>e.post_title,set:(e,t)=>e.post_title=t},variant:{get:e=>e.variation_title,set:(e,t)=>e.variation_title=t}},sku:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.sku},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].sku=t)}},variant:{get:e=>e.sku,set:(e,t)=>e.sku=t}},status:{product:{get:e=>e.post_status,set:(e,t)=>e.post_status=t}},description:{product:{get:e=>e.post_content,set:(e,t)=>e.post_content=t}},short_desc:{product:{get:e=>e.post_excerpt,set:(e,t)=>e.post_excerpt=t}},product_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.fulfillment_type},set:(e,t)=>{e.detail&&(e.detail.fulfillment_type=t)}}},pricing_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.variation_type},set:(e,t)=>{e.detail&&(e.detail.variation_type=t)}}},payment_type:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.payment_type},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.payment_type=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.payment_type},set:(e,t)=>{e.other_info&&(e.other_info.payment_type=t)}}},interval:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.repeat_interval},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.repeat_interval=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.repeat_interval},set:(e,t)=>{e.other_info&&(e.other_info.repeat_interval=t)}}},trial_days:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.trial_days},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.trial_days=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.trial_days},set:(e,t)=>{e.other_info&&(e.other_info.trial_days=t)}}},price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.item_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].item_price=t)}},variant:{get:e=>e.item_price,set:(e,t)=>e.item_price=t}},compare_price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.compare_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].compare_price=t)}},variant:{get:e=>e.compare_price,set:(e,t)=>e.compare_price=t}},manage_stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.manage_stock},set:(e,t)=>{e.detail&&(e.detail.manage_stock=t)}}},categories:{product:{get:e=>e.categories,set:(e,t)=>e.categories=[...t]}}},N_e={...jp,stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.total_stock},set:(e,t)=>{e.detail&&(e.detail.total_stock=t)}},variant:{get:e=>e.total_stock,set:(e,t)=>e.total_stock=t}}},K_e={...jp,stock:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.available},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].available=t)}},variant:{get:e=>e.available,set:(e,t)=>e.available=t}}};function zp(e,t,a,l,s,i,c){const p=c[e];if(p)for(const m of l){if(m===a)continue;const _=s(m);if(!_)continue;const g=p[_.type];g&&(g.set(_.data,t),i&&i(_.product))}}const G_e={class:"fct-bulk-insert-page fct-layout-width"},j_e={class:"fct-btn-group sm justify-end"},z_e={class:"filter-popover-item"},q_e={class:"filter-popover-title"},Y_e={key:0,"aria-hidden":"true"},W_e=["colspan"],X_e=["onClick"],J_e=["onClick"],Z_e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},eve={class:"flex items-center"},tve=["onClick","title"],ave={key:0,class:"bulk-collapse-count"},lve=["title"],sve=["title"],nve={class:"bulk-status-icon is-error"},ove={key:0,class:"fct-bulk-sku-cell"},ive={key:1,class:"text-gray-300 text-sm flex justify-center"},rve={key:1,class:"fct-bulk-media-cell"},dve={key:2,class:"fct-bulk-categories-cell"},uve={key:3,class:"fct-bulk-desc-cell"},cve={key:4,class:"fct-bulk-short-desc-cell"},Ave={key:5,class:"fct-bulk-status-cell"},pve={key:6,class:"fct-bulk-product-type-cell"},fve={key:7,class:"fct-bulk-product-type-cell"},mve={key:8,class:"fct-bulk-pricing-type-cell"},hve={key:9,class:"fct-bulk-pricing-type-cell"},_ve={key:10,class:"fct-bulk-payment-type-cell"},vve={key:11,class:"fct-bulk-interval-cell"},gve={key:12,class:"fct-bulk-trial-days-cell"},yve={key:13,class:"fct-bulk-best-price-cell"},bve={key:14,class:"fct-bulk-compare-price-cell"},wve={key:15,class:"fct-bulk-qty-cell !pl-5"},Cve={key:16,class:"fct-bulk-stock-cell"},Bve={key:1,class:"text-gray-300 text-sm pl-5"},kve={class:"fct-btn-group xs justify-end"},xve=["href","title"],Sve={key:0,class:"bulk-variants-block-row"},Fve=["colspan"],$ve={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Eve=["onClick"],Uve={class:"bulk-checkbox-cell"},Ive={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Qve={class:"flex items-center gap-1 pl-4"},Dve={class:"bulk-status-icon is-error"},Vve={key:0,class:"fct-bulk-sku-cell"},Tve={key:1,class:"fct-bulk-media-cell"},Mve={key:2},Lve={key:3},Rve={key:4},Ove={key:5},Hve={key:6},Pve={key:7},Nve={key:8},Kve={key:9},Gve={key:10},jve={key:11},zve={key:12},qve={key:13,class:"text-center"},Yve={key:14},Wve={key:1,class:"text-gray-300 text-sm flex justify-center"},Xve={class:"fct-btn-group sm justify-end"},Jve={class:"bulk-add-variant-row"},Zve=["colspan"],ege={class:"sticky left-0 inline-block pl-6"},tge={key:1,"aria-hidden":"true"},age=["colspan"],Ji=43,lge=10,sge=800,Ac=100,nge={__name:"BulkInsert",setup(e){const{options:t,products:a}=kt.data,l=ve=>{var $e;return(($e=ve==null?void 0:ve.detail)==null?void 0:$e.variation_type)==="simple"},s=K(()=>kt.data.saving),i=K(()=>kt.data.saveProgress),c=K(()=>{const ve=kt.data.saveProgress;return ve.total?Math.round(ve.completed/ve.total*100):0}),p=()=>{kt.saveProducts()},m=ve=>kt.isSaving(ve._cid),_=ve=>kt.isSaved(ve._cid),g=ve=>kt.isRowDisabled(ve._cid),y=ve=>kt.hasError(ve._cid),v=ve=>kt.getError(ve._cid),C=ve=>kt.hasProductLevelError(ve._cid),b=(ve,$e)=>kt.hasVariantError(ve._cid,$e),w=(ve,$e)=>kt.getVariantError(ve._cid,$e),x=(ve,$e)=>kt.hasFieldError(ve._cid,$e),F=(ve,$e,ot)=>kt.hasVariantFieldError(ve._cid,$e,ot),L=async ve=>{const $e=ve.post_title||P.$t("Untitled product"),ot=Array.isArray(ve.variants)?ve.variants.length:0,vt=kt.isSaved(ve._cid);let yt=ot>0?P.$t('This will remove "%s" and its %s variant(s).').replace("%s",$e).replace("%s",ot):P.$t('This will remove "%s".').replace("%s",$e);vt&&(yt+=" "+P.$t("This product was already saved and will be permanently deleted."));try{await Ja.confirm(yt,P.$t("Remove Product"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}await kt.removeProduct(ve)},U=(ve,$e)=>{const ot=$e.variation_title||P.$t("Untitled variant");Ja.confirm(P.$t('This will remove the variant "%s".').replace("%s",ot),P.$t("Remove Variant"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{kt.removeVariant(ve,$e)}).catch(()=>{})},S=ve=>kt.duplicateProduct(ve),M=(ve,$e)=>kt.duplicateVariant(ve,$e),I=()=>{const ve=[];for(const $e of a){const ot=`p:${$e._cid}`,vt=j.value.has(ot),yt=[];$e.variants&&$e.variants.forEach((Nt,ft)=>{j.value.has(`v:${$e._cid}:${ft}`)&&yt.push(ft)}),!(!vt&&yt.length===0)&&(vt&&yt.length===0?ve.push({product:$e,type:"full"}):!vt&&yt.length>0?ve.push({product:$e,type:"variants-only",variantIndexes:yt}):ve.push({product:$e,type:"partial",variantIndexes:yt}))}return ve},T=()=>{const ve=I();if(!ve.length)return;const $e=ve.filter(ft=>ft.type==="full").length,ot=ve.filter(ft=>ft.type==="partial").length,yt=ve.filter(ft=>ft.type==="variants-only").reduce((ft,Zt)=>ft+Zt.variantIndexes.length,0),Nt=[];$e>0&&Nt.push(`${$e} product(s) with all variants`),ot>0&&Nt.push(`${ot} product(s) with selected variants`),yt>0&&Nt.push(`${yt} variant(s)`),Ja.confirm(P.$t("Duplicate %s?").replace("%s",Nt.join(", ")),P.$t("Bulk Duplicate"),{confirmButtonText:P.$t("Duplicate"),cancelButtonText:P.$t("Cancel"),type:"info"}).then(()=>{for(const ft of ve)if(ft.type==="full")kt.duplicateProduct(ft.product);else if(ft.type==="variants-only")for(const Zt of ft.variantIndexes){const pa=ft.product.variants[Zt];pa&&kt.duplicateVariant(ft.product,pa)}else ft.type==="partial"&&kt.duplicateProductWithVariants(ft.product,ft.variantIndexes);ge()}).catch(()=>{})},Q=async()=>{const ve=[],$e=[];for(const ft of a){const Zt=`p:${ft._cid}`;if(j.value.has(Zt)){ve.push(ft);continue}const Kt=[];ft.variants&&ft.variants.forEach((aa,Ma)=>{j.value.has(`v:${ft._cid}:${Ma}`)&&Kt.push(aa)}),Kt.length>0&&$e.push({product:ft,variants:Kt})}if(!ve.length&&!$e.length)return;const ot=ve.filter(ft=>kt.isSaved(ft._cid)).length,vt=$e.reduce((ft,Zt)=>ft+Zt.variants.length,0),yt=[];ve.length>0&&yt.push(`${ve.length} product(s)`),vt>0&&yt.push(`${vt} variant(s)`);let Nt=P.$t("Remove %s?").replace("%s",yt.join(" and "));ot>0&&(Nt+=" "+P.$t("%s already saved will be permanently deleted.").replace("%s",`${ot}`));try{await Ja.confirm(Nt,P.$t("Bulk Remove"),{confirmButtonText:P.$t("Remove"),cancelButtonText:P.$t("Cancel"),type:"warning"})}catch{return}for(const ft of ve)await kt.removeProduct(ft);for(const{product:ft,variants:Zt}of $e)for(const pa of Zt)kt.removeVariant(ft,pa);ge()},E=ve=>{kt.resetPaymentTypeDefaults(ve)},D=(ve,$e)=>{const ot=kt.data.categoryOptions;for(const vt of $e)ot.find(yt=>yt.value===vt)||ot.push({label:vt,value:vt})},H=()=>{kt.populateDummyProduct()},P=zt().ctx,G=ve=>{const $e=kt.data.products;ve.concat||($e.splice(0,$e.length),kt.data.savedIds=new Set,kt.data.savingIds=new Set,kt.data.productErrors=new Map),$e.push(...ve.products)},J=V({visible:!1,field:"",product:null,value:""}),oe=(ve,$e)=>{J.value={visible:!0,field:$e,product:ve,value:ve[$e]||""}},Z=ve=>{J.value.value=ve},W=()=>{const{product:ve,field:$e,value:ot}=J.value;ve&&(ve[$e]=ot),J.value.visible=!1},pe=K(()=>J.value.field==="post_content"?P.$t("Edit Description"):P.$t("Edit Short Description")),N=V(!0),{selectedKeys:j,handleRowClick:q,toggleSelectAll:X,selectAll:ie,deselectAll:ge,isSelected:fe,selectedCount:he,isLinkMode:le,toggleLinkMode:me}=Gp(),Ue=K(()=>{const ve=[];for(const $e of ct.value)if(ve.push(`p:${$e.productId}`),$e.hasVariants&&!$e.collapsed)for(let ot=0;ot<$e.product.variants.length;ot++)ve.push(`v:${$e.productId}:${ot}`);return ve}),et=ve=>{var $e;if(ve.startsWith("p:")){const ot=ve.slice(2),vt=a.find(yt=>yt._cid===ot);return vt?{type:"product",data:vt,product:vt}:null}else if(ve.startsWith("v:")){const ot=ve.split(":"),vt=ot[1],yt=parseInt(ot[2]),Nt=a.find(ft=>ft._cid===vt);if(Nt&&(($e=Nt.variants)!=null&&$e[yt]))return{type:"variant",data:Nt.variants[yt],product:Nt}}return null},be=(ve,$e,ot)=>{!le.value||!fe(ot)||zp(ve,$e,ot,j.value,et,null,N_e)},qe=V(!1),gt=ve=>{ve.key==="Shift"&&(qe.value=!0)},Ze=ve=>{ve.key==="Shift"&&(qe.value=!1)},Fe=(ve,$e)=>{if(!$e.shiftKey||$e.target.closest(".bulk-checkbox-cell"))return;$e.preventDefault();const ot=new Set(j.value);ot.has(ve)?ot.delete(ve):ot.add(ve),j.value=ot},Ee=V([]),Pe=K(()=>Ee.value.filter(ve=>ve.key==="title"||ve.key==="actions"?!0:kt.isColumnVisible(ve.key))),Me=ve=>kt.isColumnVisible(ve),ht=()=>{kt.saveColumnWidths(Ee.value)},At=V(new Set),Mt=ve=>{const $e=ve._cid;At.value.has($e)?At.value.delete($e):At.value.add($e),At.value=new Set(At.value)},Ft=ve=>At.value.has(ve._cid),$t=V(0),ct=K(()=>{let ve=0;return a.map($e=>{var Kt;const ot=$e._cid,vt=((Kt=$e.detail)==null?void 0:Kt.variation_type)!=="simple"&&Array.isArray($e.variants),yt=vt?$e.variants.length:0,Nt=At.value.has(ot),ft=vt&&!Nt?(yt+1)*Ji:0,Zt=Ji+ft,pa={product:$e,productId:ot,hasVariants:vt,variantCount:yt,collapsed:Nt,groupHeight:Zt,offset:ve};return ve+=Zt,pa})}),Ut=K(()=>{const ve=ct.value;if(ve.length===0)return 0;const $e=ve[ve.length-1];return $e.offset+$e.groupHeight}),St=K(()=>{const ve=ct.value,$e=$t.value,ot=$e+sge,vt=lge*Ji;return ve.filter(yt=>yt.offset+yt.groupHeight>=$e-vt&&yt.offset<=ot+vt)}),Dt=K(()=>St.value.length===0?0:St.value[0].offset),Et=K(()=>{if(St.value.length===0)return 0;const ve=St.value[St.value.length-1];return Ut.value-ve.offset-ve.groupHeight});let It=null,Ht=0;const Bt=ve=>{const $e=ve.target,ot=Date.now();It&&clearTimeout(It),ot-Ht>=Ac?($t.value=$e.scrollTop,Ht=ot):It=setTimeout(()=>{$t.value=$e.scrollTop,Ht=Date.now(),It=null},Ac)};let ra=null;return Qe(async()=>{ra=ps(),ra.bind("mod+a",ve=>{var ot,vt;const $e=(ot=document.activeElement)==null?void 0:ot.tagName;$e==="INPUT"||$e==="TEXTAREA"||(vt=document.activeElement)!=null&&vt.isContentEditable||(ve.preventDefault(),ie(Ue.value))}),ra.bind("escape",()=>{var $e,ot;const ve=($e=document.activeElement)==null?void 0:$e.tagName;ve==="INPUT"||ve==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(le.value?me():ge())}),Ee.value=[{key:"title",title:P.$t("Title"),width:150,minWidth:100},{key:"sku",title:P.$t("SKU"),width:120,minWidth:80},{key:"media",title:P.$t("Media"),width:100,minWidth:50},{key:"categories",title:P.$t("Categories"),width:200,minWidth:150},{key:"description",title:P.$t("Description"),width:200,minWidth:150},{key:"short_description",title:P.$t("Short Description"),width:150,minWidth:100},{key:"status",title:P.$t("Status"),width:100,minWidth:50},{key:"product_type",title:P.$t("Product Type"),width:200,minWidth:150},{key:"pricing_type",title:P.$t("Pricing Type"),width:200,minWidth:150},{key:"payment_type",title:P.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:P.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:P.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:P.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:P.$t("Compare-at Price"),width:200,minWidth:150},{key:"track_quantity",title:P.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:P.$t("Stock"),width:150,minWidth:150},{key:"actions",title:"",width:110,minWidth:110}],kt.restoreColumnWidths(Ee.value),kt.setupColumnVisibility(),kt.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",gt),window.addEventListener("keyup",Ze)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",gt),window.removeEventListener("keyup",Ze),ra&&ra.reset()}),(ve,$e)=>{const ot=B("el-button"),vt=B("el-progress"),yt=B("el-checkbox"),Nt=B("el-checkbox-group"),ft=B("el-tooltip"),Zt=B("el-popover"),pa=B("el-input"),Kt=B("el-icon"),aa=B("el-option"),Ma=B("el-select"),Fl=B("el-switch"),ul=B("el-dialog");return r(),h("div",G_e,[n(ll,{title:ve.$t("Bulk Insert")},{action:d(()=>[n(i_e,{onOnDataPopulated:G}),n(ot,{onClick:H},{default:d(()=>[R(f(ve.$t("Add Product")),1)]),_:1}),n(ot,{type:"primary",onClick:p,loading:s.value,disabled:s.value||A(a).length===0},{default:d(()=>[R(f(s.value?ve.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):ve.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(r(),$(vt,{key:0,percentage:c.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):k("",!0),n(xe,null,{default:d(()=>{var da;return[A(a).length>0?(r(),$(Ve,{key:0,title:((da=A(a))==null?void 0:da.length)===1?ve.$t("Product"):ve.$t("Products"),border_bottom:""},{action:d(()=>[o("div",j_e,[n(ot,{disabled:A(he)===0,onClick:Q,size:"small",type:"danger",soft:""},{default:d(()=>[$e[8]||($e[8]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+f(ve.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(ot,{disabled:A(he)===0,onClick:T,size:"small",type:"info",soft:""},{default:d(()=>[$e[9]||($e[9]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+f(ve.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(ot,{class:de({"is-active":A(le)}),disabled:A(he)<2&&!A(le),onClick:A(me),size:"small",type:"info",soft:""},{default:d(()=>[$e[10]||($e[10]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+f(A(le)?ve.$t("Unlink"):ve.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(yt,{modelValue:N.value,"onUpdate:modelValue":$e[0]||($e[0]=_e=>N.value=_e),label:ve.$t("Pin Actions")},null,8,["modelValue","label"]),n(Zt,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(ft,{effect:"light",content:ve.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button",size:"small"},{default:d(()=>[n(ee,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",z_e,[o("h3",q_e,f(ve.$t("Columns")),1),n(Nt,{modelValue:A(kt).data.visibleColumns,"onUpdate:modelValue":$e[1]||($e[1]=_e=>A(kt).data.visibleColumns=_e),class:"fct-checkbox-blocks",onChange:$e[2]||($e[2]=_e=>A(kt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(O,null,ae(A(kt).getToggleableColumns(),_e=>(r(),$(yt,{key:_e.value,value:_e.value,label:ve.$t(_e.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):k("",!0),n(ke,{class:"p-0"},{default:d(()=>[A(a).length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(le),"is-shift-held":qe.value}])},[n(Np,{columns:Pe.value,"sticky-last":N.value,onScroll:Bt,onResizeEnd:ht},{"header-first":d(()=>[n(yt,{"model-value":A(he)>0&&A(he)===Ue.value.length,indeterminate:A(he)>0&&A(he)<Ue.value.length,onChange:$e[3]||($e[3]=_e=>A(X)(Ue.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[R(f(ve.$t("Actions")),1)]),default:d(()=>[Dt.value>0?(r(),h("tr",Y_e,[o("td",{colspan:Pe.value.length+1,style:na({height:Dt.value+"px",padding:0,border:"none"})},null,12,W_e)])):k("",!0),(r(!0),h(O,null,ae(St.value,_e=>{var qa,Y,se,ye,Re,tt,dt,je,ne,Ae,we,Be,Ye,bt,wt;return r(),h(O,{key:_e.productId},[o("tr",{class:de(["bulk-product-row",{"is-saving":m(_e.product),"is-saved":_(_e.product),"has-product-error":y(_e.product),"is-selected":A(fe)(`p:${_e.productId}`)}]),onClick:te=>Fe(`p:${_e.productId}`,te)},[o("td",{class:"bulk-checkbox-cell",onClick:te=>A(q)(`p:${_e.productId}`,te,Ue.value)},[n(yt,{"model-value":A(fe)(`p:${_e.productId}`),tabindex:"-1"},null,8,["model-value"])],8,J_e),o("td",Z_e,[o("div",eve,[_e.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(te=>Mt(_e.product),["prevent"]),title:Ft(_e.product)?ve.$t("Expand variants"):ve.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":Ft(_e.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},$e[11]||($e[11]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Ft(_e.product)?(r(),h("span",ave,f(_e.variantCount),1)):k("",!0)],8,tve)):k("",!0),n(pa,{class:de(["fct-bulk-input",{"is-error":x(_e.product,"post_title")}]),modelValue:_e.product.post_title,"onUpdate:modelValue":te=>_e.product.post_title=te,placeholder:ve.$t("Product title"),size:"small",disabled:g(_e.product),onInput:te=>be("title",te,`p:${_e.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),m(_e.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ve.$t("Saving...")},[n(Kt,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,lve)):_(_e.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:ve.$t("Saved")},$e[12]||($e[12]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-.997-6l7.07-7.071-1.414-1.414-5.656 5.657-2.829-2.829-1.414 1.414L11.003 16z"})],-1)]),8,sve)):C(_e.product)||l(_e.product)&&y(_e.product)?(r(),$(ft,{key:3,content:v(_e.product),placement:"top"},{default:d(()=>[o("span",nve,[n(Kt,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Me("sku")?(r(),h("td",ove,[((Y=(qa=_e.product)==null?void 0:qa.detail)==null?void 0:Y.variation_type)==="simple"&&((se=_e.product.variants)!=null&&se[0])?(r(),$(pa,{key:0,class:de(["fct-bulk-input",{"is-error":x(_e.product,"variants.0.sku")}]),modelValue:_e.product.variants[0].sku,"onUpdate:modelValue":[te=>_e.product.variants[0].sku=te,te=>be("sku",te,`p:${_e.productId}`)],placeholder:"SKU",size:"small",disabled:g(_e.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",ive,"—"))])):k("",!0),Me("media")?(r(),h("td",rve,[n(hl,{modelValue:_e.product.gallery,"onUpdate:modelValue":te=>_e.product.gallery=te,"show-url-tab":"",disabled:g(_e.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),Me("categories")?(r(),h("td",dve,[n(Kp,{modelValue:_e.product.categories,"onUpdate:modelValue":te=>_e.product.categories=te,options:A(kt).data.categoryOptions,disabled:g(_e.product),onChange:te=>{D(_e.product,te),be("categories",_e.product.categories,`p:${_e.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):k("",!0),Me("description")?(r(),h("td",uve,[n(qo,{value:_e.product.post_content,placeholder:ve.$t("Description"),onClick:te=>oe(_e.product,"post_content")},null,8,["value","placeholder","onClick"])])):k("",!0),Me("short_description")?(r(),h("td",cve,[n(qo,{value:_e.product.post_excerpt,placeholder:ve.$t("Short description"),onClick:te=>oe(_e.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):k("",!0),Me("status")?(r(),h("td",Ave,[n(Ma,{modelValue:_e.product.post_status,"onUpdate:modelValue":te=>_e.product.post_status=te,size:"small",class:de({"is-field-error":x(_e.product,"post_status")}),disabled:g(_e.product),onChange:te=>be("status",_e.product.post_status,`p:${_e.productId}`)},{default:d(()=>[(r(!0),h(O,null,ae(A(t).status,te=>(r(),$(aa,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):k("",!0),Me("product_type")&&((ye=_e.product)!=null&&ye.detail)?(r(),h("td",pve,[n(Ma,{modelValue:_e.product.detail.fulfillment_type,"onUpdate:modelValue":te=>_e.product.detail.fulfillment_type=te,size:"small",class:de({"is-field-error":x(_e.product,"detail.fulfillment_type")}),disabled:g(_e.product),onChange:te=>be("product_type",_e.product.detail.fulfillment_type,`p:${_e.productId}`)},{default:d(()=>[(r(!0),h(O,null,ae(A(t).fulfilment,te=>(r(),$(aa,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("product_type")?(r(),h("td",fve)):k("",!0),Me("pricing_type")&&((Re=_e.product)!=null&&Re.detail)?(r(),h("td",mve,[n(Ma,{modelValue:_e.product.detail.variation_type,"onUpdate:modelValue":te=>_e.product.detail.variation_type=te,size:"small",class:de({"is-field-error":x(_e.product,"detail.variation_type")}),disabled:g(_e.product),onChange:te=>{A(kt).handleVariationChanged(_e.product,te),be("pricing_type",te,`p:${_e.productId}`)}},{default:d(()=>[(r(!0),h(O,null,ae(A(t).variation,te=>(r(),$(aa,{key:te.value,label:ve.$t(te.title),value:te.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Me("pricing_type")?(r(),h("td",hve)):k("",!0),Me("payment_type")?(r(),h("td",_ve,[n(Ko,{variant:l(_e.product)?(tt=_e.product.variants)==null?void 0:tt[0]:null,disabled:g(_e.product),"has-error":x(_e.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:te=>{var st;E(te),be("payment_type",(st=te.other_info)==null?void 0:st.payment_type,`p:${_e.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):k("",!0),Me("interval")?(r(),h("td",vve,[n(Go,{variant:l(_e.product)?(dt=_e.product.variants)==null?void 0:dt[0]:null,disabled:g(_e.product),"has-error":x(_e.product,"variants.0.other_info.repeat_interval"),onChange:te=>{var st,Rt,La;return be("interval",(La=(Rt=(st=_e.product.variants)==null?void 0:st[0])==null?void 0:Rt.other_info)==null?void 0:La.repeat_interval,`p:${_e.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("trial_days")?(r(),h("td",gve,[n(jo,{variant:l(_e.product)?(je=_e.product.variants)==null?void 0:je[0]:null,disabled:g(_e.product),"has-error":x(_e.product,"variants.0.other_info.trial_days"),onChange:te=>{var st,Rt,La;return be("trial_days",(La=(Rt=(st=_e.product.variants)==null?void 0:st[0])==null?void 0:Rt.other_info)==null?void 0:La.trial_days,`p:${_e.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("best_price")?(r(),h("td",yve,[n(No,{variant:l(_e.product)?(ne=_e.product.variants)==null?void 0:ne[0]:null,disabled:g(_e.product),"has-error":x(_e.product,"variants.0.item_price"),onChange:te=>{var st,Rt;return be("price",(Rt=(st=_e.product.variants)==null?void 0:st[0])==null?void 0:Rt.item_price,`p:${_e.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("compare_price")?(r(),h("td",bve,[n(zo,{variant:l(_e.product)?(Ae=_e.product.variants)==null?void 0:Ae[0]:null,disabled:g(_e.product),"has-error":x(_e.product,"variants.0.compare_price"),onChange:te=>{var st,Rt;return be("compare_price",(Rt=(st=_e.product.variants)==null?void 0:st[0])==null?void 0:Rt.compare_price,`p:${_e.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("track_quantity")?(r(),h("td",wve,[(we=_e.product)!=null&&we.detail?(r(),$(Fl,{key:0,modelValue:_e.product.detail.manage_stock,"onUpdate:modelValue":te=>_e.product.detail.manage_stock=te,"active-value":"1","inactive-value":"0",disabled:g(_e.product),onChange:te=>{A(kt).syncStockStatus(_e.product),be("manage_stock",_e.product.detail.manage_stock,`p:${_e.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):k("",!0)])):k("",!0),Me("stock")?(r(),h("td",Cve,[((Ye=(Be=_e.product)==null?void 0:Be.detail)==null?void 0:Ye.manage_stock)==="1"&&((wt=(bt=_e.product)==null?void 0:bt.detail)==null?void 0:wt.variation_type)==="simple"?(r(),$(pa,{key:0,modelValue:_e.product.detail.total_stock,"onUpdate:modelValue":[te=>_e.product.detail.total_stock=te,te=>{var st;(st=_e.product.variants)!=null&&st[0]&&(_e.product.variants[0].total_stock=te,_e.product.variants[0].available=te),A(kt).syncStockStatus(_e.product),be("stock",te,`p:${_e.productId}`)}],disabled:g(_e.product),size:"small",placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Bve,"—"))])):k("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":N.value}])},[o("div",kve,[_(_e.product)&&_e.product.view_url?(r(),h("a",{key:0,href:_e.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ve.$t("View Product")},[n(ee,{name:"External"})],8,xve)):k("",!0),n(Xe,{tag:"button",size:"x-small",onClick:Ne(te=>S(_e.product),["prevent"]),disabled:s.value||g(_e.product),title:ve.$t("Duplicate")},{default:d(()=>[n(ee,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Xe,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(te=>L(_e.product),["prevent"]),disabled:s.value||g(_e.product),title:ve.$t("Delete")},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,X_e),_e.hasVariants?(r(),h("tr",Sve,[o("td",{colspan:Pe.value.length+1,class:"!p-0 !border-b-0"},[n(_a,{accordion:"",visible:!_e.collapsed,duration:200},{default:d(()=>[o("table",$ve,[o("colgroup",null,[$e[13]||($e[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(O,null,ae(Pe.value,(te,st)=>(r(),h("col",{key:st,style:na({width:te.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(O,null,ae(_e.product.variants,(te,st)=>{var Rt,La;return r(),h("tr",{key:st,class:de(["bulk-variation-row",{"is-selected":A(fe)(`v:${_e.productId}:${st}`)}]),onClick:He=>Fe(`v:${_e.productId}:${st}`,He)},[o("td",Uve,[n(yt,{"model-value":A(fe)(`v:${_e.productId}:${st}`),tabindex:"-1",onChange:He=>A(q)(`v:${_e.productId}:${st}`,He,Ue.value)},null,8,["model-value","onChange"])]),o("td",Ive,[o("div",Qve,[$e[14]||($e[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(pa,{size:"small",modelValue:te.variation_title,"onUpdate:modelValue":[He=>te.variation_title=He,He=>be("title",He,`v:${_e.productId}:${st}`)],placeholder:ve.$t("Variation title"),disabled:g(_e.product),class:de({"is-error":F(_e.product,st,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),b(_e.product,st)?(r(),$(ft,{key:0,content:w(_e.product,st),placement:"top"},{default:d(()=>[o("span",Dve,[n(Kt,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Me("sku")?(r(),h("td",Vve,[n(pa,{size:"small",modelValue:te.sku,"onUpdate:modelValue":[He=>te.sku=He,He=>be("sku",He,`v:${_e.productId}:${st}`)],placeholder:"SKU",disabled:g(_e.product),class:de({"is-error":F(_e.product,st,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):k("",!0),Me("media")?(r(),h("td",Tve,[n(hl,{modelValue:te.media,"onUpdate:modelValue":He=>te.media=He,"show-url-tab":"",disabled:g(_e.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):k("",!0),Me("categories")?(r(),h("td",Mve,$e[15]||($e[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("description")?(r(),h("td",Lve,$e[16]||($e[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("short_description")?(r(),h("td",Rve,$e[17]||($e[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("status")?(r(),h("td",Ove,$e[18]||($e[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("product_type")?(r(),h("td",Hve,$e[19]||($e[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("pricing_type")?(r(),h("td",Pve,$e[20]||($e[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("payment_type")?(r(),h("td",Nve,[n(Ko,{variant:te,disabled:g(_e.product),"has-error":F(_e.product,st,"other_info.payment_type"),onPaymentTypeChange:He=>{var Ie;E(He),be("payment_type",(Ie=He.other_info)==null?void 0:Ie.payment_type,`v:${_e.productId}:${st}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):k("",!0),Me("interval")?(r(),h("td",Kve,[n(Go,{variant:te,disabled:g(_e.product),"has-error":F(_e.product,st,"other_info.repeat_interval"),onChange:He=>{var Ie;return be("interval",(Ie=te.other_info)==null?void 0:Ie.repeat_interval,`v:${_e.productId}:${st}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("trial_days")?(r(),h("td",Gve,[n(jo,{variant:te,disabled:g(_e.product),"has-error":F(_e.product,st,"other_info.trial_days"),onChange:He=>{var Ie;return be("trial_days",(Ie=te.other_info)==null?void 0:Ie.trial_days,`v:${_e.productId}:${st}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("best_price")?(r(),h("td",jve,[n(No,{variant:te,disabled:g(_e.product),"has-error":F(_e.product,st,"item_price"),onChange:He=>be("price",te.item_price,`v:${_e.productId}:${st}`)},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("compare_price")?(r(),h("td",zve,[n(zo,{variant:te,disabled:g(_e.product),"has-error":F(_e.product,st,"compare_price"),onChange:He=>be("compare_price",te.compare_price,`v:${_e.productId}:${st}`)},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Me("track_quantity")?(r(),h("td",qve,$e[21]||($e[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Me("stock")?(r(),h("td",Yve,[((La=(Rt=_e.product)==null?void 0:Rt.detail)==null?void 0:La.manage_stock)==="1"?(r(),$(pa,{key:0,class:"fc-bulk-input",size:"small",modelValue:te.total_stock,"onUpdate:modelValue":[He=>te.total_stock=He,He=>{te.available=He,A(kt).syncStockStatus(_e.product),be("stock",He,`v:${_e.productId}:${st}`)}],disabled:g(_e.product),placeholder:ve.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Wve,"—"))])):k("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":N.value}])},[o("div",Xve,[n(Xe,{tag:"button",size:"x-small",onClick:Ne(He=>M(_e.product,te),["prevent"]),disabled:s.value||g(_e.product),title:ve.$t("Duplicate")},{default:d(()=>[n(ee,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Xe,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(He=>U(_e.product,te),["prevent"]),disabled:s.value||g(_e.product),title:ve.$t("Delete")},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Eve)}),128)),o("tr",Jve,[o("td",{colspan:Pe.value.length+1},[o("div",ege,[n(ot,{size:"small",text:"",type:"primary",onClick:Ne(te=>A(kt).addVariationToProduct(_e.product),["prevent"])},{default:d(()=>[R(" + "+f(ve.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,Zve)])])])]),_:2},1032,["visible"])],8,Fve)])):k("",!0)],64)}),128)),Et.value>0?(r(),h("tr",tge,[o("td",{colspan:Pe.value.length+1,style:na({height:Et.value+"px",padding:0,border:"none"})},null,12,age)])):k("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),$(_t,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),n(ul,{modelValue:J.value.visible,"onUpdate:modelValue":$e[6]||($e[6]=da=>J.value.visible=da),title:pe.value,width:"700px","close-on-click-modal":!1,onClosed:$e[7]||($e[7]=da=>J.value.product=null)},{footer:d(()=>[n(ot,{onClick:$e[5]||($e[5]=da=>J.value.visible=!1)},{default:d(()=>[R(f(ve.$t("Cancel")),1)]),_:1}),n(ot,{type:"primary",onClick:W},{default:d(()=>[R(f(ve.$t("Save")),1)]),_:1})]),default:d(()=>[J.value.visible&&J.value.field==="post_content"?(r(),$(Wl,{key:0,"model-value":J.value.value,height:300,onUpdate:Z},null,8,["model-value"])):k("",!0),J.value.visible&&J.value.field==="post_excerpt"?(r(),$(pa,{key:1,modelValue:J.value.value,"onUpdate:modelValue":$e[4]||($e[4]=da=>J.value.value=da),type:"textarea",rows:6,placeholder:ve.$t("Short description")},null,8,["modelValue","placeholder"])):k("",!0)]),_:1},8,["modelValue","title"])])}}};class oge extends Cd{beforeInit(){this.data.products=[],this.data.dirty=new Set,this.data.loading=!1,this.data.saving=!1,this.data.pagination={page:1,per_page:5,total:0,hasMore:!1},this.data.saveProgress={total:0,completed:0,errors:[],updatedIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.advanceFilters=[[]],this.data.filterType="simple",this.data.selectedView="all",this.data.searching=!1,this.data.search="",this.data.duplicatingIds=new Set,this.data.deletingIds=new Set,this.data.categoryOptions=[],this.data.constrainedProductIds="",this.data.constrainedVariantIds="",this.data.savedViews=[],this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital")}}getTabsCount(){return Object.values(this.getTabs()).length}getSelectedTab(){return this.data.selectedView}handleTabChanged(t){t!==this.data.selectedView&&(this.data.selectedView=t,this.fetchProducts({},!1))}isSearching(){return this.data.searching!==!1}openSearch(){this.data.searching=!0}closeSearch(){this.data.searching=!1,this.data.search="",this.fetchProducts({},!1)}search(){this.fetchProducts({},!1)}useFullWidthSearch(){return!1}getSearchHint(){return u("Search by Id, product title or variation title")}getSearchGuideOptions(){return null}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}onFilterTypeChanged(t){t==="advanced"?(this.data.searching=!1,this.data.search=""):this.data.advanceFilters=[[]],this.fetchProducts({},!1)}applyAdvancedFilter(t=!1){this.fetchProducts({},!1)}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(t){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(t,1)}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.fetchProducts({},!1)}getColumnWidthStorageKey(){return"bulk_edit_column_widths"}getColumnStorageKey(){return"bulk_edit_columns"}getToggleableColumns(){return[{label:"Image",value:"image"},{label:"SKU",value:"sku"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}getSortableColumns(){return[]}markDirty(t){this._suppressDirty||(this.data.dirty.add(t),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.has(t)&&(this.data.savedIds.delete(t),this.data.savedIds=new Set(this.data.savedIds)),this.data.productErrors.has(t)&&(this.data.productErrors.delete(t),this.data.productErrors=new Map(this.data.productErrors)))}get dirtyCount(){return this.data.dirty.size}getDirtyProducts(){return this.data.products.filter(t=>this.data.dirty.has(t.ID))}chunkArray(t,a){const l=[];for(let s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async fetchProducts(t={},a=!1,l="",s=""){var i;this.data.loading=!0;try{l&&(this.data.constrainedProductIds=l,this.data.constrainedVariantIds=s);const c=l||this.data.constrainedProductIds,p=s||this.data.constrainedVariantIds,m={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};c&&(m.product_ids=c,m.variant_ids=p),this.data.filterType==="advanced"?(m.advanced_filters=JSON.stringify(this.data.advanceFilters),m.filter_type="advanced"):(this.data.search&&(m.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(m.active_view=this.data.selectedView)),Object.assign(m,t);const _=await ce.get("products/bulk-edit-data",m),g=_.products||[];this._suppressDirty=!0,a?this.data.products.push(...g):(this.data.products=g,this.data.dirty=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map),Se(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||m.page,per_page:_.per_page||m.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(c){const p=((i=c==null?void 0:c.data)==null?void 0:i.message)||"Failed to fetch products";z.error(p)}finally{this.data.loading=!1}}isSavingProduct(t){return this.data.savingIds.has(t)}isDirty(t){return this.data.dirty.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSavingProduct(t)}isDuplicating(t){return this.data.duplicatingIds.has(t)}isDeleting(t){return this.data.deletingIds.has(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}async saveProduct(t){var l,s,i,c;const a=t.ID;if(!this.data.savingIds.has(a)){this.data.savingIds.add(a),this.data.savingIds=new Set(this.data.savingIds);try{const p=await ce.post("products/bulk-update",{products:[t]});if((l=p.updated)!=null&&l.length)this.data.dirty.delete(a),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.add(a),this.data.savedIds=new Set(this.data.savedIds),this.data.productErrors.delete(a),this.data.productErrors=new Map(this.data.productErrors),z.success("Product updated successfully");else if((s=p.errors)!=null&&s.length){const m=p.errors[0];m!=null&&m.fields&&(this.data.productErrors.set(a,m),this.data.productErrors=new Map(this.data.productErrors)),z.error((m==null?void 0:m.message)||"Failed to save product")}}catch(p){const m=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(c=p==null?void 0:p.data)==null?void 0:c.errors;if(_!=null&&_.length){const g=_[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}z.error(m)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var l,s;const t=this.getDirtyProducts().filter(i=>!this.data.savedIds.has(i.ID));if(t.length===0){z.info("No changes to save");return}const a=this.chunkArray(t,10);this.data.saving=!0,this.data.saveProgress={total:a.length,completed:0,errors:[],updatedIds:[]};try{for(const p of a){const m=p.map(_=>_.ID);for(const _ of m)this.data.savingIds.add(_);this.data.savingIds=new Set(this.data.savingIds);try{const _=await ce.post("products/bulk-update",{products:p});if(_.updated){this.data.saveProgress.updatedIds.push(..._.updated);for(const g of _.updated)this.data.savedIds.add(g),this.data.dirty.delete(g),this.data.productErrors.delete(g);this.data.savedIds=new Set(this.data.savedIds),this.data.dirty=new Set(this.data.dirty),this.data.productErrors=new Map(this.data.productErrors)}if(_.errors&&_.errors.length){this.data.saveProgress.errors.push(..._.errors);for(const g of _.errors)g.post_id&&g.fields&&this.data.productErrors.set(g.post_id,g);this.data.productErrors=new Map(this.data.productErrors)}}catch(_){const g=((l=_==null?void 0:_.data)==null?void 0:l.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:g});const y=(s=_==null?void 0:_.data)==null?void 0:s.errors;if(y!=null&&y.length){for(const v of y)v.post_id&&v.fields&&this.data.productErrors.set(v.post_id,v);this.data.productErrors=new Map(this.data.productErrors)}}for(const _ of m)this.data.savingIds.delete(_);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:i,errors:c}=this.data.saveProgress;c.length===0?z.success(`${i.length} product(s) updated successfully`):i.length>0?z.info(`${i.length} product(s) updated, ${c.length} error(s)`):z.error("All products failed to save")}finally{this.data.saving=!1}}async duplicateProduct(t){var l;const a=t.ID;if(!(!a||this.data.duplicatingIds.has(a))){this.data.duplicatingIds.add(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const i=(await ce.post(`products/${a}/duplicate`,{})).product_id;if(i){const p=(await ce.get("products/bulk-edit-data",{search:i,per_page:1})).products||[];if(p.length>0){const m=this.data.products.indexOf(t);this.data.products.splice(m+1,0,p[0])}}}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to duplicate product";z.error(i)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var s;const l=t.ID;if(!(!l||this.data.duplicatingIds.has(l))){this.data.duplicatingIds.add(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const c=(await ce.post(`products/${l}/duplicate`,{})).product_id;if(!c)return;const m=(await ce.get("products/bulk-edit-data",{search:c,per_page:1})).products||[];if(!m.length)return;const _=m[0],g=t.variants||[],y=new Set;for(const C of g)a.includes(C.id)&&C.serial_index!=null&&y.add(C.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(C=>y.has(C.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,_),this.markDirty(_.ID)}catch(i){const c=((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to duplicate product";z.error(c)}finally{this.data.duplicatingIds.delete(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="",delete l.id,delete l.post_id;const s=t.variants.indexOf(a);t.variants.splice(s+1,0,l),this.markDirty(t.ID)}async deleteProduct(t){var l;const a=t.ID;if(!(!a||this.data.deletingIds.has(a))){this.data.deletingIds.add(a),this.data.deletingIds=new Set(this.data.deletingIds);try{await ce.delete(`products/${a}`);const s=this.data.products.indexOf(t);s!==-1&&this.data.products.splice(s,1),this.data.dirty.delete(a),this.data.savedIds.delete(a)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product";z.error(i)}finally{this.data.deletingIds.delete(a),this.data.deletingIds=new Set(this.data.deletingIds)}}}removeVariant(t,a){if(t.variants.length<=1)return z.error(u("A product must have at least one variant.")),!1;const l=t.variants.indexOf(a);return l!==-1&&t.variants.splice(l,1),this.markDirty(t.ID),!0}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}flattenCategoryTree(t,a=""){var s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await ce.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}setupSavedViews(){var a,l;const t=(a=window.fluentCartAdminApp)==null?void 0:a.table_config;this.data.savedViews=((l=t==null?void 0:t.products)==null?void 0:l.saved_views)||[]}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}applySavedView(t){const a=this.data.savedViews.find(l=>l.slug===t);a&&(this.data.activeSavedViewId=t,this.data.savedViewQueryParams=a.query_params)}isViewOwner(t){var a,l;return!t||!t.owner_id?!1:t.owner_id===((l=(a=window.fluentCartAdminApp)==null?void 0:a.me)==null?void 0:l.id)}renameSavedView(t,a){}updateSavedView(t){}deleteSavedView(t){}}const nt=oge.init(),ige={class:"fct-bulk-edit-page fct-layout-width"},rge={class:"fct-table-wrapper"},dge={class:"fct-card-header-top"},uge={class:"fct-card-header-left flex-1"},cge={class:"fct-card-header-actions"},Age={key:0,class:"fct-advanced-filter-toggle-wrapper"},pge={key:1,class:"fct-btn-group sm hidden md:flex"},fge={key:0,class:"filter-search-wrap"},mge={class:"search-bar"},hge={class:"text-xs text-system-light pt-2 dark:text-gray-300"},_ge={class:"fct-bulk-edit-table-wrap"},vge={key:0,class:"px-5 py-3 flex items-center justify-between border border-solid border-x-0 border-gray-divider border-t-0 dark:border-dark-400"},gge={class:"m-0 text-base"},yge={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},bge={class:"fct-btn-group sm justify-end"},wge={class:"filter-popover-item"},Cge={class:"filter-popover-title"},Bge={class:"fct-bulk-edit-table"},kge={key:0,"aria-hidden":"true"},xge=["colspan"],Sge=["onClick"],Fge=["onClick"],$ge={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},Ege={class:"flex items-center"},Uge=["onClick","title"],Ige={key:0,class:"bulk-collapse-count"},Qge=["title"],Dge={class:"bulk-status-icon is-error"},Vge=["disabled","onClick","title"],Tge={key:0,class:"fct-bulk-media-cell"},Mge={key:1,class:"fct-bulk-sku-cell"},Lge={key:1,class:"text-gray-300 text-sm flex justify-center"},Rge={key:2,class:"fct-bulk-categories-cell"},Oge={key:3,class:"fct-bulk-desc-cell"},Hge={key:4,class:"fct-bulk-short-desc-cell"},Pge={key:5,class:"fct-bulk-status-cell"},Nge={key:6,class:"fct-bulk-product-type-cell"},Kge={class:"bulk-readonly-label"},Gge={key:7,class:"fct-bulk-pricing-type-cell"},jge={class:"bulk-readonly-label"},zge={key:8,class:"fct-bulk-payment-type-cell"},qge={key:9,class:"fct-bulk-interval-cell"},Yge={key:10,class:"fct-bulk-trial-days-cell"},Wge={key:11,class:"fct-bulk-best-price-cell"},Xge={key:12,class:"fct-bulk-compare-price-cell"},Jge={key:13,class:"fct-bulk-qty-cell !pl-5"},Zge={key:14,class:"fct-bulk-stock-cell"},e1e={key:1,class:"text-gray-300 text-sm flex justify-center"},t1e={class:"fct-btn-group sm justify-end"},a1e={key:0,class:"bulk-variants-block-row"},l1e=["colspan"],s1e={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},n1e=["onClick"],o1e={class:"bulk-checkbox-cell"},i1e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},r1e={class:"flex items-center gap-1 pl-4"},d1e={class:"bulk-status-icon is-error"},u1e={key:0},c1e={key:1},A1e={key:2},p1e={key:3},f1e={key:4},m1e={key:5},h1e={key:6},_1e={key:7},v1e={key:8},g1e={key:9},y1e={key:10},b1e={key:11},w1e={key:12},C1e={key:13,class:"text-center"},B1e={key:14},k1e={key:1,class:"text-gray-300 text-sm flex justify-center"},x1e={class:"fct-btn-group sm justify-end"},S1e={key:1,"aria-hidden":"true"},F1e=["colspan"],$1e={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},E1e={class:"text-system-mid text-sm"},U1e={key:2,class:"flex items-center justify-center py-8"},I1e={class:"text-system-mid text-sm"},Q1e={key:1,class:"flex items-center justify-center py-3 border-top"},D1e={class:"text-system-mid text-sm"},Zi=43,V1e=10,pc=800,fc=100,T1e=200,M1e={__name:"BulkEdit",setup(e){const t=zt().ctx,a=al(),{options:l}=nt.data,s=Y=>{var se;return((se=Y==null?void 0:Y.detail)==null?void 0:se.variation_type)==="simple"},i=K(()=>nt.data.products),c=K(()=>nt.data.loading),p=K(()=>nt.data.saving),m=K(()=>nt.data.saveProgress),_=K(()=>nt.data.pagination),g=K(()=>nt.data.dirty),y=K(()=>g.value.size),v=K(()=>Math.max(0,_.value.total-i.value.length)),C=K(()=>Math.min(_.value.per_page,v.value)),b=K(()=>{const Y=nt.data.saveProgress;return Y.total?Math.round(Y.completed/Y.total*100):0}),w=Kr("search-input"),x=()=>{nt.openSearch(),Se(()=>{var Y;(Y=w.value)==null||Y.focus()})},F=(Y=!1)=>{nt.fetchProducts({},Y)},L=()=>{nt.saveProducts()},U=Y=>{nt.markDirty(Y.ID)},S=(Y,se)=>{nt.resetPaymentTypeDefaults(se),U(Y)},M=(Y,se)=>{const ye=nt.data.categoryOptions;for(const Re of se)ye.find(tt=>tt.value===Re)||ye.push({label:Re,value:Re});U(Y)},I=Y=>nt.isDirty(Y.ID),T=Y=>nt.isSavingProduct(Y.ID),Q=Y=>nt.isSaved(Y.ID),E=Y=>nt.isRowDisabled(Y.ID),D=Y=>nt.isDuplicating(Y.ID),H=Y=>nt.isDeleting(Y.ID),P=Y=>nt.hasError(Y.ID),G=Y=>nt.getError(Y.ID),J=Y=>nt.hasProductLevelError(Y.ID),oe=(Y,se)=>nt.hasVariantError(Y.ID,se),Z=(Y,se)=>nt.getVariantError(Y.ID,se),W=(Y,se)=>nt.hasFieldError(Y.ID,se),pe=(Y,se,ye)=>nt.hasVariantFieldError(Y.ID,se,ye),N=Y=>nt.saveProduct(Y),j=Y=>nt.duplicateProduct(Y),q=(Y,se)=>nt.duplicateVariant(Y,se),X=V(!0),{selectedKeys:ie,handleRowClick:ge,toggleSelectAll:fe,selectAll:he,deselectAll:le,isSelected:me,selectedCount:Ue,isLinkMode:et,toggleLinkMode:be}=Gp(),qe=K(()=>{const Y=[];for(const se of yt.value)if(Y.push(`p:${se.productId}`),se.hasVariants&&!se.collapsed)for(const ye of se.product.variants)Y.push(`v:${ye.id}`);return Y}),gt=Y=>{var se;if(Y.startsWith("p:")){const ye=parseInt(Y.slice(2)),Re=yt.value.find(tt=>tt.productId===ye);return Re?{type:"product",data:Re.product,product:Re.product}:null}else if(Y.startsWith("v:")){const ye=parseInt(Y.slice(2));for(const Re of yt.value){const tt=(se=Re.product.variants)==null?void 0:se.find(dt=>dt.id===ye);if(tt)return{type:"variant",data:tt,product:Re.product}}}return null},Ze=(Y,se,ye)=>{!et.value||!me(ye)||zp(Y,se,ye,ie.value,gt,U,K_e)},Fe=V(!1),Ee=Y=>{Y.key==="Shift"&&(Fe.value=!0)},Pe=Y=>{Y.key==="Shift"&&(Fe.value=!1)},Me=(Y,se)=>{if(!se.shiftKey||se.target.closest(".bulk-checkbox-cell"))return;se.preventDefault();const ye=new Set(ie.value);ye.has(Y)?ye.delete(Y):ye.add(Y),ie.value=ye},ht=()=>{const Y=[];for(const se of yt.value){const ye=`p:${se.productId}`,Re=ie.value.has(ye),tt=[];if(se.product.variants)for(const dt of se.product.variants)ie.value.has(`v:${dt.id}`)&&tt.push(dt.id);!Re&&tt.length===0||(Re&&tt.length===0?Y.push({product:se.product,type:"full"}):!Re&&tt.length>0?Y.push({product:se.product,type:"variants-only",variantIds:tt}):Y.push({product:se.product,type:"partial",variantIds:tt}))}return Y},At=async()=>{const Y=ht();if(!Y.length)return;const se=Y.filter(je=>je.type==="full").length,ye=Y.filter(je=>je.type==="partial").length,tt=Y.filter(je=>je.type==="variants-only").reduce((je,ne)=>je+ne.variantIds.length,0),dt=[];se>0&&dt.push(`${se} product(s) with all variants`),ye>0&&dt.push(`${ye} product(s) with selected variants`),tt>0&&dt.push(`${tt} variant(s)`);try{await Ja.confirm(t.$t("Duplicate %s?").replace("%s",dt.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const je of Y)if(je.type==="full")await nt.duplicateProduct(je.product);else if(je.type==="variants-only")for(const ne of je.variantIds){const Ae=je.product.variants.find(we=>we.id===ne);Ae&&nt.duplicateVariant(je.product,Ae)}else je.type==="partial"&&await nt.duplicateProductWithVariants(je.product,je.variantIds);le()},Mt=async()=>{const Y=[],se=[];for(const tt of yt.value){const dt=`p:${tt.productId}`;if(ie.value.has(dt)){Y.push(tt.product);continue}const ne=[];if(tt.product.variants)for(const Ae of tt.product.variants)ie.value.has(`v:${Ae.id}`)&&ne.push(Ae);ne.length>0&&se.push({product:tt.product,variants:ne})}if(!Y.length&&!se.length)return;const ye=se.reduce((tt,dt)=>tt+dt.variants.length,0),Re=[];Y.length>0&&Re.push(`${Y.length} product(s)`),ye>0&&Re.push(`${ye} variant(s)`);try{await Ja.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",Re.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const tt of Y)await nt.deleteProduct(tt);for(const{product:tt,variants:dt}of se)for(const je of dt)nt.removeVariant(tt,je);le()},Ft=async Y=>{const se=Y.ID;if(!se||nt.isDeleting(se))return;const ye=Y.post_title||t.$t("Untitled product"),Re=Array.isArray(Y.variants)?Y.variants.length:0,tt=Re>0?t.$t('This will permanently delete "%s" and its %s variant(s).').replace("%s",ye).replace("%s",Re):t.$t('This will permanently delete "%s".').replace("%s",ye);try{await Ja.confirm(tt,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}nt.deleteProduct(Y)},$t=(Y,se)=>{if(Y.variants.length<=1){nt.removeVariant(Y,se);return}const ye=se.variation_title||t.$t("Untitled variant");Ja.confirm(t.$t('This will remove the variant "%s".').replace("%s",ye),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{nt.removeVariant(Y,se)}).catch(()=>{})},ct=V({visible:!1,field:"",product:null,value:""}),Ut=(Y,se)=>{ct.value={visible:!0,field:se,product:Y,value:Y[se]||""}},St=Y=>{ct.value.value=Y},Dt=()=>{const{product:Y,field:se,value:ye}=ct.value;Y&&(Y[se]=ye,U(Y)),ct.value.visible=!1},Et=K(()=>ct.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),It=V([]),Ht=K(()=>It.value.filter(Y=>Y.key==="title"||Y.key==="actions"?!0:nt.isColumnVisible(Y.key))),Bt=Y=>nt.isColumnVisible(Y),ra=()=>{nt.saveColumnWidths(It.value)},ve=V(new Set),$e=Y=>{const se=Y.ID;ve.value.has(se)?ve.value.delete(se):ve.value.add(se),ve.value=new Set(ve.value)},ot=Y=>ve.value.has(Y.ID),vt=V(0),yt=K(()=>{let Y=0;return i.value.map(se=>{var we;const ye=se.ID,Re=((we=se.detail)==null?void 0:we.variation_type)!=="simple"&&Array.isArray(se.variants)&&se.variants.length>0,tt=Re?se.variants.length:0,dt=ve.value.has(ye),je=Re&&!dt?tt*Zi:0,ne=Zi+je,Ae={product:se,productId:ye,hasVariants:Re,variantCount:tt,collapsed:dt,groupHeight:ne,offset:Y};return Y+=ne,Ae})}),Nt=K(()=>{const Y=yt.value;if(Y.length===0)return 0;const se=Y[Y.length-1];return se.offset+se.groupHeight}),ft=K(()=>{const Y=yt.value,se=vt.value,ye=se+pc,Re=V1e*Zi;return Y.filter(tt=>tt.offset+tt.groupHeight>=se-Re&&tt.offset<=ye+Re)}),Zt=K(()=>ft.value.length===0?0:ft.value[0].offset),pa=K(()=>{if(ft.value.length===0)return 0;const Y=ft.value[ft.value.length-1];return Nt.value-Y.offset-Y.groupHeight});let Kt=null,aa=0;const Ma=()=>{if(c.value||!_.value.hasMore||i.value.length===0)return;Nt.value-(vt.value+pc)<T1e&&F(!0)},Fl=Y=>{const se=Y.target,ye=Date.now();Kt&&clearTimeout(Kt),ye-aa>=fc?(vt.value=se.scrollTop,aa=ye,Ma()):Kt=setTimeout(()=>{vt.value=se.scrollTop,aa=Date.now(),Kt=null,Ma()},fc)},ul=Y=>({physical:"Physical",digital:"Digital"})[Y]||Y||"—",da=Y=>({simple:"Simple",simple_variations:"Variable"})[Y]||Y||"—";let _e=null;const qa=()=>{const Y=a.query.product_ids,se=a.query.variant_ids;Y&&se?nt.fetchProducts({},!1,Y,se):F(!1)};return Qe(async()=>{_e=ps(),_e.bind("mod+a",Y=>{var ye,Re;const se=(ye=document.activeElement)==null?void 0:ye.tagName;se==="INPUT"||se==="TEXTAREA"||(Re=document.activeElement)!=null&&Re.isContentEditable||(Y.preventDefault(),he(qe.value))}),_e.bind("escape",()=>{var se,ye;const Y=(se=document.activeElement)==null?void 0:se.tagName;Y==="INPUT"||Y==="TEXTAREA"||(ye=document.activeElement)!=null&&ye.isContentEditable||(et.value?be():le())}),It.value=[{key:"title",title:t.$t("Title"),width:150,minWidth:100},{key:"image",title:t.$t("Image"),width:60,minWidth:50},{key:"sku",title:t.$t("SKU"),width:120,minWidth:80},{key:"categories",title:t.$t("Categories"),width:200,minWidth:150},{key:"description",title:t.$t("Description"),width:200,minWidth:150},{key:"short_description",title:t.$t("Short Description"),width:150,minWidth:100},{key:"status",title:t.$t("Status"),width:100,minWidth:50},{key:"product_type",title:t.$t("Product Type"),width:120,minWidth:80},{key:"pricing_type",title:t.$t("Pricing Type"),width:120,minWidth:80},{key:"payment_type",title:t.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:t.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:t.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:t.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:t.$t("Compare-at Price"),width:150,minWidth:100},{key:"track_quantity",title:t.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:t.$t("Stock"),width:120,minWidth:80},{key:"actions",title:"",width:110,minWidth:110}],nt.restoreColumnWidths(It.value),nt.setupColumnVisibility(),nt.setupSavedViews(),nt.fetchCategories(),qa(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Ee),window.addEventListener("keyup",Pe)}),vl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Ee),window.removeEventListener("keyup",Pe),_e&&_e.reset()}),(Y,se)=>{const ye=B("el-button"),Re=B("el-progress"),tt=B("el-switch"),dt=B("el-tooltip"),je=B("el-input"),ne=B("el-checkbox"),Ae=B("el-checkbox-group"),we=B("el-popover"),Be=B("el-icon"),Ye=B("el-option"),bt=B("el-select"),wt=B("el-dialog");return r(),h("div",ige,[n(ll,{title:Y.$t("Bulk Edit")},{action:d(()=>[n(ye,{type:"primary",onClick:L,loading:p.value,disabled:p.value||y.value===0},{default:d(()=>[R(f(p.value?Y.$t("Saving %s/%s...").replace("%s",m.value.completed).replace("%s",m.value.total):y.value>0?Y.$t("Save Changes")+` (${y.value})`:Y.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),p.value?(r(),$(Re,{key:0,percentage:b.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):k("",!0),o("div",rge,[n(xe,null,{default:d(()=>[n(Ve,{border_bottom:""},{default:d(()=>[o("div",dge,[o("div",uge,[A(nt).getTabsCount()&&!A(nt).isUsingAdvanceFilter()?(r(),$(Cf,{key:0,class:de("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:A(nt)},null,8,["table"])):k("",!0)]),o("div",cge,[A(nt).isAdvanceFilterEnabled()?(r(),h("div",Age,[n(tt,{class:"fct-advanced-filter-toggle",onChange:se[0]||(se[0]=te=>{A(nt).onFilterTypeChanged(te)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(nt).data.filterType,"onUpdate:modelValue":se[1]||(se[1]=te=>A(nt).data.filterType=te),"active-text":Y.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):k("",!0),A(nt).isUsingAdvanceFilter()?k("",!0):(r(),h("div",pge,[A(nt).isSearching()?k("",!0):(r(),$(dt,{key:0,effect:"light",content:Y.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button",onClick:Ne(x,["prevent"])},{default:d(()=>[n(ee,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(Bf,{table:A(nt)},null,8,["table"]),A(nt).isSearching()&&!A(nt).isUsingAdvanceFilter()?(r(),h("div",fge,[o("div",mge,[n(je,{ref:"search-input",onClear:se[2]||(se[2]=()=>{A(nt).search()}),onKeyup:se[3]||(se[3]=$a(()=>{A(nt).search()},["enter"])),modelValue:A(nt).data.search,"onUpdate:modelValue":se[4]||(se[4]=te=>A(nt).data.search=te),type:"text",placeholder:Y.$t("Search"),clearable:""},{prefix:d(()=>[n(ee,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",hge,f(A(nt).getSearchHint()),1)]),n(ye,{text:"",onClick:se[5]||(se[5]=()=>{A(nt).closeSearch()})},{default:d(()=>[R(f(Y.$t("Cancel")),1)]),_:1})])):k("",!0)]),_:1}),n(ke,{class:"p-0"},{default:d(()=>[o("div",_ge,[i.value.length>0?(r(),h("div",vge,[o("h5",gge,[R(f(i.value.length)+" "+f(i.value.length===1?Y.$t("Product"):Y.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",yge,f(Y.$t("of"))+" "+f(_.value.total)+" "+f(Y.$t("total"))+" · "+f(C.value)+" "+f(Y.$t("next")),1)):k("",!0)]),o("div",bge,[n(ye,{disabled:A(Ue)===0,onClick:At,size:"small"},{default:d(()=>[se[14]||(se[14]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+f(Y.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(ye,{disabled:A(Ue)===0,onClick:Mt,size:"small",type:"danger",plain:""},{default:d(()=>[se[15]||(se[15]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+f(Y.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(ye,{class:de({"is-active":A(et)}),disabled:A(Ue)<2&&!A(et),onClick:A(be),size:"small"},{default:d(()=>[se[16]||(se[16]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+f(A(et)?Y.$t("Unlink"):Y.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(ne,{modelValue:X.value,"onUpdate:modelValue":se[6]||(se[6]=te=>X.value=te),label:Y.$t("Pin Actions")},null,8,["modelValue","label"]),n(we,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(dt,{effect:"light",content:Y.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(Xe,{tag:"button",size:"small"},{default:d(()=>[n(ee,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",wge,[o("h3",Cge,f(Y.$t("Columns")),1),n(Ae,{modelValue:A(nt).data.visibleColumns,"onUpdate:modelValue":se[7]||(se[7]=te=>A(nt).data.visibleColumns=te),class:"fct-checkbox-blocks",onChange:se[8]||(se[8]=te=>A(nt).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(O,null,ae(A(nt).getToggleableColumns(),te=>(r(),$(ne,{key:te.value,value:te.value,label:Y.$t(te.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):k("",!0),o("div",Bge,[i.value.length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(et),"is-shift-held":Fe.value}])},[n(Np,{columns:Ht.value,"sticky-last":X.value,onScroll:Fl,onResizeEnd:ra},{"header-first":d(()=>[jt(n(ne,{checked:A(Ue)>0&&A(Ue)===qe.value.length,onChange:se[9]||(se[9]=te=>A(fe)(qe.value))},null,8,["checked"]),[[A(P_e),A(Ue)>0&&A(Ue)<qe.value.length]])]),"header-last":d(()=>[R(f(Y.$t("Actions")),1)]),default:d(()=>[Zt.value>0?(r(),h("tr",kge,[o("td",{colspan:Ht.value.length+1,style:na({height:Zt.value+"px",padding:0,border:"none"})},null,12,xge)])):k("",!0),(r(!0),h(O,null,ae(ft.value,te=>{var st,Rt,La,He,Ie,re,ue,De,Le,Ke,pt,mt,Vt,ea,Ia,Gt,fa,Ba;return r(),h(O,{key:te.productId},[o("tr",{class:de(["bulk-product-row",{"is-dirty":I(te.product),"is-saving":T(te.product),"is-saved":Q(te.product),"has-product-error":P(te.product),"is-selected":A(me)(`p:${te.productId}`)}]),onClick:We=>Me(`p:${te.productId}`,We)},[o("td",{class:"bulk-checkbox-cell",onClick:We=>A(ge)(`p:${te.productId}`,We,qe.value)},[n(ne,{"model-value":A(me)(`p:${te.productId}`),tabindex:"-1"},null,8,["model-value"])],8,Fge),o("td",$ge,[o("div",Ege,[te.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ne(We=>$e(te.product),["prevent"]),title:ot(te.product)?Y.$t("Expand variants"):Y.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":ot(te.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},se[17]||(se[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),ot(te.product)?(r(),h("span",Ige,f(te.variantCount),1)):k("",!0)],8,Uge)):k("",!0),n(je,{class:de(["fct-bulk-input",{"is-error":W(te.product,"post_title")}]),modelValue:te.product.post_title,"onUpdate:modelValue":[We=>te.product.post_title=We,We=>{U(te.product),Ze("title",We,`p:${te.productId}`)}],placeholder:Y.$t("Product title"),disabled:E(te.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),T(te.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:Y.$t("Saving...")},[n(Be,{class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})],8,Qge)):J(te.product)||s(te.product)&&P(te.product)?(r(),$(dt,{key:2,content:G(te.product),placement:"top"},{default:d(()=>[o("span",Dge,[n(Be,{size:16},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):I(te.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:E(te.product),onClick:Ne(We=>N(te.product),["prevent"]),title:Y.$t("Save")},se[18]||(se[18]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[o("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z",fill:"currentColor"})],-1)]),8,Vge)):k("",!0)])]),Bt("image")?(r(),h("td",Tge,[n(hl,{modelValue:te.product.gallery,"onUpdate:modelValue":We=>te.product.gallery=We,onChange:We=>U(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):k("",!0),Bt("sku")?(r(),h("td",Mge,[((Rt=(st=te.product)==null?void 0:st.detail)==null?void 0:Rt.variation_type)==="simple"&&((La=te.product.variants)!=null&&La[0])?(r(),$(je,{key:0,class:de(["fct-bulk-input",{"is-error":W(te.product,"variants.0.sku")}]),modelValue:te.product.variants[0].sku,"onUpdate:modelValue":[We=>te.product.variants[0].sku=We,We=>{U(te.product),Ze("sku",We,`p:${te.productId}`)}],placeholder:"SKU",size:"small",disabled:E(te.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",Lge,"—"))])):k("",!0),Bt("categories")?(r(),h("td",Rge,[n(Kp,{modelValue:te.product.categories,"onUpdate:modelValue":We=>te.product.categories=We,options:A(nt).data.categoryOptions,disabled:E(te.product),onChange:We=>{M(te.product,We),Ze("categories",te.product.categories,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):k("",!0),Bt("description")?(r(),h("td",Oge,[n(qo,{value:te.product.post_content,placeholder:Y.$t("Description"),onClick:We=>Ut(te.product,"post_content")},null,8,["value","placeholder","onClick"])])):k("",!0),Bt("short_description")?(r(),h("td",Hge,[n(qo,{value:te.product.post_excerpt,placeholder:Y.$t("Short description"),onClick:We=>Ut(te.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):k("",!0),Bt("status")?(r(),h("td",Pge,[n(bt,{modelValue:te.product.post_status,"onUpdate:modelValue":We=>te.product.post_status=We,size:"small",class:de({"is-field-error":W(te.product,"post_status")}),disabled:E(te.product),onChange:We=>{U(te.product),Ze("status",te.product.post_status,`p:${te.productId}`)}},{default:d(()=>[n(Ye,{label:Y.$t("Published"),value:"publish"},null,8,["label"]),n(Ye,{label:Y.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):k("",!0),Bt("product_type")?(r(),h("td",Nge,[o("span",Kge,f(ul((Ie=(He=te.product)==null?void 0:He.detail)==null?void 0:Ie.fulfillment_type)),1)])):k("",!0),Bt("pricing_type")?(r(),h("td",Gge,[o("span",jge,f(da((ue=(re=te.product)==null?void 0:re.detail)==null?void 0:ue.variation_type)),1)])):k("",!0),Bt("payment_type")?(r(),h("td",zge,[n(Ko,{variant:s(te.product)?(De=te.product.variants)==null?void 0:De[0]:null,disabled:E(te.product),"has-error":W(te.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:We=>{var Yt;S(te.product,We),Ze("payment_type",(Yt=We.other_info)==null?void 0:Yt.payment_type,`p:${te.productId}`)},onChange:We=>U(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):k("",!0),Bt("interval")?(r(),h("td",qge,[n(Go,{variant:s(te.product)?(Le=te.product.variants)==null?void 0:Le[0]:null,disabled:E(te.product),"has-error":W(te.product,"variants.0.other_info.repeat_interval"),onChange:We=>{var Yt,Na,Ge;U(te.product),Ze("interval",(Ge=(Na=(Yt=te.product.variants)==null?void 0:Yt[0])==null?void 0:Na.other_info)==null?void 0:Ge.repeat_interval,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("trial_days")?(r(),h("td",Yge,[n(jo,{variant:s(te.product)?(Ke=te.product.variants)==null?void 0:Ke[0]:null,disabled:E(te.product),"has-error":W(te.product,"variants.0.other_info.trial_days"),onChange:We=>{var Yt,Na,Ge;U(te.product),Ze("trial_days",(Ge=(Na=(Yt=te.product.variants)==null?void 0:Yt[0])==null?void 0:Na.other_info)==null?void 0:Ge.trial_days,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("best_price")?(r(),h("td",Wge,[n(No,{variant:s(te.product)?(pt=te.product.variants)==null?void 0:pt[0]:null,disabled:E(te.product),"has-error":W(te.product,"variants.0.item_price"),onChange:We=>{var Yt,Na;U(te.product),Ze("price",(Na=(Yt=te.product.variants)==null?void 0:Yt[0])==null?void 0:Na.item_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("compare_price")?(r(),h("td",Xge,[n(zo,{variant:s(te.product)?(mt=te.product.variants)==null?void 0:mt[0]:null,disabled:E(te.product),"has-error":W(te.product,"variants.0.compare_price"),onChange:We=>{var Yt,Na;U(te.product),Ze("compare_price",(Na=(Yt=te.product.variants)==null?void 0:Yt[0])==null?void 0:Na.compare_price,`p:${te.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("track_quantity")?(r(),h("td",Jge,[(Vt=te.product)!=null&&Vt.detail?(r(),$(tt,{key:0,modelValue:te.product.detail.manage_stock,"onUpdate:modelValue":We=>te.product.detail.manage_stock=We,"active-value":1,"inactive-value":0,disabled:E(te.product),onChange:We=>{U(te.product),A(nt).syncStockStatus(te.product),Ze("manage_stock",te.product.detail.manage_stock,`p:${te.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):k("",!0)])):k("",!0),Bt("stock")?(r(),h("td",Zge,[(Ia=(ea=te.product)==null?void 0:ea.detail)!=null&&Ia.manage_stock&&((fa=(Gt=te.product)==null?void 0:Gt.detail)==null?void 0:fa.variation_type)==="simple"&&((Ba=te.product.variants)!=null&&Ba[0])?(r(),$(je,{key:0,class:"fct-bulk-input",placeholder:Y.$t("e.g 10"),size:"small",modelValue:te.product.variants[0].available,"onUpdate:modelValue":[We=>te.product.variants[0].available=We,We=>{te.product.variants[0].total_stock=We,U(te.product),A(nt).syncStockStatus(te.product),Ze("stock",We,`p:${te.productId}`)}],disabled:E(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",e1e,"—"))])):k("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":X.value}])},[o("div",t1e,[te.product.view_url?(r(),$(Xe,{key:0,tag:"a",size:"x-small",href:te.product.view_url,target:"_blank",title:Y.$t("View Product")},{default:d(()=>[n(ee,{name:"External"})]),_:2},1032,["href","title"])):k("",!0),n(Xe,{tag:"button",size:"x-small",onClick:Ne(We=>j(te.product),["prevent"]),disabled:p.value||E(te.product)||D(te.product),title:Y.$t("Duplicate")},{default:d(()=>[D(te.product)?(r(),$(Be,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})):(r(),$(ee,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),n(Xe,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(We=>Ft(te.product),["prevent"]),disabled:p.value||E(te.product)||H(te.product),title:Y.$t("Delete")},{default:d(()=>[H(te.product)?(r(),$(Be,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(qs))]),_:1})):(r(),$(ee,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,Sge),te.hasVariants?(r(),h("tr",a1e,[o("td",{colspan:Ht.value.length+1,class:"!p-0 !border-b-0"},[n(_a,{accordion:"",visible:!te.collapsed,duration:200},{default:d(()=>[o("table",s1e,[o("colgroup",null,[se[19]||(se[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(O,null,ae(Ht.value,(We,Yt)=>(r(),h("col",{key:Yt,style:na({width:We.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(O,null,ae(te.product.variants,(We,Yt)=>{var Na,Ge;return r(),h("tr",{key:We.id||Yt,class:de(["bulk-variation-row",{"is-selected":A(me)(`v:${We.id}`)}]),onClick:Tt=>Me(`v:${We.id}`,Tt)},[o("td",o1e,[n(ne,{"model-value":A(me)(`v:${We.id}`),tabindex:"-1",onChange:Tt=>A(ge)(`v:${We.id}`,Tt,qe.value)},null,8,["model-value","onChange"])]),o("td",i1e,[o("div",r1e,[se[20]||(se[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(je,{size:"small",modelValue:We.variation_title,"onUpdate:modelValue":[Tt=>We.variation_title=Tt,Tt=>{U(te.product),Ze("title",Tt,`v:${We.id}`)}],placeholder:Y.$t("Variation title"),disabled:E(te.product),class:de({"is-error":pe(te.product,Yt,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),oe(te.product,Yt)?(r(),$(dt,{key:0,content:Z(te.product,Yt),placement:"top"},{default:d(()=>[o("span",d1e,[n(Be,{size:14},{default:d(()=>[n(A(xo))]),_:1})])]),_:2},1032,["content"])):k("",!0)])]),Bt("image")?(r(),h("td",u1e,[n(hl,{modelValue:We.media,"onUpdate:modelValue":Tt=>We.media=Tt,onChange:Tt=>U(te.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):k("",!0),Bt("sku")?(r(),h("td",c1e,[n(je,{class:de(["fct-bulk-input",{"is-error":pe(te.product,Yt,"sku")}]),size:"small",modelValue:We.sku,"onUpdate:modelValue":[Tt=>We.sku=Tt,Tt=>{U(te.product),Ze("sku",Tt,`v:${We.id}`)}],placeholder:Y.$t("SKU"),disabled:E(te.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):k("",!0),Bt("categories")?(r(),h("td",A1e,se[21]||(se[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("description")?(r(),h("td",p1e,se[22]||(se[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("short_description")?(r(),h("td",f1e,se[23]||(se[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("status")?(r(),h("td",m1e,se[24]||(se[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("product_type")?(r(),h("td",h1e,se[25]||(se[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("pricing_type")?(r(),h("td",_1e,se[26]||(se[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):k("",!0),Bt("payment_type")?(r(),h("td",v1e,[n(Ko,{variant:We,disabled:E(te.product),"has-error":pe(te.product,Yt,"other_info.payment_type"),onPaymentTypeChange:Tt=>{var Zl;S(te.product,Tt),Ze("payment_type",(Zl=Tt.other_info)==null?void 0:Zl.payment_type,`v:${We.id}`)},onChange:Tt=>U(te.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):k("",!0),Bt("interval")?(r(),h("td",g1e,[n(Go,{variant:We,disabled:E(te.product),"has-error":pe(te.product,Yt,"other_info.repeat_interval"),onChange:Tt=>{var Zl;U(te.product),Ze("interval",(Zl=We.other_info)==null?void 0:Zl.repeat_interval,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("trial_days")?(r(),h("td",y1e,[n(jo,{variant:We,disabled:E(te.product),"has-error":pe(te.product,Yt,"other_info.trial_days"),onChange:Tt=>{var Zl;U(te.product),Ze("trial_days",(Zl=We.other_info)==null?void 0:Zl.trial_days,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("best_price")?(r(),h("td",b1e,[n(No,{variant:We,disabled:E(te.product),"has-error":pe(te.product,Yt,"item_price"),onChange:Tt=>{U(te.product),Ze("price",We.item_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("compare_price")?(r(),h("td",w1e,[n(zo,{variant:We,disabled:E(te.product),"has-error":pe(te.product,Yt,"compare_price"),onChange:Tt=>{U(te.product),Ze("compare_price",We.compare_price,`v:${We.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):k("",!0),Bt("track_quantity")?(r(),h("td",C1e,se[27]||(se[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):k("",!0),Bt("stock")?(r(),h("td",B1e,[(Ge=(Na=te.product)==null?void 0:Na.detail)!=null&&Ge.manage_stock?(r(),$(je,{key:0,class:"fct-bulk-input",placeholder:Y.$t("e.g 10"),size:"small",modelValue:We.available,"onUpdate:modelValue":[Tt=>We.available=Tt,Tt=>{We.total_stock=Tt,U(te.product),A(nt).syncStockStatus(te.product),Ze("stock",Tt,`v:${We.id}`)}],disabled:E(te.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",k1e,"—"))])):k("",!0),o("td",{class:de(["text-center",{"sticky-col sticky-col-right":X.value}])},[o("div",x1e,[n(Xe,{tag:"button",size:"x-small",onClick:Ne(Tt=>q(te.product,We),["prevent"]),disabled:p.value||E(te.product),title:Y.$t("Duplicate")},{default:d(()=>[n(ee,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(Xe,{tag:"button",size:"x-small",hover:"danger",onClick:Ne(Tt=>$t(te.product,We),["prevent"]),disabled:p.value||E(te.product),title:Y.$t("Delete")},{default:d(()=>[n(ee,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,n1e)}),128))])])]),_:2},1032,["visible"])],8,l1e)])):k("",!0)],64)}),128)),pa.value>0?(r(),h("tr",S1e,[o("td",{colspan:Ht.value.length+1,style:na({height:pa.value+"px",padding:0,border:"none"})},null,12,F1e)])):k("",!0)]),_:1},8,["columns","sticky-last"])],2)):c.value?c.value?(r(),h("div",U1e,[n(Be,{class:"is-loading mr-2"},{default:d(()=>se[28]||(se[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",I1e,f(Y.$t("Loading products...")),1)])):k("",!0):(r(),h("div",$1e,[o("p",E1e,f(Y.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&c.value?(r(),h("div",Q1e,[n(Be,{class:"is-loading mr-2"},{default:d(()=>se[29]||(se[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",D1e,f(Y.$t("Loading"))+" "+f(C.value)+" "+f(Y.$t("more...")),1)])):k("",!0)])]),_:1})]),_:1})]),n(wt,{modelValue:ct.value.visible,"onUpdate:modelValue":se[12]||(se[12]=te=>ct.value.visible=te),title:Et.value,width:"700px","close-on-click-modal":!1,onClosed:se[13]||(se[13]=te=>ct.value.product=null)},{footer:d(()=>[n(ye,{onClick:se[11]||(se[11]=te=>ct.value.visible=!1)},{default:d(()=>[R(f(Y.$t("Cancel")),1)]),_:1}),n(ye,{type:"primary",onClick:Dt},{default:d(()=>[R(f(Y.$t("Save")),1)]),_:1})]),default:d(()=>[ct.value.visible&&ct.value.field==="post_content"?(r(),$(Wl,{key:0,"model-value":ct.value.value,height:300,onUpdate:St},null,8,["model-value"])):k("",!0),ct.value.visible&&ct.value.field==="post_excerpt"?(r(),$(je,{key:1,modelValue:ct.value.value,"onUpdate:modelValue":se[10]||(se[10]=te=>ct.value.value=te),type:"textarea",rows:6,placeholder:Y.$t("Short description")},null,8,["modelValue","placeholder"])):k("",!0)]),_:1},8,["modelValue","title"])])}}},qp=ze.get("payment_routes");for(const e of qp)e.props=!0;const L1e=ze.get("storage_driver_routes"),Yp=(L1e||[]).filter(e=>e.name!=="s3");for(const e of Yp)e.props=!0;var R1e={dashboard:{name:"dashboard",path:"/",component:dk,meta:{active_menu:"dashboard",title:"Dashboard"}},orders:{path:"/orders",component:EF,meta:{active_menu:"orders",title:"Orders"},children:[{name:"orders",path:"",component:F_,meta:{active_menu:"orders",title:"Orders",permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:y9,props:!0,meta:{active_menu:"orders",title:"View Order",permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:X9,props:!0,meta:{active_menu:"orders",title:"Create Order",permission:"orders/create"}}]},products:{name:"products",path:"/products",component:jT,meta:{active_menu:"products",title:"Products",permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:HD,name:"product_route",meta:{active_menu:"products",title:"Products",permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:mj,meta:{active_menu:"products",title:"Product Edit",permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:tc,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:Nu,meta:{active_menu:"products",title:"Edit Integration",permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:Bz,meta:{active_menu:"products",title:"Integrations",permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:lz,meta:{active_menu:"products",title:"Upgrade Paths",permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:tc,meta:{active_menu:"integrations",title:"Product Integrations",permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:nge,meta:{active_menu:"products",title:"Product Bulk Insert",permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:M1e,meta:{active_menu:"products",title:"Product Bulk Edit",permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:Jf,meta:{active_menu:"products",title:"Attributes",permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:aW,meta:{active_menu:"products",title:"Inventory",permission:"products/view"}},customers:{path:"/customers",component:Wv,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:fh,meta:{active_menu:"customers",title:"Customers",permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:BE,props:!0,meta:{active_menu:"customers",title:"View Customer",permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:fZ,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:dde,meta:{title:"Overview",permission:"reports/view"}},{name:"reports_sales",path:"sales",component:KZ,meta:{title:"Sales",permission:"reports/view"}},{name:"reports_orders",path:"orders",component:ole,meta:{title:"Orders",permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Oee,meta:{title:"Revenue",permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:Nle,meta:{title:"Refunds",permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:Vse,meta:{title:"Subscriptions",permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:Yne,meta:{title:"Retention",permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>qt(()=>import("./chunks/Cohort.js?ver=1.5.1"),[],import.meta.url),meta:{title:"Cohorts",permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:ene,meta:{title:"Future Renewals",permission:"reports/view"}},{name:"reports_products",path:"products",component:hre,meta:{title:"Product",permission:"reports/view"}},{name:"reports_customer",path:"customer",component:yoe,meta:{title:"Customer",permission:"reports/view"}},{name:"reports_sources",path:"sources",component:zoe,meta:{title:"Sources",permission:"reports/view"}}]},settings:{path:"/settings",component:h$,meta:{active_menu:"settings",title:"Settings",permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:rD,meta:{active_menu:"settings",title:"Settings",permission:"store/settings"},children:[{name:"store_setup",path:"",component:vs,meta:{title:"Store Setup"}},{name:"pages_setup",path:"pages_setup",component:vs,meta:{title:"Pages Setup"}},{name:"single_product_setup",path:"single_product_setup",component:vs,meta:{title:"Product Page"}},{name:"cart_and_checkout",path:"cart_and_checkout",component:vs,meta:{title:"Cart & Checkout"}},{name:"subscriptions_setup",path:"subscriptions",component:vs,meta:{title:"Subscriptions"}},{name:"checkout_fields",path:"checkout_fields",component:Xhe,meta:{}}]},...ze.get("addon_settings_routes",[]).map(e=>({component:vs,...e})),{name:"email_notifications",path:"email_notifications",component:xW,meta:{active_menu:"settings",title:"Notifications",permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:sue,meta:{active_menu:"settings",title:"Mailing Settings",permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:vs,meta:{active_menu:"settings",title:"Reminders",permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:Aue,meta:{active_menu:"settings",title:"Store Digest",permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:ZW,meta:{active_menu:"settings",title:"Edit Notification",permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:wX,meta:{active_menu:"settings",title:"Add Notification",permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:UD,meta:{active_menu:"settings",title:"Licensing",permission:"store/sensitive"}},{name:"payments",path:"payments",component:PF,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"gateway",component:$3,path:"payments",children:qp,props:!0,meta:{active_menu:"settings",title:"Payment Settings",permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:D_,meta:{active_menu:"settings",title:"Invoice & Packing",permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:K_,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:iv,meta:{active_menu:"settings",title:"PDF Templates",permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:jv,meta:{active_menu:"settings",title:"PDF Template Settings",permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:xv,props:!0,meta:{active_menu:"settings",title:"Edit PDF Template",permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:r$,meta:{active_menu:"settings",title:"Role Settings",permission:"is_super_admin"}},{name:"addons",path:"addons",component:Fde,meta:{active_menu:"settings",title:"Features & addon",permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:dc,meta:{active_menu:"coupons",title:"Coupons Settings",permission:"is_super_admin"}},{name:"storage",path:"storage",component:fX,meta:{active_menu:"settings",title:"Storage Providers",permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:lc,props:!0,meta:{active_menu:"settings",title:"S3",permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:D3,meta:{active_menu:"settings",title:"Gateway",permission:"is_super_admin"},props:!0},{name:"drivers",component:lc,path:"storage",children:Yp,props:!0,meta:{active_menu:"settings",title:"Storage Settings",permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:mue,meta:{active_menu:"settings",title:"Tax Settings",permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:wce,meta:{}},{name:"tax_rates",path:"tax_rates",component:Lce,meta:{}},{name:"eu",path:"eu",component:dme,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:rc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:rc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:C4,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:Nu,meta:{active_menu:"integrations",title:"Global Integrations",permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:sS,meta:{active_menu:"integrations",title:"Integrations",permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:dc,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:dJ,meta:{active_menu:"logs",title:"Logs",permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:rpe,meta:{active_menu:"taxes",title:"taxes",permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:Ehe,props:!0,meta:{active_menu:"coupons",title:"Coupons",permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:FF,name:"onboarding",meta:{active_menu:"dashboard",title:"Onboarding",permission:"is_super_admin"}}};const O1e={class:"fct-theme-button-container"},H1e={class:"theme-selected-button"},P1e={__name:"ThemeToggle",setup(e){const t=V(Te.MODE_LIGHT),a=c=>{t.value!==c&&(t.value=c,Te.apply(c))},l=[{value:"light",label:u("Light"),icon:"Sun"},{value:"dark",label:u("Dark"),icon:"Moon"},{value:"system",label:u("System"),icon:"Tools"}];Ss(()=>{const c=document.getElementById("theme-button-container");if(c){const p=c.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=Te.getCurrentTheme(),t.value.toString().startsWith(Te.MODE_SYSTEM)&&(t.value=Te.MODE_SYSTEM)});const s=c=>{Se(()=>{t.value=Te.getCurrentTheme()})},i=c=>{a(c)};return Qe(()=>{window.addEventListener(Te.THEME_CHANGE_EVENT,s,!1)}),vl(()=>{window.removeEventListener(Te.THEME_CHANGE_EVENT,s,!1)}),(c,p)=>{const m=B("el-dropdown-item"),_=B("el-dropdown-menu"),g=B("el-dropdown");return r(),h("div",O1e,[n(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(),h(O,null,ae(l,y=>n(m,{key:y.value,command:y.value,class:de({active:t.value===y.value})},{default:d(()=>[n(ee,{name:y.icon},null,8,["name"]),R(" "+f(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[o("div",H1e,[t.value==="light"?(r(),$(ee,{key:0,name:"Sun"})):t.value==="dark"?(r(),$(ee,{key:1,name:"Moon"})):t.value==="system"?(r(),$(ee,{key:2,name:"Tools"})):k("",!0)])]),_:1})])}}};function Jl(e){return Array.isArray?Array.isArray(e):Jp(e)==="[object Array]"}function N1e(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function K1e(e){return e==null?"":N1e(e)}function Tl(e){return typeof e=="string"}function Wp(e){return typeof e=="number"}function G1e(e){return e===!0||e===!1||j1e(e)&&Jp(e)=="[object Boolean]"}function Xp(e){return typeof e=="object"}function j1e(e){return Xp(e)&&e!==null}function pl(e){return e!=null}function er(e){return!e.trim().length}function Jp(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const z1e="Incorrect 'index' type",q1e=e=>`Invalid value for key ${e}`,Y1e=e=>`Pattern length exceeds max of ${e}.`,W1e=e=>`Missing ${e} property in key`,X1e=e=>`Property 'weight' in key '${e}' must be a positive integer`,mc=Object.prototype.hasOwnProperty;class J1e{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=Zp(l);this._keys.push(s),this._keyMap[s.id]=s,a+=s.weight}),this._keys.forEach(l=>{l.weight/=a})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Zp(e){let t=null,a=null,l=null,s=1,i=null;if(Tl(e)||Jl(e))l=e,t=hc(e),a=Dr(e);else{if(!mc.call(e,"name"))throw new Error(W1e("name"));const c=e.name;if(l=c,mc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(X1e(c));t=hc(c),a=Dr(c),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function hc(e){return Jl(e)?e:e.split(".")}function Dr(e){return Jl(e)?e.join("."):e}function Z1e(e,t){let a=[],l=!1;const s=(i,c,p)=>{if(pl(i))if(!c[p])a.push(i);else{let m=c[p];const _=i[m];if(!pl(_))return;if(p===c.length-1&&(Tl(_)||Wp(_)||G1e(_)))a.push(K1e(_));else if(Jl(_)){l=!0;for(let g=0,y=_.length;g<y;g+=1)s(_[g],c,p+1)}else c.length&&s(_,c,p+1)}};return s(e,Tl(t)?t.split("."):t,0),l?a:a[0]}const eye={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},tye={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},aye={location:0,threshold:.6,distance:100},lye={useExtendedSearch:!1,getFn:Z1e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var xt={...tye,...eye,...aye,...lye};const sye=/[^ ]+/g;function nye(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(sye).length;if(a.has(i))return a.get(i);const c=1/Math.pow(i,.5*e),p=parseFloat(Math.round(c*l)/l);return a.set(i,p),p},clear(){a.clear()}}}class xd{constructor({getFn:t=xt.getFn,fieldNormWeight:a=xt.fieldNormWeight}={}){this.norm=nye(a,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((a,l)=>{this._keysMap[a.id]=l})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Tl(this.docs[0])?this.docs.forEach((t,a)=>{this._addString(t,a)}):this.docs.forEach((t,a)=>{this._addObject(t,a)}),this.norm.clear())}add(t){const a=this.size();Tl(t)?this._addString(t,a):this._addObject(t,a)}removeAt(t){this.records.splice(t,1);for(let a=t,l=this.size();a<l;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(t,a){return t[this._keysMap[a]]}size(){return this.records.length}_addString(t,a){if(!pl(t)||er(t))return;let l={v:t,i:a,n:this.norm.get(t)};this.records.push(l)}_addObject(t,a){let l={i:a,$:{}};this.keys.forEach((s,i)=>{let c=s.getFn?s.getFn(t):this.getFn(t,s.path);if(pl(c)){if(Jl(c)){let p=[];const m=[{nestedArrIndex:-1,value:c}];for(;m.length;){const{nestedArrIndex:_,value:g}=m.pop();if(pl(g))if(Tl(g)&&!er(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else Jl(g)&&g.forEach((y,v)=>{m.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Tl(c)&&!er(c)){let p={v:c,n:this.norm.get(c)};l.$[i]=p}}}),this.records.push(l)}toJSON(){return{keys:this.keys,records:this.records}}}function ef(e,t,{getFn:a=xt.getFn,fieldNormWeight:l=xt.fieldNormWeight}={}){const s=new xd({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(Zp)),s.setSources(t),s.create(),s}function oye(e,{getFn:t=xt.getFn,fieldNormWeight:a=xt.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new xd({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(s),i}function mo(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:s=xt.distance,ignoreLocation:i=xt.ignoreLocation}={}){const c=t/e.length;if(i)return c;const p=Math.abs(l-a);return s?c+p/s:p?1:c}function iye(e=[],t=xt.minMatchCharLength){let a=[],l=-1,s=-1,i=0;for(let c=e.length;i<c;i+=1){let p=e[i];p&&l===-1?l=i:!p&&l!==-1&&(s=i-1,s-l+1>=t&&a.push([l,s]),l=-1)}return e[i-1]&&i-l>=t&&a.push([l,i-1]),a}const bs=32;function rye(e,t,a,{location:l=xt.location,distance:s=xt.distance,threshold:i=xt.threshold,findAllMatches:c=xt.findAllMatches,minMatchCharLength:p=xt.minMatchCharLength,includeMatches:m=xt.includeMatches,ignoreLocation:_=xt.ignoreLocation}={}){if(t.length>bs)throw new Error(Y1e(bs));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let C=i,b=v;const w=p>1||m,x=w?Array(y):[];let F;for(;(F=e.indexOf(t,b))>-1;){let T=mo(t,{currentLocation:F,expectedLocation:v,distance:s,ignoreLocation:_});if(C=Math.min(T,C),b=F+g,w){let Q=0;for(;Q<g;)x[F+Q]=1,Q+=1}}b=-1;let L=[],U=1,S=g+y;const M=1<<g-1;for(let T=0;T<g;T+=1){let Q=0,E=S;for(;Q<E;)mo(t,{errors:T,currentLocation:v+E,expectedLocation:v,distance:s,ignoreLocation:_})<=C?Q=E:S=E,E=Math.floor((S-Q)/2+Q);S=E;let D=Math.max(1,v-E+1),H=c?y:Math.min(v+E,y)+g,P=Array(H+2);P[H+1]=(1<<T)-1;for(let J=H;J>=D;J-=1){let oe=J-1,Z=a[e.charAt(oe)];if(w&&(x[oe]=+!!Z),P[J]=(P[J+1]<<1|1)&Z,T&&(P[J]|=(L[J+1]|L[J])<<1|1|L[J+1]),P[J]&M&&(U=mo(t,{errors:T,currentLocation:oe,expectedLocation:v,distance:s,ignoreLocation:_}),U<=C)){if(C=U,b=oe,b<=v)break;D=Math.max(1,2*v-b)}}if(mo(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>C)break;L=P}const I={isMatch:b>=0,score:Math.max(.001,U)};if(w){const T=iye(x,p);T.length?m&&(I.indices=T):I.isMatch=!1}return I}function dye(e){let t={};for(let a=0,l=e.length;a<l;a+=1){const s=e.charAt(a);t[s]=(t[s]||0)|1<<l-a-1}return t}const Yo=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class tf{constructor(t,{location:a=xt.location,threshold:l=xt.threshold,distance:s=xt.distance,includeMatches:i=xt.includeMatches,findAllMatches:c=xt.findAllMatches,minMatchCharLength:p=xt.minMatchCharLength,isCaseSensitive:m=xt.isCaseSensitive,ignoreDiacritics:_=xt.ignoreDiacritics,ignoreLocation:g=xt.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g},t=m?t:t.toLowerCase(),t=_?Yo(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(C,b)=>{this.chunks.push({pattern:C,alphabet:dye(C),startIndex:b})},v=this.pattern.length;if(v>bs){let C=0;const b=v%bs,w=v-b;for(;C<w;)y(this.pattern.substr(C,bs),C),C+=bs;if(b){const x=v-bs;y(this.pattern.substr(x),x)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=l?Yo(t):t,this.pattern===t){let w={isMatch:!0,score:0};return s&&(w.indices=[[0,t.length-1]]),w}const{location:i,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,C=!1;this.chunks.forEach(({pattern:w,alphabet:x,startIndex:F})=>{const{isMatch:L,score:U,indices:S}=rye(t,w,x,{location:i+F,distance:c,threshold:p,findAllMatches:m,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});L&&(C=!0),v+=U,L&&S&&(y=[...y,...S])});let b={isMatch:C,score:C?v/this.chunks.length:1};return C&&s&&(b.indices=y),b}}class ms{constructor(t){this.pattern=t}static isMultiMatch(t){return _c(t,this.multiRegex)}static isSingleMatch(t){return _c(t,this.singleRegex)}search(){}}function _c(e,t){const a=e.match(t);return a?a[1]:null}class uye extends ms{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const a=t===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class cye extends ms{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const l=t.indexOf(this.pattern)===-1;return{isMatch:l,score:l?0:1,indices:[0,t.length-1]}}}class Aye extends ms{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const a=t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class pye extends ms{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const a=!t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class fye extends ms{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const a=t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class mye extends ms{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const a=!t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class af extends ms{constructor(t,{location:a=xt.location,threshold:l=xt.threshold,distance:s=xt.distance,includeMatches:i=xt.includeMatches,findAllMatches:c=xt.findAllMatches,minMatchCharLength:p=xt.minMatchCharLength,isCaseSensitive:m=xt.isCaseSensitive,ignoreDiacritics:_=xt.ignoreDiacritics,ignoreLocation:g=xt.ignoreLocation}={}){super(t),this._bitapSearch=new tf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:m,ignoreDiacritics:_,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class lf extends ms{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,l;const s=[],i=this.pattern.length;for(;(l=t.indexOf(this.pattern,a))>-1;)a=l+i,s.push([l,a-1]);const c=!!s.length;return{isMatch:c,score:c?0:1,indices:s}}}const Vr=[uye,lf,Aye,pye,mye,fye,cye,af],vc=Vr.length,hye=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,_ye="|";function vye(e,t={}){return e.split(_ye).map(a=>{let l=a.trim().split(hye).filter(i=>i&&!!i.trim()),s=[];for(let i=0,c=l.length;i<c;i+=1){const p=l[i];let m=!1,_=-1;for(;!m&&++_<vc;){const g=Vr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),m=!0)}if(!m)for(_=-1;++_<vc;){const g=Vr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const gye=new Set([af.type,lf.type]);class yye{constructor(t,{isCaseSensitive:a=xt.isCaseSensitive,ignoreDiacritics:l=xt.ignoreDiacritics,includeMatches:s=xt.includeMatches,minMatchCharLength:i=xt.minMatchCharLength,ignoreLocation:c=xt.ignoreLocation,findAllMatches:p=xt.findAllMatches,location:m=xt.location,threshold:_=xt.threshold,distance:g=xt.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:c,location:m,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?Yo(t):t,this.pattern=t,this.query=vye(this.pattern,this.options)}static condition(t,a){return a.useExtendedSearch}searchIn(t){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:l,isCaseSensitive:s,ignoreDiacritics:i}=this.options;t=s?t:t.toLowerCase(),t=i?Yo(t):t;let c=0,p=[],m=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,c=0;for(let v=0,C=y.length;v<C;v+=1){const b=y[v],{isMatch:w,indices:x,score:F}=b.search(t);if(w){if(c+=1,m+=F,l){const L=b.constructor.type;gye.has(L)?p=[...p,...x]:p.push(x)}}else{m=0,c=0,p.length=0;break}}if(c){let v={isMatch:!0,score:m/c};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const Tr=[];function bye(...e){Tr.push(...e)}function Mr(e,t){for(let a=0,l=Tr.length;a<l;a+=1){let s=Tr[a];if(s.condition(e,t))return new s(e,t)}return new tf(e,t)}const Wo={AND:"$and",OR:"$or"},Lr={PATH:"$path",PATTERN:"$val"},Rr=e=>!!(e[Wo.AND]||e[Wo.OR]),wye=e=>!!e[Lr.PATH],Cye=e=>!Jl(e)&&Xp(e)&&!Rr(e),gc=e=>({[Wo.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function sf(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const c=wye(s);if(!c&&i.length>1&&!Rr(s))return l(gc(s));if(Cye(s)){const m=c?s[Lr.PATH]:i[0],_=c?s[Lr.PATTERN]:s[m];if(!Tl(_))throw new Error(q1e(m));const g={keyId:Dr(m),pattern:_};return a&&(g.searcher=Mr(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(m=>{const _=s[m];Jl(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return Rr(e)||(e=gc(e)),l(e)}function Bye(e,{ignoreFieldNorm:t=xt.ignoreFieldNorm}){e.forEach(a=>{let l=1;a.matches.forEach(({key:s,norm:i,score:c})=>{const p=s?s.weight:null;l*=Math.pow(c===0&&p?Number.EPSILON:c,(p||1)*(t?1:i))}),a.score=l})}function kye(e,t){const a=e.matches;t.matches=[],pl(a)&&a.forEach(l=>{if(!pl(l.indices)||!l.indices.length)return;const{indices:s,value:i}=l;let c={indices:s,value:i};l.key&&(c.key=l.key.src),l.idx>-1&&(c.refIndex=l.idx),t.matches.push(c)})}function xye(e,t){t.score=e.score}function Sye(e,t,{includeMatches:a=xt.includeMatches,includeScore:l=xt.includeScore}={}){const s=[];return a&&s.push(kye),l&&s.push(xye),e.map(i=>{const{idx:c}=i,p={item:t[c],refIndex:c};return s.length&&s.forEach(m=>{m(i,p)}),p})}class on{constructor(t,a={},l){this.options={...xt,...a},this.options.useExtendedSearch,this._keyStore=new J1e(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof xd))throw new Error(z1e);this._myIndex=a||ef(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){pl(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let l=0,s=this._docs.length;l<s;l+=1){const i=this._docs[l];t(i,l)&&(this.removeAt(l),l-=1,s-=1,a.push(i))}return a}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:a=-1}={}){const{includeMatches:l,includeScore:s,shouldSort:i,sortFn:c,ignoreFieldNorm:p}=this.options;let m=Tl(t)?Tl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return Bye(m,{ignoreFieldNorm:p}),i&&m.sort(c),Wp(a)&&a>-1&&(m=m.slice(0,a)),Sye(m,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=Mr(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:m,score:_,indices:g}=a.searchIn(i);m&&s.push({item:i,idx:c,matches:[{score:_,value:i,norm:p,indices:g}]})}),s}_searchLogical(t){const a=sf(t,this.options),l=(p,m,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,C=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(m,y),searcher:v});return C&&C.length?[{idx:_,item:m,matches:C}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const C=p.children[y],b=l(C,m,_);if(b.length)g.push(...b);else if(p.operator===Wo.AND)return[]}return g},s=this._myIndex.records,i={},c=[];return s.forEach(({$:p,i:m})=>{if(pl(p)){let _=l(a,p,m);_.length&&(i[m]||(i[m]={idx:m,item:p,matches:[]},c.push(i[m])),_.forEach(({matches:g})=>{i[m].matches.push(...g)}))}}),c}_searchObjectList(t){const a=Mr(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:c,i:p})=>{if(!pl(c))return;let m=[];l.forEach((_,g)=>{m.push(...this._findMatches({key:_,value:c[g],searcher:a}))}),m.length&&i.push({idx:p,item:c,matches:m})}),i}_findMatches({key:t,value:a,searcher:l}){if(!pl(a))return[];let s=[];if(Jl(a))a.forEach(({v:i,i:c,n:p})=>{if(!pl(i))return;const{isMatch:m,score:_,indices:g}=l.searchIn(i);m&&s.push({score:_,key:t,value:i,idx:c,norm:p,indices:g})});else{const{v:i,n:c}=a,{isMatch:p,score:m,indices:_}=l.searchIn(i);p&&s.push({score:m,key:t,value:i,norm:c,indices:_})}return s}}on.version="7.1.0";on.createIndex=ef;on.parseIndex=oye;on.config=xt;on.parseQuery=sf;bye(yye);const Fye=(ze.get("payment_routes")||[]).filter(e=>!e.upcoming).map(e=>{const t=e.meta.admin_title||e.meta.title||e.meta.label||e.name;return{title:t,subtitle:u("Manage %1$s",t),path:"/settings/payments/"+e.path}}),$ye=[{title:u("Dashboard"),path:"/"},{title:u("Orders"),path:"/orders"},{title:u("Create Order"),path:"/orders/add"},{title:u("Customers"),path:"/customers"},{title:u("Products"),path:"/products"},{title:u("Product Inventory"),path:"/products/inventory"},{title:u("Bulk Import Products"),path:"/products/bulk-insert"},{title:u("Integrations"),path:"/integrations"},{title:u("Coupons"),path:"/coupons"},{title:u("Logs"),path:"/logs"},{title:u("Taxes"),path:"/taxes"},{title:u("Reports"),path:"/reports/overview"},{title:u("Sales Report"),path:"/reports/sales"},{title:u("Orders Report"),path:"/reports/orders"},{title:u("Revenue Report"),path:"/reports/revenue"},{title:u("Refunds Report"),path:"/reports/refunds"},{title:u("Subscriptions Report"),path:"/reports/subscriptions"},{title:u("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:u("Product Report"),path:"/reports/products"},{title:u("Customer Report"),path:"/reports/customer"},{title:u("Traffic Sources Report"),path:"/reports/sources"},...Fye],Eye=$ye.map(({title:e,subtitle:t,path:a})=>({title:e,...t?{subtitle:t}:{},data:{type:"action",action:({router:l})=>{l.push({path:a})},show_description:!1}})),Uye=[{title:"Theme",title_resolver:()=>{let t=(Te.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Te.isDark()?"dark":"light")==="light"?"dark":"light";Te.apply(t,{fromShortcut:!0})}}}],yc={"/settings/store-settings":u("Store Setup"),"/settings/store-settings/pages_setup":u("Pages Setup"),"/settings/store-settings/single_product_setup":u("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":u("Cart and Checkout"),"/settings/store-settings/subscriptions":u("Subscriptions Setup"),"/settings/store-settings/checkout_fields":u("Checkout Fields"),"/settings/email_notifications":u("Email Notifications"),"/settings/email_mailing_settings":u("Mailing Settings"),"/settings/email_mailing_settings/reminders":u("Reminders"),"/settings/licensing":u("Licensing"),"/settings/payments":u("Payment Settings"),"/settings/invoice-packing":u("Invoice & Packing Slips"),"/settings/pdf-template":u("PDF Templates"),"/settings/roles":u("Role Settings"),"/settings/addons":u("Features & Addons"),"/settings/tax_settings":u("Tax Settings"),"/settings/tax_settings/tax_rates":u("Tax Rates"),"/settings/tax_settings/eu":u("EU VAT Settings"),"/settings/storage":u("Storage Providers"),"/settings/coupons":u("Coupon Settings")};let nf=[];Object.keys(yc).forEach(e=>{const t=yc[e];nf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %1$s",t),show_description:!1}})});const Iye=[],Qye={Menu:Eye,Actions:Uye,Settings:nf,Shortcuts:Iye},Or=[];Object.entries(Qye).forEach(([e,t])=>{t.forEach((a,l)=>{Or.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const Dye=()=>({shouldSort:!0,threshold:.6,keys:[{name:"title",getFn:e=>e.title},{name:"data.description",getFn:e=>e.data.description},{name:"group",weight:2,getFn:e=>e.group}]}),Vye={class:"navigable-list-container fct-global-search-result-container"},Tye={key:0,class:"no-results fct-global-search-result-not-found"},Mye={key:1},Lye=["tabindex","onClick","onKeydown"],Rye={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:u("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,l=V(-1),s=Kr("listContainer"),i=V({}),c=(b,w)=>{w&&(i.value[b]=w)},p=b=>{const w=a.items.length;if(w===0)return;const x=w-1;b==="up"?l.value=l.value<=0?x:l.value-1:b==="down"&&(l.value=l.value>=x?0:l.value+1),m()},m=()=>{const b=s.value,w=i.value[l.value];w&&b&&(w.scrollIntoView({behavior:"smooth",block:"nearest"}),Se(()=>{w.focus()}))},_=b=>{l.value=b,g(b)},g=b=>{b>=0&&b<a.items.length&&a.onAction(a.items[b],b)},y=()=>{l.value=-1};return t({focusList:b=>{b=b??a.items.length-1,b>=0&&(l.value=b,Se(()=>{i.value[b]&&i.value[b].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),Ce(()=>a.items,b=>{y(),b.length>0&&Se(()=>{})},{immediate:!0}),Ce(l,()=>{}),(b,w)=>(r(),h("div",Vye,[e.items.length===0?(r(),h("div",Tye,[n(ee,{name:"Empty/GlobalSearch"}),R(" "+f(e.noResultsText),1)])):(r(),h("div",Mye,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(O,null,ae(e.items,(x,F)=>(r(),h("li",{key:F,ref_for:!0,ref:L=>c(F,L),class:de({selected:F===l.value}),tabindex:F,onClick:L=>_(F),onKeydown:[w[0]||(w[0]=$a(Ne(L=>p("up"),["prevent"]),["arrow-up"])),w[1]||(w[1]=$a(Ne(L=>p("down"),["prevent"]),["arrow-down"])),$a(L=>g(F),["enter"])]},[Ca(b.$slots,"default",{item:x,index:F,isSelected:F===l.value},void 0,!0)],42,Lye))),128))],512)]))]))}},Hr=lt(Rye,[["__scopeId","data-v-2379fe26"]]),Oye={class:"fct-search-result-label"},Hye={class:"fct-search-result-title"},Pye={key:0,class:"fct-search-result-subtitle"},Nye={key:1,class:"fct-search-result-subtitle"},Kye={class:"action-icon"},Gye={class:"recent-search-title"},jye={class:"fct-search-result-label"},zye={class:"fct-search-result-title"},qye={key:0,class:"fct-search-result-subtitle"},Yye={key:1,class:"fct-search-result-subtitle"},Wye={class:"action-icon"},tr="recent_actions",Xye={__name:"ResultList",props:{query:{type:String,required:!0},searchResults:{type:Array,required:!0,default:()=>[]},onActionPerformed:{type:Function,required:!0},focusInput:{type:Function,required:!0},searchData:{type:Array,required:!0,default:()=>[]}},setup(e,{expose:t}){const a=tl();zt().ctx;const l=e,s=V(0),i=V({}),c=V(),p=(x,F)=>{const U=x.item.data,S=_(U.type);if(S==="link"){let M=_(U.url);_(U.new_tab)?window.open(M,"_blank"):window.location.href=M}else S==="action"&&_(U.action);m(x),l.onActionPerformed()},m=x=>{const F=x.item.id;let L=Lt.get(tr)||[];L=L.filter(U=>U!==F),L.unshift(F),L=L.slice(0,5),Lt.set(tr,L)},_=x=>typeof x=="function"?g(x):x,g=async x=>await x({query:l.query,router:a}),y=()=>{var x;(x=c.value)==null||x.resetSelection()},v=()=>{var x;(x=c.value)==null||x.focusList(0)},C=()=>{var x;(x=c.value)==null||x.performFirstAction()};Ce(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let x=i.value;for(const F of Object.keys(x)){const L=x[F];L.item.title_resolver&&(x[F].item.title=await _(L.item.title_resolver))}i.value={...x}});const b=V([]),w=async()=>{const x=Lt.get(tr)||[];let F=rt.whereIn(l.searchData,"id",x),L=[];for(const U of F)typeof U.title_resolver=="function"&&(U.title=await _(U.title_resolver)),L.push({item:U});b.value=L};return Qe(()=>{w()}),t({focusList:v,resetSelection:y,performFirstAction:C,fetchRecentActions:w}),(x,F)=>(r(),h(O,null,[e.query||b.value.length<1?(r(),$(Hr,{key:0,items:e.searchResults,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:L,index:U,isSelected:S})=>{var M,I,T;return[o("span",Oye,[o("span",Hye,f(L.item.title),1),(M=L.item)!=null&&M.subtitle?(r(),h("span",Pye,f(L.item.subtitle),1)):((T=(I=L.item)==null?void 0:I.data)==null?void 0:T.show_description)===!0?(r(),h("span",Nye,f(L.item.data.description),1)):k("",!0)]),o("div",Kye,[n(ee,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):k("",!0),!e.query&&b.value.length>0?(r(),h(O,{key:1},[o("span",Gye,f(A(u)("Recent Actions")),1),n(Hr,{items:b.value,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:L,index:U,isSelected:S})=>{var M,I,T;return[o("span",jye,[o("span",zye,f(L.item.title),1),(M=L.item)!=null&&M.subtitle?(r(),h("span",qye,f(L.item.subtitle),1)):((T=(I=L.item)==null?void 0:I.data)==null?void 0:T.show_description)===!0?(r(),h("span",Yye,f(L.item.data.description),1)):k("",!0)]),o("div",Wye,[n(ee,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):k("",!0)],64))}},Jye=lt(Xye,[["__scopeId","data-v-ccb0ebef"]]),Zye={class:"fct-global-search-product-wrap"},ebe={class:"fct-global-search-product-left-info"},tbe={key:0,class:"type"},abe={key:0,class:"price-and-status"},lbe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?ha(l.min_price,!0):`${ha(l.min_price,!0)} - ${ha(l.max_price,!0)}`,a=l=>l==="publish"?u("published"):l==="future"?u("scheduled"):l;return(l,s)=>(r(),h("div",Zye,[o("div",ebe,[n(qr,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",tbe,[R(f(A(oa).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),R(" "+f(A(oa).headline(e.product.detail.fulfillment_type)),1)])):k("",!0)]),e.product.detail?(r(),h("span",abe,[R(f(t(e.product.detail))+" ",1),(r(),$(Aa,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[R(f(a(e.product.post_status)),1)]),_:1},8,["status"]))])):k("",!0)]))}},sbe={class:"fct-global-search-order-wrap"},nbe={class:"fct-global-search-order-header"},obe={class:"fct-global-search-order-id"},ibe={class:"items"},rbe={class:"fct-global-search-order-header-meta"},dbe={class:"date"},ube=["innerHTML"],cbe={class:"customer-name"},Abe={class:"fct-global-search-order-status-wrapper"},pbe=["src","alt"],fbe={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>rt.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const s=B("el-tag");return r(),h("div",sbe,[o("div",nbe,[o("div",obe,[R(" #"+f(e.order.id)+" ",1),o("span",ibe,f(A(u)("%s Items",e.order.order_items.length)),1)]),o("div",rbe,[o("span",dbe,[n(Pa,{"date-time":e.order.created_at},null,8,["date-time"])]),l[0]||(l[0]=o("span",{class:"circle"},null,-1)),o("span",{class:"total-price",innerHTML:A(ha)(e.order.total_amount,!0,!1,e.order.currency)},null,8,ube),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",cbe,f(((i=e.order.customer)==null?void 0:i.full_name)||A(u)("No Name")),1)])]),o("div",Abe,[n(Aa,{status:e.order.payment_status,"hide-icon":!0},null,8,["status"]),t(e.order.payment_method)?(r(),h("img",{key:0,src:t(e.order.payment_method),alt:A(oa).headline(e.order.payment_method)},null,8,pbe)):(r(),$(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[R(f(A(oa).headline(e.order.payment_method)),1)]),_:1}))])])}}},mbe={class:"fct-global-search-customer-wrap"},hbe={class:"fct-customer-card"},_be={class:"fct-customer-avatar"},vbe=["src"],gbe={class:"fct-customer-details"},ybe={class:"fct-customer-name"},bbe={class:"fct-customer-id"},wbe={class:"fct-customer-email"},Cbe={class:"purchase-count"},Bbe={class:"date"},kbe={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",mbe,[o("div",hbe,[o("div",_be,[o("img",{src:e.customer.photo,alt:"avatar"},null,8,vbe)]),o("div",gbe,[o("div",ybe,[R(f(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",bbe,"#"+f(e.customer.id),1)]),o("div",wbe,[R(f(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",Cbe,"Purchase: "+f(e.customer.purchase_count),1)])])]),o("span",Bbe,[n(Pa,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},xbe={class:"fct-global-search-coupon-wrap"},Sbe={class:"amount"},Fbe={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",xbe,[o("span",null,f(e.coupon.title),1),o("span",null,f(e.coupon.code),1),o("span",Sbe,f(A(ha)(e.coupon.amount,!0)),1)]))}},$be={class:"fct-global-remote-result-container"},Ebe={class:"fct-global-remote-result-label"},Ube={class:"text"},Ibe={class:"navigable-content"},Qbe={class:"action-icon"},Dbe={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=tl(),i=V({}),c=V(""),p=V(),m=V({}),_=V([]),g=T=>{y.value=!1,_.value=x.data.tableData,l("onRemoteSearchStateChange",!1)},y=V(!1),v={orders:Kc({fetch:!1}),products:kp({fetch:!1}),customers:Nc({fetch:!1}),coupons:Pp({fetch:!1})},C=()=>{},b=()=>{var T;(T=p.value)==null||T.focusList(0)},w=()=>{var T;(T=p.value)==null||T.performFirstAction()};Ss(()=>{for(const T of Object.keys(v))v[T].onDataLoaded(g)});let x=null;const F=()=>{x=v[i.value.key],x.data.search=c.value,y.value=!0,x.fetch(),l("onRemoteSearchStateChange",!0)},L=ed.debounce(F,800),U=(T,Q)=>{if(_.value=[],x&&(x.data.search=""),i.value=Q,m.value={title:Q.title,key:Q.key},!T){c.value="";return}c.value=T,L()},S=()=>{s.push({name:m.value.key,query:{search:c.value}}),l("close-modal")},M={orders:{name:"view_order",key:"order_id"},products:{name:"product_edit",key:"product_id"},customers:{name:"view_customer",key:"customer_id"},coupons:{name:"edit_coupon",key:"coupon_id"}},I=T=>{i.value.key in M&&(s.push({name:M[i.value.key].name,params:{[M[i.value.key].key]:T.id||T.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:U,focusList:b,resetSelection:C,performFirstAction:w}),(T,Q)=>(r(),h("div",$be,[o("div",Ebe,[o("span",Ube,f(i.value.title),1),m.value.key?(r(),h("span",{key:0,class:"view-all",onClick:S},f(c.value?A(u)('Search "%1$s" in %2$s',c.value,m.value.title):A(u)("See All %s",m.value.title)),1)):k("",!0)]),n(Hr,{items:_.value,"on-action":E=>{I(E)},"no-results-text":c.value?A(u)("No matches found for %s",i.value.title):A(u)("Type something to find %s",i.value.title),ref_key:"navigableList",ref:p},{default:d(({item:E,index:D,isSelected:H})=>[o("div",Ibe,[i.value.key==="products"?(r(),$(lbe,{key:0,product:E},null,8,["product"])):k("",!0),i.value.key==="orders"?(r(),$(fbe,{key:1,order:E},null,8,["order"])):k("",!0),i.value.key==="customers"?(r(),$(kbe,{key:2,customer:E},null,8,["customer"])):k("",!0),i.value.key==="coupons"?(r(),$(Fbe,{key:3,coupon:E},null,8,["coupon"])):k("",!0)]),o("div",Qbe,[n(ee,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},Vbe={class:"fct-global-search-input-wrap"},Tbe={class:"fct-setting-search-icon"},Mbe={class:"fct-global-search-input-container"},Lbe={key:0,class:"searched-item"},Rbe={class:"fct-global-searching-for"},Obe={class:"fct-global-searching-for-label"},Hbe={class:"fct-global-searching-suggestion-list"},Pbe=["onClick"],Nbe={class:"dialog-footer is-border"},Kbe={class:"fct-search-commands"},Gbe={class:"command-key"},jbe={class:"command-key"},zbe={class:"label"},qbe={class:"command-key"},Ybe={class:"label"},Wbe={class:"label"},Xbe={__name:"GlobalSearch",setup(e){zt().ctx,tl();const t=V(!1),a=V(""),l=V({}),s=V(),i=V(""),c=V([u("orders"),u("products"),u("customers"),u("coupons"),u("settings"),u("menus"),u("shortcuts...")]),p=V(0),m=V(!0),_=V(0),g=V(null),y=V(null),v=V(70),C=V(40),b=V(1700),w=()=>{Se(()=>{F()})},x=()=>{var q,X;I.value?(q=J.value)==null||q.resetSelection():(X=U.value)==null||X.resetSelection(),I.value=!1,P.value=!1,L()},F=()=>{var q;(q=s.value)==null||q.focus()},L=()=>{I.value=!1,l.value=[],t.value=!1,a.value="",T.value=null},U=V(),S=q=>{let X=q.includes(","),ie={},ge=[];(X?q.split(","):[q]).forEach(le=>{le.includes(":")?M(le,ie,ge):ge.push(le)});let he=[];return Object.keys(ie).forEach(le=>{const me=ie[le];me.length>0?me.forEach(Ue=>{Ue.length>0?he.push({group:"'"+le,title:Ue}):he.push({group:"'"+le})}):he.push({group:"'"+le})}),ge.forEach(le=>{le.length>0&&he.push({title:le})}),he},M=(q,X,ie)=>{if(q.length===1)return;let ge=q.split(":"),fe=ge[0],he=ge[1];fe.length>0?(X.hasOwnProperty(fe)||(X[fe]=[]),he.length>0&&X[fe].push(he)):ie.push(he)},I=V(!1),T=V(null),Q=V({o:{key:"orders",title:u("Orders")},p:{key:"products",title:u("Products")},c:{key:"customers",title:u("Customers")},d:{key:"coupons",title:u("Coupons")}}),E=q=>{T.value=q,I.value=!0,l.value={},Se(()=>{var X,ie;(X=J.value)==null||X.fetchData(a.value,q),(ie=s.value)==null||ie.focus()})},D=()=>{var q;l.value=[],T.value=null,a.value="",I.value=!1,(q=s.value)==null||q.focus(),P.value=!1},H=()=>{var q;(q=J.value)==null||q.fetchData(a.value,T.value)},P=V(!1),G=q=>{P.value=q,Se(()=>{var X;(X=s.value)==null||X.focus()})},J=V(),oe=ps(),Z=()=>{if(t.value){F();return}const q=["o","p","c","d"];oe.bind(q,X=>{X.preventDefault();const ie=Q.value[X.key];ie&&E(ie)}),t.value=!0,Se(()=>{var X;(X=U.value)==null||X.fetchRecentActions()}),setTimeout(()=>{oe.unbind(q)},800)};oe.bind(["/"],q=>{!t.value&&W()||(q.preventDefault(),Z())});const W=()=>{const q=document.activeElement;if(!q)return!1;const X=q.tagName;return X==="INPUT"||X==="TEXTAREA"||X==="SELECT"||q.isContentEditable},pe=()=>{if(g.value)return;const q=()=>{if(s.value&&s.value.length>0)return;const ie=c.value[p.value];if(m.value)_.value<ie.length?(i.value=ie.slice(0,_.value+1),_.value++):(m.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},b.value));else{if(y.value)return;_.value>0?(_.value--,i.value=ie.slice(0,_.value)):(m.value=!0,p.value=(p.value+1)%c.value.length)}},X=()=>{q();const ie=m.value?v.value:y.value?120:C.value;g.value=setTimeout(X,ie)};X()},N=V(!1);let j;return Qe(()=>{pe(),j=new on(Or,Dye());const q=document.getElementById("fct_admin_menu_search");if(q){const X=q.querySelector(".fct-global-search-input-wrap");X&&X.remove()}N.value=!!q,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Z}),Ct(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(q,X)=>{const ie=B("el-input"),ge=B("el-dialog");return r(),h(O,null,[N.value?(r(),$(Xo,{key:0,to:"#fct_admin_menu_search"},[o("div",Vbe,[o("button",{onClick:Z,type:"button",class:"fct-setting-search-button","aria-label":"Search"},[o("span",Tbe,[n(ee,{name:"Search"})]),X[6]||(X[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))])])])):k("",!0),n(ge,{modelValue:t.value,"onUpdate:modelValue":X[5]||(X[5]=fe=>t.value=fe),onOpened:w,onClosed:x,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[o("div",Mbe,[n(ee,{name:"Search",class:"search-icon"}),T.value!=null?(r(),h("div",Lbe,[R(f(T.value.title)+" ",1),n(ee,{name:"Cross",class:"searched-item-remove",onClick:D})])):k("",!0),n(ie,{class:"mousetrap",placeholder:A(u)("Search for %1$s",i.value),autofocus:"",ref_key:"searchRef",ref:s,id:"fct-global-search-input",disabled:P.value,onKeydown:[X[0]||(X[0]=$a(Ne(()=>{var fe,he;if(I.value){(fe=J.value)==null||fe.focusList();return}(he=U.value)==null||he.focusList()},["prevent"]),["arrow-down"])),X[1]||(X[1]=$a(Ne(()=>{var fe,he;if(I.value){(fe=J.value)==null||fe.performFirstAction();return}(he=U.value)==null||he.performFirstAction()},["prevent"]),["enter"])),X[2]||(X[2]=$a(()=>{a.value.length===0&&(T.value=null,I.value=!1)},["backspace"]))],onInput:X[3]||(X[3]=()=>{if(I.value){H();return}let fe=a.value.includes(","),he=a.value.includes(":");if(!fe&&!he)l.value.value=A(j).search(a.value);else{const le=S(a.value);l.value.value=A(j).search({$or:le})}}),modelValue:a.value,"onUpdate:modelValue":X[4]||(X[4]=fe=>a.value=fe),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[n(_a,{visible:!T.value&&a.value.length===0,accordion:""},{default:d(()=>[o("div",Rbe,[o("div",Obe,f(A(u)("Searching for")),1),o("div",Hbe,[(r(!0),h(O,null,ae(Q.value,fe=>{var he;return r(),h("div",{key:fe.key,onClick:le=>E(fe),class:de(["fct-global-searching-suggestion",((he=T.value)==null?void 0:he.key)===fe.key?"active":""])},f(fe.title),11,Pbe)}),128))])])]),_:1},8,["visible"]),I.value?(r(),$(Dbe,{key:0,ref_key:"remoteResultRef",ref:J,query:a.value,tag:T.value,onCloseModal:L,onOnRemoteSearchStateChange:G},null,8,["query","tag"])):(r(),$(Jye,{key:1,ref_key:"resultListRef",ref:U,query:a.value,"search-results":l.value.value,onActionPerformed:L,focusInput:F,searchData:A(Or)},null,8,["query","search-results","searchData"])),o("div",Nbe,[o("ul",Kbe,[o("li",null,[o("span",Gbe,[n(ee,{name:"ArrowUp"})]),o("span",jbe,[n(ee,{name:"ArrowDown"})]),o("span",zbe,f(A(u)("To navigate")),1)]),o("li",null,[o("span",qbe,[n(ee,{name:"Enter"})]),o("span",Ybe,f(A(u)("To select")),1)]),o("li",null,[X[7]||(X[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",Wbe,f(A(u)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},Jbe={class:"fl_app fluent-cart-admin-pages"},Zbe=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=V("");Qe(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),l.value=!!document.getElementById("theme-button-container");const c=document.querySelector(".fct_admin_menu_wrap"),p=()=>{window.scrollY>10?c==null||c.classList.add("scroll-header"):c==null||c.classList.remove("scroll-header")};window.addEventListener("scroll",p)});const a=()=>window.location.href,l=V(!1),s=al();Ce(()=>s.fullPath,()=>{t.value=a()});const i=K(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(c,p)=>{const m=B("router-view");return r(),h("div",null,[n(Xbe),i.value?(r(),$(Ua,{key:0})):k("",!0),o("div",Jbe,[n(m)]),l.value?(r(),$(Xo,{key:1,to:"#theme-button-container"},[n(P1e)])):k("",!0)])}}});let bc=!1;function e0e(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:ce.get,$post:ce.post,$put:ce.put,$del:ce.delete,$t:u,$n:Bo,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),ze.get("shop.currency_sign")+" "+t)},formatCents(t,a,l=!1){return!t&&l?"":(t?t=(t*100).toFixed(2):t="0.00",a?(t=new Intl.NumberFormat("en-US").format(t),ze.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return Je.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return Je.formatForOrder(t,a,l,s)},getAddress(t,a="billing"){let l=[t[a+"_address_1"],t[a+"_address_2"],t[a+"_city"],t[a+"_city"],t[a+"_state"],t[a+"_zip"],t[a+"_country"]];return l=l.filter(s=>!!s).join(", "),l||"no "+a+" address"},getOrderAddress(t,a="billing",l=!1){return Zf(t,a,l)},changeTitle(t){jQuery("head title").text(t+" - FluentCart")},handleError(t){if(!t)return;let a="";typeof t=="string"?a=t:t&&t.message?a=t.message:a=t,typeof t=="object"&&(a=this.convertToText(t)),a||(a="Something is wrong!"),this.$notify({type:"error",title:"Error",message:a,dangerouslyUseHTMLString:!0})},convertToText(t){const a=[];if(typeof t=="object"&&t.join===void 0)for(const l in t)a.push(this.convertToText(t[l]));else if(typeof t=="object"&&t.join!==void 0)for(const l in t)a.push(this.convertToText(t[l]));else typeof t=="function"||typeof t=="string"&&a.push(t);return a.join("<br />")},handleSuccess:t=>{z.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{kf.show(t,a,l,s)},Storage:()=>Lt,buildFormRendererValue(t,a){let l={};return Object.keys(t).forEach(s=>{let i=t[s];["grid"].includes(i.type??"")?l[s]=this.buildFormRendererValue(i.schema??{},a[s]??{}):l[s]=a[s]??""}),l},registerCopyAction(){bc||(bc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&Yl.copy(t.target.textContent)}))},currencySign(){return ze.get("shop.currency_sign")},getPlaceholderImage(){return cs.getUrl("images/placeholder.svg")},saveLocal(t,a){Lt.set(t,a)},getLocal(t){return Lt.get(t)},hasPermission(t){return Sn.hasPermission(t)}}}}function t0e(e){e.beforeEach((t,a,l)=>{const s=rt.get(t,"meta.permission");return s?Sn.resolve({permission:s,permissionType:rt.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(ze.get("app_config.env"),l())})}function a0e(e){const t={fluent_cart_products:["fluent_cart_inventory","fluent_cart_attributes"]},a=l=>{if(!l)return;const s="fluent_cart_"+l;Object.entries(t).forEach(([i,c])=>{const p=s===i;c.forEach(m=>{const _=jQuery(".toplevel_page_fluent-cart li."+m);p?_.show():_.hide()})})};e.afterEach((l,s)=>{const i=l.meta.active_menu;jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+i).addClass("active_admin_menu"),jQuery(".toplevel_page_fluent-cart li").removeClass("current"),jQuery(".toplevel_page_fluent-cart li.fluent_cart_"+i).addClass("current"),a(i),l.meta.title&&jQuery("head title").text(l.meta.title+" - FluentCart")})}const l0e={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(c)};c()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,m=Math.min(p/l,1),_=(s+m*(a-s)).toFixed(2);e.textContent=_,m<1&&requestAnimationFrame(c)};c()}},s0e={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,f(A(u)("You are not allowed")),1))}},n0e=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",R1e);let wc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){wc||Ja.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{wc=!1,window.location.reload()}})});const o0e=[Lf,Rf,Of,gs,Hf,Xr,Pf,Nf,ti,Kf,Gf,Tc],Pl=yf(Zbe);Pl.config.globalProperties.appVars=ze.get();Pl.provide("appVars",ze.get());Pl.mixin(e0e());Pl.directive("loading",om);Pl.directive("animate",l0e);dm(Pl);const Sd=bf({routes:[...Object.values(n0e),{path:"/unauthorized",name:"unauthorized",component:s0e,props:!0},{path:"/:path(.*)*",name:"NotFound",component:ai,props:!0}],history:wf(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});Pl.use(Sd);t0e(Sd);a0e(Sd);o0e.forEach(e=>{Pl.component(e.name,e)});const Fd=ze.get("el_strings"),of=ze.get("datei18");Fd.el.datepicker.weeks=of.weekdaysShort;Fd.el.datepicker.months=of.monthsShort;Pl.use(im,{locale:Fd});Pl.mount("#fluent_cart_plugin_app");export{On as E}; | |
| 290 | +*/var Age=Uo.exports,$c;function pge(){return $c||($c=1,function(e,t){((a,l)=>{e.exports=l()})(Age,function a(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},s,i=!l.document&&!!l.postMessage,c=l.IS_PAPA_WORKER||!1,p={},f=0,_={};function g(I){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(M){var O=U(M);O.chunkSize=parseInt(O.chunkSize),M.step||M.chunk||(O.chunkSize=null),this._handle=new b(O),(this._handle.streamer=this)._config=O}).call(this,I),this.parseChunk=function(M,O){var L=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<L){let j=this._config.newline;j||(H=this._config.quoteChar||'"',j=this._handle.guessLineEndings(M,H)),M=[...M.split(j).slice(L)].join(j)}this.isFirstChunk&&V(this._config.beforeFirstChunk)&&(H=this._config.beforeFirstChunk(M))!==void 0&&(M=H),this.isFirstChunk=!1,this._halted=!1;var L=this._partialLine+M,H=(this._partialLine="",this._handle.parse(L,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(M=H.meta.cursor,L=(this._finished||(this._partialLine=L.substring(M-this._baseIndex),this._baseIndex=M),H&&H.data&&(this._rowCount+=H.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),c)l.postMessage({results:H,workerId:_.WORKER_ID,finished:L});else if(V(this._config.chunk)&&!O){if(this._config.chunk(H,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=H=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(H.data),this._completeResults.errors=this._completeResults.errors.concat(H.errors),this._completeResults.meta=H.meta),this._completed||!L||!V(this._config.complete)||H&&H.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),L||H&&H.meta.paused||this._nextChunk(),H}this._halted=!0},this._sendError=function(M){V(this._config.error)?this._config.error(M):c&&this._config.error&&l.postMessage({workerId:_.WORKER_ID,error:M,finished:!1})}}function y(I){var M;(I=I||{}).chunkSize||(I.chunkSize=_.RemoteChunkSize),g.call(this,I),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(O){this._input=O,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(M=new XMLHttpRequest,this._config.withCredentials&&(M.withCredentials=this._config.withCredentials),i||(M.onload=Q(this._chunkLoaded,this),M.onerror=Q(this._chunkError,this)),M.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var O,L=this._config.downloadRequestHeaders;for(O in L)M.setRequestHeader(O,L[O])}var H;this._config.chunkSize&&(H=this._start+this._config.chunkSize-1,M.setRequestHeader("Range","bytes="+this._start+"-"+H));try{M.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}i&&M.status===0&&this._chunkError()}},this._chunkLoaded=function(){M.readyState===4&&(M.status<200||400<=M.status?this._chunkError():(this._start+=this._config.chunkSize||M.responseText.length,this._finished=!this._config.chunkSize||this._start>=(O=>(O=O.getResponseHeader("Content-Range"))!==null?parseInt(O.substring(O.lastIndexOf("/")+1)):-1)(M),this.parseChunk(M.responseText)))},this._chunkError=function(O){O=M.statusText||O,this._sendError(new Error(O))}}function v(I){(I=I||{}).chunkSize||(I.chunkSize=_.LocalChunkSize),g.call(this,I);var M,O,L=typeof FileReader<"u";this.stream=function(H){this._input=H,O=H.slice||H.webkitSlice||H.mozSlice,L?((M=new FileReader).onload=Q(this._chunkLoaded,this),M.onerror=Q(this._chunkError,this)):M=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var H=this._input,j=(this._config.chunkSize&&(j=Math.min(this._start+this._config.chunkSize,this._input.size),H=O.call(H,this._start,j)),M.readAsText(H,this._config.encoding));L||this._chunkLoaded({target:{result:j}})},this._chunkLoaded=function(H){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(H.target.result)},this._chunkError=function(){this._sendError(M.error)}}function w(I){var M;g.call(this,I=I||{}),this.stream=function(O){return M=O,this._nextChunk()},this._nextChunk=function(){var O,L;if(!this._finished)return O=this._config.chunkSize,M=O?(L=M.substring(0,O),M.substring(O)):(L=M,""),this._finished=!M,this.parseChunk(L)}}function k(I){g.call(this,I=I||{});var M=[],O=!0,L=!1;this.pause=function(){g.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){g.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(H){this._input=H,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){L&&M.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),M.length?this.parseChunk(M.shift()):O=!0},this._streamData=Q(function(H){try{M.push(typeof H=="string"?H:H.toString(this._config.encoding)),O&&(O=!1,this._checkIsFinished(),this.parseChunk(M.shift()))}catch(j){this._streamError(j)}},this),this._streamError=Q(function(H){this._streamCleanUp(),this._sendError(H)},this),this._streamEnd=Q(function(){this._streamCleanUp(),L=!0,this._streamData("")},this),this._streamCleanUp=Q(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function b(I){var M,O,L,H,j=Math.pow(2,53),W=-j,G=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,Z=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,ne=this,ce=0,z=0,ue=!1,ie=!1,J=[],N={data:[],errors:[],meta:{}};function ae(Ee){return I.skipEmptyLines==="greedy"?Ee.join("").trim()==="":Ee.length===1&&Ee[0].length===0}function oe(){if(N&&L&&(re("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+_.DefaultDelimiter+"'"),L=!1),I.skipEmptyLines&&(N.data=N.data.filter(function(ve){return!ae(ve)})),fe()){let ve=function(Ue,Ke){V(I.transformHeader)&&(Ue=I.transformHeader(Ue,Ke)),J.push(Ue)};if(N)if(Array.isArray(N.data[0])){for(var Ee=0;fe()&&Ee<N.data.length;Ee++)N.data[Ee].forEach(ve);N.data.splice(0,1)}else N.data.forEach(ve)}function ye(ve,Ue){for(var Ke=I.header?{}:[],We=0;We<ve.length;We++){var Be=We,$e=ve[We],$e=((He,Re)=>(yt=>(I.dynamicTypingFunction&&I.dynamicTyping[yt]===void 0&&(I.dynamicTyping[yt]=I.dynamicTypingFunction(yt)),(I.dynamicTyping[yt]||I.dynamicTyping)===!0))(He)?Re==="true"||Re==="TRUE"||Re!=="false"&&Re!=="FALSE"&&((yt=>{if(G.test(yt)&&(yt=parseFloat(yt),W<yt&&yt<j))return 1})(Re)?parseFloat(Re):Z.test(Re)?new Date(Re):Re===""?null:Re):Re)(Be=I.header?We>=J.length?"__parsed_extra":J[We]:Be,$e=I.transform?I.transform($e,Be):$e);Be==="__parsed_extra"?(Ke[Be]=Ke[Be]||[],Ke[Be].push($e)):Ke[Be]=$e}return I.header&&(We>J.length?re("FieldMismatch","TooManyFields","Too many fields: expected "+J.length+" fields but parsed "+We,z+Ue):We<J.length&&re("FieldMismatch","TooFewFields","Too few fields: expected "+J.length+" fields but parsed "+We,z+Ue)),Ke}var Ce;N&&(I.header||I.dynamicTyping||I.transform)&&(Ce=1,!N.data.length||Array.isArray(N.data[0])?(N.data=N.data.map(ye),Ce=N.data.length):N.data=ye(N.data,0),I.header&&N.meta&&(N.meta.fields=J),z+=Ce)}function fe(){return I.header&&J.length===0}function re(Ee,ye,Ce,ve){Ee={type:Ee,code:ye,message:Ce},ve!==void 0&&(Ee.row=ve),N.errors.push(Ee)}V(I.step)&&(H=I.step,I.step=function(Ee){N=Ee,fe()?oe():(oe(),N.data.length!==0&&(ce+=Ee.data.length,I.preview&&ce>I.preview?O.abort():(N.data=N.data[0],H(N,ne))))}),this.parse=function(Ee,ye,Ce){var ve=I.quoteChar||'"',ve=(I.newline||(I.newline=this.guessLineEndings(Ee,ve)),L=!1,I.delimiter?V(I.delimiter)&&(I.delimiter=I.delimiter(Ee),N.meta.delimiter=I.delimiter):((ve=((Ue,Ke,We,Be,$e)=>{var He,Re,yt,gt;$e=$e||[","," ","|",";",_.RECORD_SEP,_.UNIT_SEP];for(var Rt=0;Rt<$e.length;Rt++){for(var Tt,Dt=$e[Rt],_t=0,Gt=0,bt=0,St=(yt=void 0,new $({comments:Be,delimiter:Dt,newline:Ke,preview:10}).parse(Ue)),Pt=0;Pt<St.data.length;Pt++)We&&ae(St.data[Pt])?bt++:(Tt=St.data[Pt].length,Gt+=Tt,yt===void 0?yt=Tt:0<Tt&&(_t+=Math.abs(Tt-yt),yt=Tt));0<St.data.length&&(Gt/=St.data.length-bt),(Re===void 0||_t<=Re)&&(gt===void 0||gt<Gt)&&1.99<Gt&&(Re=_t,He=Dt,gt=Gt)}return{successful:!!(I.delimiter=He),bestDelimiter:He}})(Ee,I.newline,I.skipEmptyLines,I.comments,I.delimitersToGuess)).successful?I.delimiter=ve.bestDelimiter:(L=!0,I.delimiter=_.DefaultDelimiter),N.meta.delimiter=I.delimiter),U(I));return I.preview&&I.header&&ve.preview++,M=Ee,O=new $(ve),N=O.parse(M,ye,Ce),oe(),ue?{meta:{paused:!0}}:N||{meta:{paused:!1}}},this.paused=function(){return ue},this.pause=function(){ue=!0,O.abort(),M=V(I.chunk)?"":M.substring(O.getCharIndex())},this.resume=function(){ne.streamer._halted?(ue=!1,ne.streamer.parseChunk(M,!0)):setTimeout(ne.resume,3)},this.aborted=function(){return ie},this.abort=function(){ie=!0,O.abort(),N.meta.aborted=!0,V(I.complete)&&I.complete(N),M=""},this.guessLineEndings=function(Ue,ve){Ue=Ue.substring(0,1048576);var ve=new RegExp(S(ve)+"([^]*?)"+S(ve),"gm"),Ce=(Ue=Ue.replace(ve,"")).split("\r"),ve=Ue.split(` | |
| 291 | +`),Ue=1<ve.length&&ve[0].length<Ce[0].length;if(Ce.length===1||Ue)return` | |
| 292 | +`;for(var Ke=0,We=0;We<Ce.length;We++)Ce[We][0]===` | |
| 293 | +`&&Ke++;return Ke>=Ce.length/2?`\r | |
| 294 | +`:"\r"}}function S(I){return I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(I){var M=(I=I||{}).delimiter,O=I.newline,L=I.comments,H=I.step,j=I.preview,W=I.fastMode,G=null,Z=!1,ne=I.quoteChar==null?'"':I.quoteChar,ce=ne;if(I.escapeChar!==void 0&&(ce=I.escapeChar),(typeof M!="string"||-1<_.BAD_DELIMITERS.indexOf(M))&&(M=","),L===M)throw new Error("Comment character same as delimiter");L===!0?L="#":(typeof L!="string"||-1<_.BAD_DELIMITERS.indexOf(L))&&(L=!1),O!==` | |
| 295 | +`&&O!=="\r"&&O!==`\r | |
| 296 | +`&&(O=` | |
| 297 | +`);var z=0,ue=!1;this.parse=function(ie,J,N){if(typeof ie!="string")throw new Error("Input must be a string");var ae=ie.length,oe=M.length,fe=O.length,re=L.length,Ee=V(H),ye=[],Ce=[],ve=[],Ue=z=0;if(!ie)return _t();if(W||W!==!1&&ie.indexOf(ne)===-1){for(var Ke=ie.split(O),We=0;We<Ke.length;We++){if(ve=Ke[We],z+=ve.length,We!==Ke.length-1)z+=O.length;else if(N)return _t();if(!L||ve.substring(0,re)!==L){if(Ee){if(ye=[],gt(ve.split(M)),Gt(),ue)return _t()}else gt(ve.split(M));if(j&&j<=We)return ye=ye.slice(0,j),_t(!0)}}return _t()}for(var Be=ie.indexOf(M,z),$e=ie.indexOf(O,z),He=new RegExp(S(ce)+S(ne),"g"),Re=ie.indexOf(ne,z);;)if(ie[z]===ne)for(Re=z,z++;;){if((Re=ie.indexOf(ne,Re+1))===-1)return N||Ce.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:ye.length,index:z}),Tt();if(Re===ae-1)return Tt(ie.substring(z,Re).replace(He,ne));if(ne===ce&&ie[Re+1]===ce)Re++;else if(ne===ce||Re===0||ie[Re-1]!==ce){Be!==-1&&Be<Re+1&&(Be=ie.indexOf(M,Re+1));var yt=Rt(($e=$e!==-1&&$e<Re+1?ie.indexOf(O,Re+1):$e)===-1?Be:Math.min(Be,$e));if(ie.substr(Re+1+yt,oe)===M){ve.push(ie.substring(z,Re).replace(He,ne)),ie[z=Re+1+yt+oe]!==ne&&(Re=ie.indexOf(ne,z)),Be=ie.indexOf(M,z),$e=ie.indexOf(O,z);break}if(yt=Rt($e),ie.substring(Re+1+yt,Re+1+yt+fe)===O){if(ve.push(ie.substring(z,Re).replace(He,ne)),Dt(Re+1+yt+fe),Be=ie.indexOf(M,z),Re=ie.indexOf(ne,z),Ee&&(Gt(),ue))return _t();if(j&&ye.length>=j)return _t(!0);break}Ce.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:ye.length,index:z}),Re++}}else if(L&&ve.length===0&&ie.substring(z,z+re)===L){if($e===-1)return _t();z=$e+fe,$e=ie.indexOf(O,z),Be=ie.indexOf(M,z)}else if(Be!==-1&&(Be<$e||$e===-1))ve.push(ie.substring(z,Be)),z=Be+oe,Be=ie.indexOf(M,z);else{if($e===-1)break;if(ve.push(ie.substring(z,$e)),Dt($e+fe),Ee&&(Gt(),ue))return _t();if(j&&ye.length>=j)return _t(!0)}return Tt();function gt(bt){ye.push(bt),Ue=z}function Rt(bt){var St=0;return St=bt!==-1&&(bt=ie.substring(Re+1,bt))&&bt.trim()===""?bt.length:St}function Tt(bt){return N||(bt===void 0&&(bt=ie.substring(z)),ve.push(bt),z=ae,gt(ve),Ee&&Gt()),_t()}function Dt(bt){z=bt,gt(ve),ve=[],$e=ie.indexOf(O,z)}function _t(bt){if(I.header&&!J&&ye.length&&!Z){var St=ye[0],Pt=Object.create(null),Ht=new Set(St);let Qt=!1;for(let ht=0;ht<St.length;ht++){let qt=St[ht];if(Pt[qt=V(I.transformHeader)?I.transformHeader(qt,ht):qt]){let ge,Fe=Pt[qt];for(;ge=qt+"_"+Fe,Fe++,Ht.has(ge););Ht.add(ge),St[ht]=ge,Pt[qt]++,Qt=!0,(G=G===null?{}:G)[ge]=qt}else Pt[qt]=1,St[ht]=qt;Ht.add(qt)}Qt&&console.warn("Duplicate headers found and renamed."),Z=!0}return{data:ye,errors:Ce,meta:{delimiter:M,linebreak:O,aborted:ue,truncated:!!bt,cursor:Ue+(J||0),renamedHeaders:G}}}function Gt(){H(_t()),ye=[],Ce=[]}},this.abort=function(){ue=!0},this.getCharIndex=function(){return z}}function D(I){var M=I.data,O=p[M.workerId],L=!1;if(M.error)O.userError(M.error,M.file);else if(M.results&&M.results.data){var H={abort:function(){L=!0,F(M.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:B,resume:B};if(V(O.userStep)){for(var j=0;j<M.results.data.length&&(O.userStep({data:M.results.data[j],errors:M.results.errors,meta:M.results.meta},H),!L);j++);delete M.results}else V(O.userChunk)&&(O.userChunk(M.results,H,M.file),delete M.results)}M.finished&&!L&&F(M.workerId,M.results)}function F(I,M){var O=p[I];V(O.userComplete)&&O.userComplete(M),O.terminate(),delete p[I]}function B(){throw new Error("Not implemented.")}function U(I){if(typeof I!="object"||I===null)return I;var M,O=Array.isArray(I)?[]:{};for(M in I)O[M]=U(I[M]);return O}function Q(I,M){return function(){I.apply(M,arguments)}}function V(I){return typeof I=="function"}return _.parse=function(I,M){var O=(M=M||{}).dynamicTyping||!1;if(V(O)&&(M.dynamicTypingFunction=O,O={}),M.dynamicTyping=O,M.transform=!!V(M.transform)&&M.transform,!M.worker||!_.WORKERS_SUPPORTED)return O=null,_.NODE_STREAM_INPUT,typeof I=="string"?(I=(L=>L.charCodeAt(0)!==65279?L:L.slice(1))(I),O=new(M.download?y:w)(M)):I.readable===!0&&V(I.read)&&V(I.on)?O=new k(M):(l.File&&I instanceof File||I instanceof Object)&&(O=new v(M)),O.stream(I);(O=(()=>{var L;return!!_.WORKERS_SUPPORTED&&(L=(()=>{var H=l.URL||l.webkitURL||null,j=a.toString();return _.BLOB_URL||(_.BLOB_URL=H.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",j,")();"],{type:"text/javascript"})))})(),(L=new l.Worker(L)).onmessage=D,L.id=f++,p[L.id]=L)})()).userStep=M.step,O.userChunk=M.chunk,O.userComplete=M.complete,O.userError=M.error,M.step=V(M.step),M.chunk=V(M.chunk),M.complete=V(M.complete),M.error=V(M.error),delete M.worker,O.postMessage({input:I,config:M,workerId:O.id})},_.unparse=function(I,M){var O=!1,L=!0,H=",",j=`\r | |
| 298 | +`,W='"',G=W+W,Z=!1,ne=null,ce=!1,z=((()=>{if(typeof M=="object"){if(typeof M.delimiter!="string"||_.BAD_DELIMITERS.filter(function(J){return M.delimiter.indexOf(J)!==-1}).length||(H=M.delimiter),typeof M.quotes!="boolean"&&typeof M.quotes!="function"&&!Array.isArray(M.quotes)||(O=M.quotes),typeof M.skipEmptyLines!="boolean"&&typeof M.skipEmptyLines!="string"||(Z=M.skipEmptyLines),typeof M.newline=="string"&&(j=M.newline),typeof M.quoteChar=="string"&&(W=M.quoteChar),typeof M.header=="boolean"&&(L=M.header),Array.isArray(M.columns)){if(M.columns.length===0)throw new Error("Option columns is empty");ne=M.columns}M.escapeChar!==void 0&&(G=M.escapeChar+W),M.escapeFormulae instanceof RegExp?ce=M.escapeFormulae:typeof M.escapeFormulae=="boolean"&&M.escapeFormulae&&(ce=/^[=+\-@\t\r].*$/)}})(),new RegExp(S(W),"g"));if(typeof I=="string"&&(I=JSON.parse(I)),Array.isArray(I)){if(!I.length||Array.isArray(I[0]))return ue(null,I,Z);if(typeof I[0]=="object")return ue(ne||Object.keys(I[0]),I,Z)}else if(typeof I=="object")return typeof I.data=="string"&&(I.data=JSON.parse(I.data)),Array.isArray(I.data)&&(I.fields||(I.fields=I.meta&&I.meta.fields||ne),I.fields||(I.fields=Array.isArray(I.data[0])?I.fields:typeof I.data[0]=="object"?Object.keys(I.data[0]):[]),Array.isArray(I.data[0])||typeof I.data[0]=="object"||(I.data=[I.data])),ue(I.fields||[],I.data||[],Z);throw new Error("Unable to serialize unrecognized input");function ue(J,N,ae){var oe="",fe=(typeof J=="string"&&(J=JSON.parse(J)),typeof N=="string"&&(N=JSON.parse(N)),Array.isArray(J)&&0<J.length),re=!Array.isArray(N[0]);if(fe&&L){for(var Ee=0;Ee<J.length;Ee++)0<Ee&&(oe+=H),oe+=ie(J[Ee],Ee);0<N.length&&(oe+=j)}for(var ye=0;ye<N.length;ye++){var Ce=(fe?J:N[ye]).length,ve=!1,Ue=fe?Object.keys(N[ye]).length===0:N[ye].length===0;if(ae&&!fe&&(ve=ae==="greedy"?N[ye].join("").trim()==="":N[ye].length===1&&N[ye][0].length===0),ae==="greedy"&&fe){for(var Ke=[],We=0;We<Ce;We++){var Be=re?J[We]:We;Ke.push(N[ye][Be])}ve=Ke.join("").trim()===""}if(!ve){for(var $e=0;$e<Ce;$e++){0<$e&&!Ue&&(oe+=H);var He=fe&&re?J[$e]:$e;oe+=ie(N[ye][He],$e)}ye<N.length-1&&(!ae||0<Ce&&!Ue)&&(oe+=j)}}return oe}function ie(J,N){var ae,oe;return J==null?"":J.constructor===Date?JSON.stringify(J).slice(1,25):(oe=!1,ce&&typeof J=="string"&&ce.test(J)&&(J="'"+J,oe=!0),ae=J.toString().replace(z,G),(oe=oe||O===!0||typeof O=="function"&&O(J,N)||Array.isArray(O)&&O[N]||((fe,re)=>{for(var Ee=0;Ee<re.length;Ee++)if(-1<fe.indexOf(re[Ee]))return!0;return!1})(ae,_.BAD_DELIMITERS)||-1<ae.indexOf(H)||ae.charAt(0)===" "||ae.charAt(ae.length-1)===" ")?W+ae+W:ae)}},_.RECORD_SEP="",_.UNIT_SEP="",_.BYTE_ORDER_MARK="\uFEFF",_.BAD_DELIMITERS=["\r",` | |
| 299 | +`,'"',_.BYTE_ORDER_MARK],_.WORKERS_SUPPORTED=!i&&!!l.Worker,_.NODE_STREAM_INPUT=1,_.LocalChunkSize=10485760,_.RemoteChunkSize=5242880,_.DefaultDelimiter=",",_.Parser=$,_.ParserHandle=b,_.NetworkStreamer=y,_.FileStreamer=v,_.StringStreamer=w,_.ReadableStreamStreamer=k,l.jQuery&&((s=l.jQuery).fn.parse=function(I){var M=I.config||{},O=[];return this.each(function(j){if(!(s(this).prop("tagName").toUpperCase()==="INPUT"&&s(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var W=0;W<this.files.length;W++)O.push({file:this.files[W],inputElem:this,instanceConfig:s.extend({},M)})}),L(),this;function L(){if(O.length===0)V(I.complete)&&I.complete();else{var j,W,G,Z,ne=O[0];if(V(I.before)){var ce=I.before(ne.file,ne.inputElem);if(typeof ce=="object"){if(ce.action==="abort")return j="AbortError",W=ne.file,G=ne.inputElem,Z=ce.reason,void(V(I.error)&&I.error({name:j},W,G,Z));if(ce.action==="skip")return void H();typeof ce.config=="object"&&(ne.instanceConfig=s.extend(ne.instanceConfig,ce.config))}else if(ce==="skip")return void H()}var z=ne.instanceConfig.complete;ne.instanceConfig.complete=function(ue){V(z)&&z(ue,ne.file,ne.inputElem),H()},_.parse(ne.file,ne.instanceConfig)}}function H(){O.splice(0,1),L()}}),c&&(l.onmessage=function(I){I=I.data,_.WORKER_ID===void 0&&I&&(_.WORKER_ID=I.workerId),typeof I.input=="string"?l.postMessage({workerId:_.WORKER_ID,results:_.parse(I.input,I.config),finished:!0}):(l.File&&I.input instanceof File||I.input instanceof Object)&&(I=_.parse(I.input,I.config))&&l.postMessage({workerId:_.WORKER_ID,results:I,finished:!0})}),(y.prototype=Object.create(g.prototype)).constructor=y,(v.prototype=Object.create(g.prototype)).constructor=v,(w.prototype=Object.create(w.prototype)).constructor=w,(k.prototype=Object.create(g.prototype)).constructor=k,_})}(Uo)),Uo.exports}var fge=pge();const Ec=bm(fge),mge={class:"el-upload__text"},hge={class:"fct-import-map-table-wrap"},_ge={class:"fct-import-map-heading"},vge={class:"fct-import-map-table"},gge={width:"50%"},yge={class:"dialog-footer"},bge={__name:"Importer",emits:["onDataPopulated"],setup(e,{emit:t}){const a=Jt().ctx,l=T(!1),s=T(),i=T(),c=T([]),p=T([]),f=T({}),_=T({}),g=T(!1),y=["attribute","attributes","attribute's","variation","variations","variation's"];let v=0;const w=T(!1),k=sf(ze.get("shop.decimal_separator","")),b=G=>zL(G,k.thousand),S=G=>{G&&Ec.parse(G,{header:!0,complete:function(Z){p.value=Z.data,c.value=Z.meta.fields,g.value=c.value.includes("Type")&&c.value.includes("Parent"),D(),g.value&&U(),w.value=!0}})},$=()=>{_.value={},c.value=[],p.value=[],w.value=!1,g.value=!1},D=()=>{const G=[],Z=[];let ne=0;c.value.forEach(ce=>{let z=null,ue=null;const ie=ce.toString();for(const[J,N]of y.entries())if(ie.toLocaleLowerCase().startsWith(N)){const ae=ce.toString().match(/ \d+ /g);if(Array.isArray(ae)&&ae.length===1){let oe=ae[0];ne=oe>ne?oe:ne,z=ce.toString().replace(ae[0]," %d "),ue=ce.toString().replace(ae[0]," ");break}}z!=null?G.includes(z)||(G.push(z),Z.push({title:ue,value:z})):Z.push({title:ce,value:ce})}),_.value=Z,v=ne},F=()=>window.fluentCartRestVars.rest.url+"/files/upload",B={post_id:["ID"],post_title:["Name"],post_name:["SKU"],post_content:["description","Description"],post_excerpt:["Short description","Short Description"],post_status:["Published"],comment_status:["Allow customer reviews?"],item_price:["Regular price","Meta: _subscription_price"],compare_price:["Sale price"],images:["Images"],categories:["Categories"],sku:["SKU"],payment_type:["Payment Type"],repeat_interval:["Subscription Interval","Meta: _subscription_period"],trial_days:["Trial Days","Meta: _subscription_trial_length"],installment:["Installment"],installment_count:["Installment Count"],manage_setup_fee:["Setup Fee"],signup_fee_name:["Setup Fee Name"],signup_fee:["Setup Fee Amount","Meta: _subscription_sign_up_fee"]},U=()=>{for(const[G,Z]of Object.entries(B))if(f.value[G]){for(const ne of Z)if(c.value.includes(ne)){f.value[G].value=ne;break}}},Q=G=>G?{day:"daily",week:"weekly",month:"monthly",year:"yearly"}[G.trim().toLowerCase()]||G:"",V=G=>{if(!G)return"";const Z=G.split(",").map(ne=>ne.trim().toLowerCase());return Z.includes("variation")?"variation":Z.includes("variable")?"variable":Z.includes("subscription")?"subscription":Z.includes("simple")?"simple":Z[0]||""},I=(G=!0)=>{const Z=[],ne={},ce=f.value,z={description:"",payment_type:"onetime",times:"",repeat_interval:"",trial_days:"",billing_summary:"",manage_setup_fee:"no",signup_fee_name:"",signup_fee:"",setup_fee_per_item:"no"},ue=J=>{const N=[];for(let ae=1;ae<=10;ae++){const oe=`Attribute ${ae} name`,fe=`Attribute ${ae} value(s)`;J[oe]&&J[fe]&&N.push(J[fe])}return N.join(" - ")},ie=J=>J==="1"||J===1?"published":J==="0"||J===0?"draft":J||"published";p.value.forEach(J=>{var Ce,ve,Ue,Ke,We,Be,$e,He,Re,yt,gt,Rt,Tt,Dt,_t,Gt,bt,St,Pt,Ht;const N=V(J.Type);if(N!=="simple"&&N!=="variable"&&N!=="subscription")return;const ae={};ae._cid=ml(),ae.post_title=J[(Ce=ce.post_title)==null?void 0:Ce.value]||"",ae.post_name=J[(ve=ce.post_name)==null?void 0:ve.value]||ae.post_title,ae.ID=J[(Ue=ce.post_id)==null?void 0:Ue.value]||"",ae.post_content=J[(Ke=ce.post_content)==null?void 0:Ke.value]||"",ae.post_excerpt=J[(We=ce.post_excerpt)==null?void 0:We.value]||"",ae.post_status=ie(J[(Be=ce.post_status)==null?void 0:Be.value]);const oe={variation_type:N==="variable"?"simple_variations":"simple",manage_stock:"0",fulfillment_type:"physical"},fe=J[($e=ce.images)==null?void 0:$e.value]||"",re=[];fe&&fe.split(",").map(Qt=>Qt.trim()).filter(Boolean).forEach(Qt=>{const ht=Qt.split("/").pop().split("?")[0]||"image";re.push({id:0,url:Qt,title:ht})}),ae.detail=oe,ae.gallery=re,ae.variants=[];const Ee=J[(He=ce.categories)==null?void 0:He.value]||"";if(Ee?ae.categories=Ee.split(",").map(Qt=>Qt.trim()).filter(Boolean):ae.categories=[],N==="simple"||N==="subscription"){const Qt=b(J[(Re=ce.item_price)==null?void 0:Re.value]||""),ht=b(J[(yt=ce.compare_price)==null?void 0:yt.value]||""),qt=J[(gt=ce.sku)==null?void 0:gt.value]||"",ge=N==="subscription"?"subscription":J[(Rt=ce.payment_type)==null?void 0:Rt.value]||"onetime",Fe=Q(J[(Tt=ce.repeat_interval)==null?void 0:Tt.value]||""),ot=J[(Dt=ce.trial_days)==null?void 0:Dt.value]||"",wt=J[(_t=ce.installment)==null?void 0:_t.value]||"",kt=J[(Gt=ce.installment_count)==null?void 0:Gt.value]||"",Xt=J[(bt=ce.manage_setup_fee)==null?void 0:bt.value]||"",vt=J[(St=ce.signup_fee_name)==null?void 0:St.value]||"",ea=b(J[(Pt=ce.signup_fee)==null?void 0:Pt.value]||"");(Qt||ae.post_title)&&ae.variants.push({_cid:ml(),variation_title:ae.post_title,sku:qt,item_price:Qt,compare_price:ht,other_info:{...z,payment_type:ge,repeat_interval:Fe,trial_days:ot,installment:wt==="yes"?"yes":"no",times:kt,manage_setup_fee:Xt==="yes"?"yes":"no",signup_fee_name:vt,signup_fee:ea},media:[]})}const ye=J[(Ht=ce.sku)==null?void 0:Ht.value]||"";N==="variable"&&ye&&(ne[ye]=ae),Z.push(ae)}),p.value.forEach(J=>{var yt,gt,Rt,Tt,Dt,_t,Gt,bt,St,Pt,Ht,Qt;if(V(J.Type)!=="variation")return;const N=J.Parent;if(!N||!ne[N])return;const ae=ue(J),oe=b(J[(yt=ce.item_price)==null?void 0:yt.value]||""),fe=b(J[(gt=ce.compare_price)==null?void 0:gt.value]||""),re=J[(Rt=ce.images)==null?void 0:Rt.value]||"",Ee=[];re&&re.split(",").map(ht=>ht.trim()).filter(Boolean).forEach(ht=>{const qt=ht.split("/").pop().split("?")[0]||"image";Ee.push({id:0,url:ht,title:qt})});const ye=J[(Tt=ce.sku)==null?void 0:Tt.value]||"",Ce=J[(Dt=ce.payment_type)==null?void 0:Dt.value]||"onetime",ve=Q(J[(_t=ce.repeat_interval)==null?void 0:_t.value]||""),Ue=J[(Gt=ce.trial_days)==null?void 0:Gt.value]||"",Ke=J[(bt=ce.installment)==null?void 0:bt.value]||"",We=J[(St=ce.installment_count)==null?void 0:St.value]||"",Be=J[(Pt=ce.manage_setup_fee)==null?void 0:Pt.value]||"",$e=J[(Ht=ce.signup_fee_name)==null?void 0:Ht.value]||"",He=b(J[(Qt=ce.signup_fee)==null?void 0:Qt.value]||""),Re={_cid:ml(),variation_title:ae||J.Name||"",sku:ye,item_price:oe,compare_price:fe,other_info:{...z,payment_type:Ce,repeat_interval:ve,trial_days:Ue,installment:Ke==="yes"?"yes":"no",times:We,manage_setup_fee:Be==="yes"?"yes":"no",signup_fee_name:$e,signup_fee:He},media:Ee};ne[N].variants.push(Re)}),W("onDataPopulated",{products:Z,concat:G})},M=(G=!0)=>{if(g.value)return I(G);const Z=[];p.value.forEach(ne=>{var We,Be,$e,He,Re,yt,gt,Rt,Tt,Dt,_t,Gt;const ce={};ce._cid=ml();const z=f.value;ce.post_title=ne[z.post_title.value]??"",ce.post_name=ne[z.post_name.value]??ce.post_title,ce.ID=ne[z.post_id.value]??"",ce.post_content=ne[z.post_content.value]??"",ce.post_excerpt=ne[z.post_excerpt.value]??"",ce.post_status=ne[(We=z.post_status)==null?void 0:We.value]||"published",ce.comment_status="close";const ue=ne[(Be=z.images)==null?void 0:Be.value]||"",ie=[];ue&&ue.split(",").map(bt=>bt.trim()).filter(Boolean).forEach(bt=>{const St=bt.split("/").pop().split("?")[0]||"image";ie.push({id:0,url:bt,title:St})});const J=ne[($e=z.categories)==null?void 0:$e.value]||"";J?ce.categories=J.split(",").map(bt=>bt.trim()).filter(Boolean):ce.categories=[];const N=ne[(He=z.sku)==null?void 0:He.value]||"",ae=ne[(Re=z.payment_type)==null?void 0:Re.value]||"onetime",oe=ne[(yt=z.repeat_interval)==null?void 0:yt.value]||"",fe=ne[(gt=z.trial_days)==null?void 0:gt.value]||"",re=ne[(Rt=z.installment)==null?void 0:Rt.value]||"",Ee=ne[(Tt=z.installment_count)==null?void 0:Tt.value]||"",ye=ne[(Dt=z.manage_setup_fee)==null?void 0:Dt.value]||"",Ce=ne[(_t=z.signup_fee_name)==null?void 0:_t.value]||"",ve=b(ne[(Gt=z.signup_fee)==null?void 0:Gt.value]||""),Ue={variation_type:"simple",manage_stock:"0",fulfillment_type:"physical"},Ke={description:"",payment_type:ae,times:Ee,repeat_interval:oe,trial_days:fe,billing_summary:"",manage_setup_fee:ye==="yes"?"yes":"no",signup_fee_name:Ce,signup_fee:ve,setup_fee_per_item:"no",installment:re==="yes"?"yes":"no"};ce.gallery=ie,ce.variants=[];for(let bt=1;bt<=v;bt++){const St={};["variation_title","item_price","compare_price"].forEach(Pt=>{var Qt;const Ht=((Qt=z[Pt])==null?void 0:Qt.value)??"";if(Ht.length>0){const ht=Ht.replace("%d",bt.toString()),qt=ne[ht];St[Pt]=Pt==="variation_title"?qt:b(qt)}}),H(St)&&(St._cid=ml(),St.sku=N,St.other_info={...Ke},St.media=[],ce.variants.push(St))}ce.variants.length>0?(Ue.variation_type="simple_variations",ce.detail=Ue,Z.push(ce)):H(ce)&&(ce.variants.push({_cid:ml(),variation_title:"",sku:N,item_price:0,compare_price:0,other_info:{...Ke},media:[]}),ce.detail=Ue,Z.push(ce))}),W("onDataPopulated",{products:Z,concat:G})},O=()=>{l.value=!1,s.value=[],i.value=null,$()},L=(G=!0)=>{M(G),O()},H=G=>{let Z=!1;for(const[ne,ce]of Object.entries(G))if(typeof ce!==null&&typeof ce<"u"&&(Array.isArray(ce)&&ce.length>0||ce.toString().length>0)){Z=!0;break}return Z};Ie(()=>{f.value={post_id:{title:a.$t("Post ID"),value:""},post_title:{title:a.$t("Post Title"),value:""},post_name:{title:a.$t("Post Name"),value:""},post_content:{title:a.$t("Post Content"),value:""},post_excerpt:{title:a.$t("Post Excerpt"),value:""},post_status:{title:a.$t("Post Status"),value:""},post_date:{title:a.$t("Post Date"),value:""},comment_status:{title:a.$t("Comment Status"),value:""},images:{title:a.$t("Images"),value:""},variation_title:{title:a.$t("Variation Title"),value:""},item_price:{title:a.$t("Variation Price"),value:""},compare_price:{title:a.$t("Variation Compare Price"),value:""},sku:{title:a.$t("SKU"),value:""},categories:{title:a.$t("Categories"),value:""},payment_type:{title:a.$t("Payment Type"),value:""},repeat_interval:{title:a.$t("Subscription Interval"),value:""},trial_days:{title:a.$t("Trial Days"),value:""},installment:{title:a.$t("Installment"),value:""},installment_count:{title:a.$t("Installment Count"),value:""},manage_setup_fee:{title:a.$t("Setup Fee"),value:""},signup_fee_name:{title:a.$t("Setup Fee Name"),value:""},signup_fee:{title:a.$t("Setup Fee Amount"),value:""}}});const j=()=>{const G=[{ID:"",Type:"simple",SKU:"BASIC-TEE-001",Name:"Classic Cotton T-Shirt",Published:1,"Short description":"Comfortable everyday cotton tee",description:"Made from 100% organic cotton. Pre-shrunk and machine washable.",Categories:"Clothing, Clothing > T-Shirts",Images:"https://example.com/images/tee-front.jpg, https://example.com/images/tee-back.jpg",Parent:"","Regular price":"29.99","Sale price":"24.99","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"onetime","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"simple",SKU:"STARTER-PLAN",Name:"Starter Membership Plan",Published:1,"Short description":"Monthly access to premium content",description:"Get access to all premium tutorials and resources. Cancel anytime.",Categories:"Memberships",Images:"",Parent:"","Regular price":"9.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"14",Installment:"","Installment Count":"","Setup Fee":"yes","Setup Fee Name":"Activation Fee","Setup Fee Amount":"4.99"},{ID:"",Type:"simple",SKU:"PRO-YEARLY",Name:"Pro Annual Plan",Published:1,"Short description":"12-month installment plan",description:"Pay in 12 monthly installments for annual access to all pro features.",Categories:"Memberships",Images:"",Parent:"","Regular price":"19.99","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"subscription","Subscription Interval":"monthly","Trial Days":"",Installment:"yes","Installment Count":"12","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variable",SKU:"HOODIE-PREMIUM",Name:"Premium Zip Hoodie",Published:1,"Short description":"Heavyweight zip-up hoodie",description:"Premium quality hoodie with YKK zipper. Available in multiple colors.",Categories:"Clothing, Clothing > Hoodies",Images:"https://example.com/images/hoodie-main.jpg, https://example.com/images/hoodie-side.jpg, https://example.com/images/hoodie-detail.jpg",Parent:"","Regular price":"","Sale price":"","Attribute 1 name":"","Attribute 1 value(s)":"","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLK",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"https://example.com/images/hoodie-black.jpg",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"Black","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-WHT",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"59.99","Sale price":"","Attribute 1 name":"Color","Attribute 1 value(s)":"White","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""},{ID:"",Type:"variation",SKU:"HOODIE-BLU-LE",Name:"",Published:1,"Short description":"",description:"",Categories:"",Images:"",Parent:"HOODIE-PREMIUM","Regular price":"69.99","Sale price":"64.99","Attribute 1 name":"Color","Attribute 1 value(s)":"Blue","Payment Type":"","Subscription Interval":"","Trial Days":"",Installment:"","Installment Count":"","Setup Fee":"","Setup Fee Name":"","Setup Fee Amount":""}],Z=Ec.unparse(G),ne=new Blob([Z],{type:"text/csv;charset=utf-8;"}),ce=URL.createObjectURL(ne),z=document.createElement("a");z.href=ce,z.download="fluent-cart-sample-import.csv",document.body.appendChild(z),z.click(),document.body.removeChild(z),URL.revokeObjectURL(ce)},W=t;return(G,Z)=>{const ne=C("el-button"),ce=C("el-upload"),z=C("el-option"),ue=C("el-select"),ie=C("el-dialog");return r(),h(P,null,[n(ne,{onClick:Z[0]||(Z[0]=J=>l.value=!0)},{default:d(()=>[R(m(G.$t("Import")),1)]),_:1}),n(ie,{modelValue:l.value,"onUpdate:modelValue":Z[4]||(Z[4]=J=>l.value=J),"append-to-body":!0,title:G.$t("Import Products"),class:"fct-bulk-import-dialog"},{default:d(()=>[w.value?x("",!0):(r(),E(ce,{key:0,class:"fct-file-uploader",ref:"uploaderRef","file-list":s.value,"onUpdate:fileList":Z[1]||(Z[1]=J=>s.value=J),drag:"",action:F(),"on-progress":()=>{},"on-success":()=>{},"on-error":()=>{},"auto-upload":!1,"on-change":J=>{$(),i.value=J,S(J==null?void 0:J.raw)},multiple:!1,limit:1,"show-file-list":!0},{default:d(()=>[n(at,{circle:"",bg:"primary",soft:""},{default:d(()=>[n(Y,{name:"Upload"})]),_:1}),o("div",mge,[R(m(G.$t("Drag & Drop or"))+" ",1),o("em",null,m(G.$t("Browse/Upload")),1),R(" "+m(G.$t("Files"))+" ",1),o("span",null,m(A(u)("Any Format upto %s",A(Vt).serverMaxUploadSize())),1)])]),_:1},8,["file-list","action","on-change"])),w.value?x("",!0):(r(),E(ne,{key:1,onClick:j,link:""},{default:d(()=>[n(Y,{name:"Download"}),R(" "+m(G.$t("Download a Sample CSV File")),1)]),_:1})),w.value?(r(),h(P,{key:2},[o("div",hge,[o("h4",_ge,m(G.$t("Map Columns")),1),o("table",vge,[o("thead",null,[o("tr",null,[o("th",null,m(G.$t("Products Fields")),1),o("th",null,m(G.$t("CSV Headers")),1)])]),o("tbody",null,[(r(!0),h(P,null,te(f.value,(J,N)=>(r(),h("tr",null,[o("td",null,m(J.title),1),o("td",gge,[n(ue,{modelValue:J.value,"onUpdate:modelValue":ae=>J.value=ae,filterable:"",clearable:""},{default:d(()=>[(r(!0),h(P,null,te(_.value,ae=>(r(),E(z,{key:ae.value,label:ae.title,value:ae.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])])]))),256))])])]),o("div",yge,[n(ne,{onClick:Z[2]||(Z[2]=J=>L())},{default:d(()=>[R(m(G.$t("Add Products")),1)]),_:1}),n(ne,{onClick:Z[3]||(Z[3]=J=>L(!1))},{default:d(()=>[R(m(G.$t("Clear and Add Products")),1)]),_:1})])],64)):x("",!0)]),_:1},8,["modelValue","title"])],64)}}};class wge extends Dd{beforeInit(){this.data.products=[],this.data.saving=!1,this.data.saveProgress={total:0,completed:0,errors:[],createdIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.categoryOptions=[],this.data.dummies.product={ID:"",post_title:"",post_name:"",post_content:"",post_excerpt:"",post_status:"published",post_date:new Date,comment_status:"close",categories:[],variants:!1}}populateDummyProduct(){const t={...this.data.dummies.product};t._cid=ml(),t.detail={...this.data.dummies.productDetail},t.gallery=[],t.downloadable_files={...this.data.dummies.downloadableFile},t.variants=[this.getDummyVariation(t)],this.data.products.push(t)}clearProducts(){this.data.products=[]}isSaving(t){return this.data.savingIds.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSaving(t)||this.isSaved(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}chunkArray(t,a){const l=[];for(let s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async saveProducts(){var s,i;const t=this.data.products,a=t.filter(c=>!this.data.savedIds.has(c._cid));if(a.length===0){q.error(u("No products to save."));return}const l=this.chunkArray(a,10);this.data.saving=!0,this.data.productErrors=new Map,this.data.saveProgress={total:l.length,completed:0,errors:[],createdIds:[]};try{for(const f of l){const _=f.map(g=>g._cid);for(const g of _)this.data.savingIds.add(g);this.data.savingIds=new Set(this.data.savingIds);try{const g=await Ae.post("products/bulk-insert",{products:f});if(g.created&&g.created.length){this.data.saveProgress.createdIds.push(...g.created);for(const y of g.created){this.data.savedIds.add(y._cid);const v=t.find(w=>w._cid===y._cid);v&&(v.ID=y.id,v.view_url=y.view_url||"")}this.data.savedIds=new Set(this.data.savedIds)}if(g.errors&&g.errors.length){this.data.saveProgress.errors.push(...g.errors);for(const y of g.errors)y._cid&&this.data.productErrors.set(y._cid,{message:y.message,fields:y.fields||{}});this.data.productErrors=new Map(this.data.productErrors)}}catch(g){const y=(s=g==null?void 0:g.data)==null?void 0:s.errors;if(Array.isArray(y)&&y.length){this.data.saveProgress.errors.push(...y);for(const v of y)v._cid&&this.data.productErrors.set(v._cid,{message:v.message,fields:v.fields||{}})}else{const v=((i=g==null?void 0:g.data)==null?void 0:i.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:v});for(const w of _)this.data.productErrors.set(w,{message:v,fields:{}})}this.data.productErrors=new Map(this.data.productErrors)}for(const g of _)this.data.savingIds.delete(g);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{createdIds:c,errors:p}=this.data.saveProgress;p.length===0?q.success(`${c.length} product(s) created successfully`):c.length>0?q.info(`${c.length} product(s) created, ${p.length} error(s)`):q.error(u("All products failed to save"))}finally{this.data.saving=!1}}async removeProduct(t){var l;if(t.ID&&this.data.savedIds.has(t._cid)){try{await Ae.delete(`products/${t.ID}`)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product from server";q.error(i);return}this.data.savedIds.delete(t._cid),this.data.savedIds=new Set(this.data.savedIds)}const a=this.data.products.indexOf(t);a!==-1&&this.data.products.splice(a,1)}removeVariant(t,a){const l=t.variants.indexOf(a);l!==-1&&t.variants.splice(l,1)}duplicateProduct(t){const a=JSON.parse(JSON.stringify(t));a._cid=ml(),a.post_title=a.post_title?a.post_title+" (Copy)":"",a.variants&&Array.isArray(a.variants)&&a.variants.forEach(s=>{s.sku="",s._cid=ml()});const l=this.data.products.indexOf(t);this.data.products.splice(l+1,0,a)}duplicateProductWithVariants(t,a){const l=JSON.parse(JSON.stringify(t));if(l._cid=ml(),l.post_title=l.post_title?l.post_title+" (Copy)":"",l.variants&&Array.isArray(l.variants)){const i=new Set(a);l.variants=l.variants.filter((c,p)=>i.has(p)),l.variants.forEach(c=>{c.sku="",c._cid=ml()})}const s=this.data.products.indexOf(t);this.data.products.splice(s+1,0,l)}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l._cid=ml(),l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="";const s=t.variants.indexOf(a);t.variants.splice(s+1,0,l)}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}resetState(){this.data.products.splice(0),this.data.savedIds=new Set,this.data.savingIds=new Set,this.data.productErrors=new Map}getColumnWidthStorageKey(){return"bulk_insert_column_widths"}getColumnStorageKey(){return"bulk_insert_columns"}getToggleableColumns(){return[{label:"SKU",value:"sku"},{label:"Media",value:"media"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}flattenCategoryTree(t,a=""){var s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await Ae.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}}const Ft=wge.init(),Cge={class:"max-w-full overflow-x-scroll"},kge={class:"relative"},Bge={key:0,class:"bulk-checkbox-cell"},xge=["onMousedown","onTouchstart"],Bf={__name:"ResizeableColumns",props:{columns:{type:Array,required:!0},stickyLast:{type:Boolean,default:!1}},emits:["scroll","resize-end"],setup(e,{emit:t}){const a=t,l=Xf(),s=td("table"),i=T(null);let c=null;Ie(()=>{xe(()=>{const g=s.value.querySelectorAll("th"),y=l["header-first"]?1:0;Array.from(g).forEach((v,w)=>{const k=w-y;k<0||k>=p.columns.length||(p.columns[k].width=v.offsetWidth,p.columns[k].minWidth||(p.columns[k].minWidth=v.offsetWidth))}),c=new ResizeObserver(()=>{s.value.style.setProperty("--resizer-height",s.value.offsetHeight+"px");const v=s.value.querySelector("th");v&&s.value.style.setProperty("--header-height",v.offsetHeight+"px")}),c.observe(s.value)})}),cl(()=>{c&&c.disconnect()});const p=e,f=K(()=>{const g=l["header-first"]?40:0;return p.columns.reduce((y,v)=>y+v.width,0)+g}),_=(g,y)=>{g.preventDefault();const v=g.clientX,w=p.columns[y].width,k=p.columns[y].minWidth||50;i.value=y;const b=$=>{const D=w+($.clientX-v);D>=k&&(p.columns[y].width=D)},S=()=>{i.value=null,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",S),a("resize-end")};document.addEventListener("mousemove",b),document.addEventListener("mouseup",S)};return(g,y)=>(r(),h("div",Cge,[o("div",{class:de(["resizable-table",{"is-resizing":i.value!==null}]),onScroll:y[0]||(y[0]=v=>a("scroll",v))},[o("div",kge,[o("table",{id:"tb",ref_key:"table",ref:s,style:ra({tableLayout:"fixed",width:f.value+"px"})},[o("thead",null,[o("tr",null,[g.$slots["header-first"]?(r(),h("th",Bge,[ga(g.$slots,"header-first")])):x("",!0),(r(!0),h(P,null,te(e.columns,(v,w)=>(r(),h("th",{class:de({"sticky-col":w===0,"sticky-col sticky-col-right":w===e.columns.length-1&&e.stickyLast}),style:ra({width:v.width+"px",zIndex:w===0||w===e.columns.length-1&&e.stickyLast?70:e.columns.length-w+50,left:w===0&&g.$slots["header-first"]?"40px":w===0?"0px":void 0}),key:v.key||w},[w===e.columns.length-1?ga(g.$slots,"header-last",{key:0},()=>[R(m(v.title),1)]):(r(),h(P,{key:1},[R(m(v.title),1)],64)),w<e.columns.length-1?(r(),h("span",{key:2,class:de(["resizer",{"is-active":i.value===w}]),onMousedown:k=>_(k,w),onTouchstart:k=>_(k,w)},null,42,xge)):x("",!0)],6))),128))])]),o("tbody",null,[ga(g.$slots,"default")])],4)])],34)]))}},Sge={class:"bulk-setup-fee-badge"},Fge={key:1,class:"text-gray-300 text-sm flex justify-center"},Xo={__name:"BulkPriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,s)=>{var c;const i=C("el-tooltip");return e.variant?(r(),E(Za,{key:0,size:"small","error-class":e.hasError?"is-error":"","model-value":e.variant.item_price,placeholder:l.$t("Price"),disabled:e.disabled,"onUpdate:modelValue":s[0]||(s[0]=p=>{e.variant.item_price=p,a("change")})},oa({_:2},[((c=e.variant.other_info)==null?void 0:c.manage_setup_fee)==="yes"&&e.variant.other_info.signup_fee?{name:"suffix",fn:d(()=>[n(i,{content:(e.variant.other_info.signup_fee_name||l.$t("Setup fee"))+": "+A(Kt)(e.variant.other_info.signup_fee,!0),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[o("span",Sge,"+ "+m(l.$t("fee")),1)]),_:1},8,["content"])]),key:"0"}:void 0]),1032,["error-class","model-value","placeholder","disabled"])):(r(),h("span",Fge,"—"))}}},$ge=["disabled"],Ege={key:0,class:"fct-bulk-sub-count"},Uge={class:"fct-bulk-sub-popover-body"},Ige={class:"fct-bulk-sub-popover-title"},Qge={class:"fct-bulk-sub-section"},Dge={class:"fct-bulk-sub-row"},Vge={class:"fct-bulk-sub-row"},Tge={class:"fct-bulk-sub-label"},Mge={class:"fct-bulk-sub-row"},Lge={class:"fct-bulk-sub-label"},Rge=["innerHTML"],Oge={class:"fct-bulk-sub-section"},Pge={class:"fct-bulk-sub-row"},Hge={class:"fct-bulk-sub-row"},Nge={class:"fct-bulk-sub-label"},Kge={class:"fct-bulk-sub-row"},Gge={class:"fct-bulk-sub-label"},zge={class:"fct-bulk-sub-footer"},dr=2,jge={__name:"BulkSubscriptionPopover",props:{variant:{type:Object,required:!0},disabled:{type:Boolean,default:!1}},emits:["changed"],setup(e,{emit:t}){const a=e,l=t,s=Jt().ctx,i=ze.get(),c=ze.get("app_config.isProActive"),p=T(!1);K(()=>{var F;return((F=i==null?void 0:i.shop)==null?void 0:F.currency_sign)||"$"});const f=K(()=>{var F;return((F=a.variant)==null?void 0:F.other_info)||{}}),_=K(()=>f.value.payment_type==="subscription"),g=K(()=>f.value.installment==="yes"),y=K(()=>Number(f.value.times)||1),v=K(()=>{var B;const F=Number((B=a.variant)==null?void 0:B.item_price)||0;return g.value?F*y.value:F}),w=K(()=>{const F=[];if(g.value&&F.push(s.$t("Installment")+": "+y.value+"x"),f.value.manage_setup_fee==="yes"){const B=f.value.signup_fee_name||s.$t("Setup fee"),U=f.value.signup_fee||0;F.push(s.$t("Setup fee")+": "+B+" ("+Kt(U,!0)+")")}return F.length>0?F.join(` | |
| 300 | +`):s.$t("Subscription settings")}),k=F=>{F==="no"?a.variant.other_info.times="":b(),l("changed")},b=()=>{const F=Number(a.variant.other_info.times);(!Number.isFinite(F)||F<dr)&&(a.variant.other_info.times=dr)},S=F=>{F==="no"&&(a.variant.other_info.signup_fee=""),l("changed")},$=()=>{l("changed")},D=()=>{p.value=!1};return(F,B)=>{const U=C("el-checkbox"),Q=C("el-tooltip"),V=C("el-input"),I=C("el-switch"),M=C("el-button"),O=C("el-popover");return r(),E(Q,{content:w.value,placement:"top",disabled:!_.value||p.value,"popper-class":"fct-tooltip","show-after":400},{default:d(()=>[n(O,{visible:p.value,"onUpdate:visible":B[6]||(B[6]=L=>p.value=L),placement:"bottom",width:320,trigger:"click",disabled:e.disabled||!_.value,"popper-class":"bulk-sub-popover"},{reference:d(()=>[o("button",{class:de(["fc-bulk-sub-icon-btn",{"is-active":_.value,"is-configured":_.value&&(g.value||f.value.manage_setup_fee==="yes")}]),disabled:e.disabled||!_.value,onClick:B[0]||(B[0]=Ge(()=>{},["prevent"]))},[B[7]||(B[7]=o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M6 4H21C21.5523 4 22 4.44772 22 5V12H20V6H6V9L1 5.5L6 2V4ZM18 20H3C2.44772 20 2 19.5523 2 19V12H4V18H18V15L23 18.5L18 22V20Z"})],-1)),g.value?(r(),h("span",Ege,m(y.value),1)):x("",!0)],10,$ge)]),default:d(()=>[o("div",Uge,[o("h4",Ige,m(F.$t("Subscription Settings")),1),o("div",Qge,[o("div",Dge,[n(U,{"true-value":"yes","false-value":"no",label:F.$t("Enable installment payment"),modelValue:e.variant.other_info.installment,"onUpdate:modelValue":B[1]||(B[1]=L=>e.variant.other_info.installment=L),disabled:!A(c)||e.disabled,onChange:k},null,8,["label","modelValue","disabled"]),A(c)?x("",!0):(r(),E(Q,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(Y,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),f.value.installment==="yes"?(r(),h(P,{key:0},[o("div",Vge,[o("label",Tge,m(F.$t("Installment Count")),1),n(V,{type:"number",min:dr,size:"small",modelValue:e.variant.other_info.times,"onUpdate:modelValue":B[2]||(B[2]=L=>e.variant.other_info.times=L),modelModifiers:{number:!0},placeholder:F.$t("Count"),style:{width:"100px"},onInput:$,onChange:b},null,8,["modelValue","placeholder"])]),o("div",Mge,[o("span",Lge,m(F.$t("Total Price")),1),o("span",{class:"fct-bulk-sub-value",innerHTML:A(Kt)(v.value,!0)},null,8,Rge)])],64)):x("",!0)]),o("div",Oge,[o("div",Pge,[n(I,{"active-text":F.$t("Setup fee"),modelValue:e.variant.other_info.manage_setup_fee,"onUpdate:modelValue":B[3]||(B[3]=L=>e.variant.other_info.manage_setup_fee=L),"active-value":"yes","inactive-value":"no",disabled:!A(c)||e.disabled,size:"small",onChange:S},null,8,["active-text","modelValue","disabled"]),A(c)?x("",!0):(r(),E(Q,{key:0,"popper-class":"fct-tooltip"},{content:d(()=>[R(m(F.$t("This feature is available in pro version only.")),1)]),default:d(()=>[n(Y,{name:"Crown",class:"fct-pro-icon"})]),_:1}))]),f.value.manage_setup_fee==="yes"?(r(),h(P,{key:0},[o("div",Hge,[o("label",Nge,m(F.$t("Label")),1),n(V,{size:"small",modelValue:e.variant.other_info.signup_fee_name,"onUpdate:modelValue":B[4]||(B[4]=L=>e.variant.other_info.signup_fee_name=L),placeholder:F.$t("e.g. Initial Setup"),onInput:$},null,8,["modelValue","placeholder"])]),o("div",Kge,[o("label",Gge,m(F.$t("Amount")),1),n(Za,{size:"small","model-value":e.variant.other_info.signup_fee,placeholder:F.$t("Amount"),"onUpdate:modelValue":B[5]||(B[5]=L=>{e.variant.other_info.signup_fee=L,$()})},null,8,["model-value","placeholder"])])],64)):x("",!0)]),o("div",zge,[n(M,{size:"small",type:"primary",onClick:D},{default:d(()=>[R(m(F.$t("Done")),1)]),_:1})])])]),_:1},8,["visible","disabled"])]),_:1},8,["content","disabled"])}}},qge={key:0,class:"flex items-center"},Yge={key:1,class:"text-gray-300 text-sm flex justify-center"},Zo={__name:"BulkPaymentTypeCell",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change","payment-type-change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i;return(i=a.variant)==null?void 0:i.other_info};return(i,c)=>{const p=C("el-option"),f=C("el-select");return e.variant&&s()?(r(),h("div",qge,[n(f,{modelValue:e.variant.other_info.payment_type,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.payment_type=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("payment-type-change",e.variant))},{default:d(()=>[n(p,{label:i.$t("One Time"),value:"onetime"},null,8,["label"]),n(p,{label:i.$t("Subscription"),value:"subscription"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"]),n(jge,{variant:e.variant,disabled:e.disabled,onChanged:c[2]||(c[2]=_=>l("change"))},null,8,["variant","disabled"])])):(r(),h("span",Yge,"—"))}}},Wge={key:1,class:"text-gray-300 text-sm flex justify-center"},ei={__name:"BulkIntervalSelect",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=C("el-option"),f=C("el-select");return e.variant&&s()?(r(),E(f,{key:0,modelValue:e.variant.other_info.repeat_interval,"onUpdate:modelValue":c[0]||(c[0]=_=>e.variant.other_info.repeat_interval=_),size:"small",class:de({"is-field-error":e.hasError}),disabled:e.disabled,onChange:c[1]||(c[1]=_=>l("change"))},{default:d(()=>[n(p,{label:i.$t("Yearly"),value:"yearly"},null,8,["label"]),n(p,{label:i.$t("Half Yearly"),value:"half_yearly"},null,8,["label"]),n(p,{label:i.$t("Quarterly"),value:"quarterly"},null,8,["label"]),n(p,{label:i.$t("Monthly"),value:"monthly"},null,8,["label"]),n(p,{label:i.$t("Weekly"),value:"weekly"},null,8,["label"]),n(p,{label:i.$t("Daily"),value:"daily"},null,8,["label"])]),_:1},8,["modelValue","class","disabled"])):(r(),h("span",Wge,"—"))}}},Jge={key:1,class:"text-gray-300 text-sm flex justify-center"},ti={__name:"BulkTrialDaysInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=e,l=t,s=()=>{var i,c;return((c=(i=a.variant)==null?void 0:i.other_info)==null?void 0:c.payment_type)==="subscription"};return(i,c)=>{const p=C("el-input");return e.variant&&s()?(r(),E(p,{key:0,class:de(["fct-bulk-input",{"is-error":e.hasError}]),modelValue:e.variant.other_info.trial_days,"onUpdate:modelValue":c[0]||(c[0]=f=>e.variant.other_info.trial_days=f),placeholder:"0",disabled:e.disabled,onChange:c[1]||(c[1]=f=>l("change")),size:"small"},null,8,["class","modelValue","disabled"])):(r(),h("span",Jge,"—"))}}},Xge={key:1,class:"text-gray-300 text-sm flex justify-center"},ai={__name:"BulkComparePriceInput",props:{variant:{type:Object,default:null},disabled:{type:Boolean,default:!1},hasError:{type:Boolean,default:!1}},emits:["change"],setup(e,{emit:t}){const a=t;return(l,s)=>e.variant?(r(),E(Za,{key:0,size:"small","error-class":e.hasError?"is-error":"","model-value":e.variant.compare_price,placeholder:l.$t("Compare price"),disabled:e.disabled,"onUpdate:modelValue":s[0]||(s[0]=i=>{e.variant.compare_price=i,a("change")})},null,8,["error-class","model-value","placeholder","disabled"])):(r(),h("span",Xge,"—"))}},xf={__name:"BulkCategorySelect",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,default:()=>[]},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(e,{emit:t}){const a=t,l=s=>{a("update:modelValue",s),a("change",s)};return(s,i)=>{const c=C("el-option"),p=C("el-select");return r(),E(p,{"model-value":e.modelValue,multiple:"",filterable:"","allow-create":"","default-first-option":"","collapse-tags":"","collapse-tags-tooltip":!1,"max-collapse-tags":1,size:"small",placeholder:s.$t("Select or type..."),disabled:e.disabled,"onUpdate:modelValue":l},{default:d(()=>[(r(!0),h(P,null,te(e.options,f=>(r(),E(c,{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","disabled"])}}},Zge=["textContent"],eye={key:1,class:"fct-bulk-editor-placeholder"},li={__name:"BulkEditorCell",props:{value:{type:String,default:""},placeholder:{type:String,default:""}},emits:["click"],setup(e){return(t,a)=>(r(),h("div",{class:"fct-bulk-editor",onClick:a[0]||(a[0]=l=>t.$emit("click"))},[e.value?(r(),h("span",{key:0,class:"bulk-editor-preview",textContent:m(e.value)},null,8,Zge)):(r(),h("span",eye,m(e.placeholder),1))]))}};function Sf(){const e=T(new Set),t=T(null),a=T(!1),l=(y,v,w)=>{if(v.shiftKey&&t.value!==null){const b=w.indexOf(t.value),S=w.indexOf(y);if(b!==-1&&S!==-1){const $=Math.min(b,S),D=Math.max(b,S),F=new Set(e.value);for(let B=$;B<=D;B++)F.add(w[B]);e.value=F}}else{const b=new Set(e.value);b.has(y)?b.delete(y):b.add(y),e.value=b,t.value=y}},s=y=>{e.value.size===y.length&&y.length>0?e.value=new Set:e.value=new Set(y)},i=y=>{e.value=new Set(y)},c=()=>{e.value=new Set,t.value=null,a.value=!1},p=()=>{a.value?a.value=!1:e.value.size>=2&&(a.value=!0)};be(e,y=>{a.value&&y.size<2&&(a.value=!1)});const f=y=>e.value.has(y),_=K(()=>e.value.size);return{selectedKeys:e,lastClickedKey:t,isLinkMode:a,handleRowClick:l,toggleSelectAll:s,selectAll:i,deselectAll:c,toggleLinkMode:p,isSelected:f,selectedCount:_,pruneStaleKeys:y=>{const v=new Set(y);let w=!1;const k=new Set;for(const b of e.value)v.has(b)?k.add(b):w=!0;w&&(e.value=k),t.value&&!v.has(t.value)&&(t.value=null)}}}const tye={mounted(e,t){e.indeterminate=!!t.value},updated(e,t){e.indeterminate=!!t.value}},Ff={title:{product:{get:e=>e.post_title,set:(e,t)=>e.post_title=t},variant:{get:e=>e.variation_title,set:(e,t)=>e.variation_title=t}},sku:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.sku},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].sku=t)}},variant:{get:e=>e.sku,set:(e,t)=>e.sku=t}},status:{product:{get:e=>e.post_status,set:(e,t)=>e.post_status=t}},description:{product:{get:e=>e.post_content,set:(e,t)=>e.post_content=t}},short_desc:{product:{get:e=>e.post_excerpt,set:(e,t)=>e.post_excerpt=t}},product_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.fulfillment_type},set:(e,t)=>{e.detail&&(e.detail.fulfillment_type=t)}}},pricing_type:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.variation_type},set:(e,t)=>{e.detail&&(e.detail.variation_type=t)}}},payment_type:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.payment_type},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.payment_type=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.payment_type},set:(e,t)=>{e.other_info&&(e.other_info.payment_type=t)}}},interval:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.repeat_interval},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.repeat_interval=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.repeat_interval},set:(e,t)=>{e.other_info&&(e.other_info.repeat_interval=t)}}},trial_days:{product:{get:e=>{var t,a,l;return(l=(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.other_info)==null?void 0:l.trial_days},set:(e,t)=>{var a,l;(l=(a=e.variants)==null?void 0:a[0])!=null&&l.other_info&&(e.variants[0].other_info.trial_days=t)}},variant:{get:e=>{var t;return(t=e.other_info)==null?void 0:t.trial_days},set:(e,t)=>{e.other_info&&(e.other_info.trial_days=t)}}},price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.item_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].item_price=t)}},variant:{get:e=>e.item_price,set:(e,t)=>e.item_price=t}},compare_price:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.compare_price},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].compare_price=t)}},variant:{get:e=>e.compare_price,set:(e,t)=>e.compare_price=t}},manage_stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.manage_stock},set:(e,t)=>{e.detail&&(e.detail.manage_stock=t)}}},categories:{product:{get:e=>e.categories,set:(e,t)=>e.categories=[...t]}}},aye={...Ff,stock:{product:{get:e=>{var t;return(t=e.detail)==null?void 0:t.total_stock},set:(e,t)=>{e.detail&&(e.detail.total_stock=t)}},variant:{get:e=>e.total_stock,set:(e,t)=>e.total_stock=t}}},lye={...Ff,stock:{product:{get:e=>{var t,a;return(a=(t=e.variants)==null?void 0:t[0])==null?void 0:a.available},set:(e,t)=>{var a;(a=e.variants)!=null&&a[0]&&(e.variants[0].available=t)}},variant:{get:e=>e.available,set:(e,t)=>e.available=t}}};function $f(e,t,a,l,s,i,c){const p=c[e];if(p)for(const f of l){if(f===a)continue;const _=s(f);if(!_)continue;const g=p[_.type];g&&(g.set(_.data,t),i&&i(_.product))}}const sye={class:"fct-bulk-insert-page fct-layout-width"},nye={class:"fct-btn-group sm justify-end"},oye={class:"filter-popover-item"},iye={class:"filter-popover-title"},rye={key:0,"aria-hidden":"true"},dye=["colspan"],uye=["onClick"],cye=["onClick"],Aye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},pye={class:"flex items-center"},fye=["onClick","title"],mye={key:0,class:"bulk-collapse-count"},hye=["title"],_ye=["title"],vye={class:"bulk-status-icon is-error"},gye={key:0,class:"fct-bulk-sku-cell"},yye={key:1,class:"text-gray-300 text-sm flex justify-center"},bye={key:1,class:"fct-bulk-media-cell"},wye={key:2,class:"fct-bulk-categories-cell"},Cye={key:3,class:"fct-bulk-desc-cell"},kye={key:4,class:"fct-bulk-short-desc-cell"},Bye={key:5,class:"fct-bulk-status-cell"},xye={key:6,class:"fct-bulk-product-type-cell"},Sye={key:7,class:"fct-bulk-product-type-cell"},Fye={key:8,class:"fct-bulk-pricing-type-cell"},$ye={key:9,class:"fct-bulk-pricing-type-cell"},Eye={key:10,class:"fct-bulk-payment-type-cell"},Uye={key:11,class:"fct-bulk-interval-cell"},Iye={key:12,class:"fct-bulk-trial-days-cell"},Qye={key:13,class:"fct-bulk-best-price-cell"},Dye={key:14,class:"fct-bulk-compare-price-cell"},Vye={key:15,class:"fct-bulk-qty-cell !pl-5"},Tye={key:16,class:"fct-bulk-stock-cell"},Mye={key:1,class:"text-gray-300 text-sm pl-5"},Lye={class:"fct-btn-group xs justify-end"},Rye=["href","title"],Oye={key:0,class:"bulk-variants-block-row"},Pye=["colspan"],Hye={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},Nye=["onClick"],Kye={class:"bulk-checkbox-cell"},Gye={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},zye={class:"flex items-center gap-1 pl-4"},jye={class:"bulk-status-icon is-error"},qye={key:0,class:"fct-bulk-sku-cell"},Yye={key:1,class:"fct-bulk-media-cell"},Wye={key:2},Jye={key:3},Xye={key:4},Zye={key:5},e1e={key:6},t1e={key:7},a1e={key:8},l1e={key:9},s1e={key:10},n1e={key:11},o1e={key:12},i1e={key:13,class:"text-center"},r1e={key:14},d1e={key:1,class:"text-gray-300 text-sm flex justify-center"},u1e={class:"fct-btn-group sm justify-end"},c1e={class:"bulk-add-variant-row"},A1e=["colspan"],p1e={class:"sticky left-0 inline-block pl-6"},f1e={key:1,"aria-hidden":"true"},m1e=["colspan"],ur=43,h1e=10,_1e=800,Uc=100,v1e={__name:"BulkInsert",setup(e){const{options:t,products:a}=Ft.data,l=ge=>{var Fe;return((Fe=ge==null?void 0:ge.detail)==null?void 0:Fe.variation_type)==="simple"},s=K(()=>Ft.data.saving),i=K(()=>Ft.data.saveProgress),c=K(()=>{const ge=Ft.data.saveProgress;return ge.total?Math.round(ge.completed/ge.total*100):0}),p=()=>{Ft.saveProducts()},f=ge=>Ft.isSaving(ge._cid),_=ge=>Ft.isSaved(ge._cid),g=ge=>Ft.isRowDisabled(ge._cid),y=ge=>Ft.hasError(ge._cid),v=ge=>Ft.getError(ge._cid),w=ge=>Ft.hasProductLevelError(ge._cid),k=(ge,Fe)=>Ft.hasVariantError(ge._cid,Fe),b=(ge,Fe)=>Ft.getVariantError(ge._cid,Fe),S=(ge,Fe)=>Ft.hasFieldError(ge._cid,Fe),$=(ge,Fe,ot)=>Ft.hasVariantFieldError(ge._cid,Fe,ot),D=async ge=>{const Fe=ge.post_title||H.$t("Untitled product"),ot=Array.isArray(ge.variants)?ge.variants.length:0,wt=Ft.isSaved(ge._cid);let kt=ot>0?H.$t('This will remove "%1$s" and its %2$s variant(s).',Fe,ot):H.$t('This will remove "%1$s".',Fe);wt&&(kt+=" "+H.$t("This product was already saved and will be permanently deleted."));try{await Fl.confirm(kt,H.$t("Remove Product"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}await Ft.removeProduct(ge)},F=(ge,Fe)=>{const ot=Fe.variation_title||H.$t("Untitled variant");Fl.confirm(H.$t('This will remove the variant "%1$s".',ot),H.$t("Remove Variant"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),confirmButtonClass:"el-button--small",cancelButtonClass:"el-button--small",type:"warning"}).then(()=>{Ft.removeVariant(ge,Fe)}).catch(()=>{})},B=ge=>Ft.duplicateProduct(ge),U=(ge,Fe)=>Ft.duplicateVariant(ge,Fe),Q=()=>{const ge=[];for(const Fe of a){const ot=`p:${Fe._cid}`,wt=ue.value.has(ot),kt=[];Fe.variants&&Fe.variants.forEach((Xt,vt)=>{ue.value.has(`v:${Fe._cid}:${vt}`)&&kt.push(vt)}),!(!wt&&kt.length===0)&&(wt&&kt.length===0?ge.push({product:Fe,type:"full"}):!wt&&kt.length>0?ge.push({product:Fe,type:"variants-only",variantIndexes:kt}):ge.push({product:Fe,type:"partial",variantIndexes:kt}))}return ge},V=()=>{const ge=Q();if(!ge.length)return;const Fe=ge.filter(vt=>vt.type==="full").length,ot=ge.filter(vt=>vt.type==="partial").length,kt=ge.filter(vt=>vt.type==="variants-only").reduce((vt,ea)=>vt+ea.variantIndexes.length,0),Xt=[];Fe>0&&Xt.push(`${Fe} product(s) with all variants`),ot>0&&Xt.push(`${ot} product(s) with selected variants`),kt>0&&Xt.push(`${kt} variant(s)`),Fl.confirm(H.$t("Duplicate %s?").replace("%s",Xt.join(", ")),H.$t("Bulk Duplicate"),{confirmButtonText:H.$t("Duplicate"),cancelButtonText:H.$t("Cancel"),type:"info"}).then(()=>{for(const vt of ge)if(vt.type==="full")Ft.duplicateProduct(vt.product);else if(vt.type==="variants-only")for(const ea of vt.variantIndexes){const ta=vt.product.variants[ea];ta&&Ft.duplicateVariant(vt.product,ta)}else vt.type==="partial"&&Ft.duplicateProductWithVariants(vt.product,vt.variantIndexes);ae()}).catch(()=>{})},I=async()=>{const ge=[],Fe=[];for(const vt of a){const ea=`p:${vt._cid}`;if(ue.value.has(ea)){ge.push(vt);continue}const zt=[];vt.variants&&vt.variants.forEach((wa,qa)=>{ue.value.has(`v:${vt._cid}:${qa}`)&&zt.push(wa)}),zt.length>0&&Fe.push({product:vt,variants:zt})}if(!ge.length&&!Fe.length)return;const ot=ge.filter(vt=>Ft.isSaved(vt._cid)).length,wt=Fe.reduce((vt,ea)=>vt+ea.variants.length,0),kt=[];ge.length>0&&kt.push(`${ge.length} product(s)`),wt>0&&kt.push(`${wt} variant(s)`);let Xt=H.$t("Remove %s?").replace("%s",kt.join(" and "));ot>0&&(Xt+=" "+H.$t("%s already saved will be permanently deleted.").replace("%s",`${ot}`));try{await Fl.confirm(Xt,H.$t("Bulk Remove"),{confirmButtonText:H.$t("Remove"),cancelButtonText:H.$t("Cancel"),type:"warning"})}catch{return}for(const vt of ge)await Ft.removeProduct(vt);for(const{product:vt,variants:ea}of Fe)for(const ta of ea)Ft.removeVariant(vt,ta);ae()},M=ge=>{Ft.resetPaymentTypeDefaults(ge)},O=(ge,Fe)=>{const ot=Ft.data.categoryOptions;for(const wt of Fe)ot.find(kt=>kt.value===wt)||ot.push({label:wt,value:wt})},L=()=>{Ft.populateDummyProduct()},H=Jt().ctx,j=ge=>{const Fe=Ft.data.products;ge.concat||(Fe.splice(0,Fe.length),Ft.data.savedIds=new Set,Ft.data.savingIds=new Set,Ft.data.productErrors=new Map),Fe.push(...ge.products)},W=T({visible:!1,field:"",product:null,value:""}),G=(ge,Fe)=>{W.value={visible:!0,field:Fe,product:ge,value:ge[Fe]||""}},Z=ge=>{W.value.value=ge},ne=()=>{const{product:ge,field:Fe,value:ot}=W.value;ge&&(ge[Fe]=ot),W.value.visible=!1},ce=K(()=>W.value.field==="post_content"?H.$t("Edit Description"):H.$t("Edit Short Description")),z=T(!0),{selectedKeys:ue,handleRowClick:ie,toggleSelectAll:J,selectAll:N,deselectAll:ae,isSelected:oe,selectedCount:fe,isLinkMode:re,toggleLinkMode:Ee}=Sf(),ye=K(()=>{const ge=[];for(const Fe of _t.value)if(ge.push(`p:${Fe.productId}`),Fe.hasVariants&&!Fe.collapsed)for(let ot=0;ot<Fe.product.variants.length;ot++)ge.push(`v:${Fe.productId}:${ot}`);return ge}),Ce=ge=>{var Fe;if(ge.startsWith("p:")){const ot=ge.slice(2),wt=a.find(kt=>kt._cid===ot);return wt?{type:"product",data:wt,product:wt}:null}else if(ge.startsWith("v:")){const ot=ge.split(":"),wt=ot[1],kt=parseInt(ot[2]),Xt=a.find(vt=>vt._cid===wt);if(Xt&&((Fe=Xt.variants)!=null&&Fe[kt]))return{type:"variant",data:Xt.variants[kt],product:Xt}}return null},ve=(ge,Fe,ot)=>{!re.value||!oe(ot)||$f(ge,Fe,ot,ue.value,Ce,null,aye)},Ue=T(!1),Ke=ge=>{ge.key==="Shift"&&(Ue.value=!0)},We=ge=>{ge.key==="Shift"&&(Ue.value=!1)},Be=(ge,Fe)=>{if(!Fe.shiftKey||Fe.target.closest(".bulk-checkbox-cell"))return;Fe.preventDefault();const ot=new Set(ue.value);ot.has(ge)?ot.delete(ge):ot.add(ge),ue.value=ot},$e=T([]),He=K(()=>$e.value.filter(ge=>ge.key==="title"||ge.key==="actions"?!0:Ft.isColumnVisible(ge.key))),Re=ge=>Ft.isColumnVisible(ge),yt=()=>{Ft.saveColumnWidths($e.value)},gt=T(new Set),Rt=ge=>{const Fe=ge._cid;gt.value.has(Fe)?gt.value.delete(Fe):gt.value.add(Fe),gt.value=new Set(gt.value)},Tt=ge=>gt.value.has(ge._cid),Dt=T(0),_t=K(()=>{let ge=0;return a.map(Fe=>{var zt;const ot=Fe._cid,wt=((zt=Fe.detail)==null?void 0:zt.variation_type)!=="simple"&&Array.isArray(Fe.variants),kt=wt?Fe.variants.length:0,Xt=gt.value.has(ot),vt=wt&&!Xt?(kt+1)*ur:0,ea=ur+vt,ta={product:Fe,productId:ot,hasVariants:wt,variantCount:kt,collapsed:Xt,groupHeight:ea,offset:ge};return ge+=ea,ta})}),Gt=K(()=>{const ge=_t.value;if(ge.length===0)return 0;const Fe=ge[ge.length-1];return Fe.offset+Fe.groupHeight}),bt=K(()=>{const ge=_t.value,Fe=Dt.value,ot=Fe+_1e,wt=h1e*ur;return ge.filter(kt=>kt.offset+kt.groupHeight>=Fe-wt&&kt.offset<=ot+wt)}),St=K(()=>bt.value.length===0?0:bt.value[0].offset),Pt=K(()=>{if(bt.value.length===0)return 0;const ge=bt.value[bt.value.length-1];return Gt.value-ge.offset-ge.groupHeight});let Ht=null,Qt=0;const ht=ge=>{const Fe=ge.target,ot=Date.now();Ht&&clearTimeout(Ht),ot-Qt>=Uc?(Dt.value=Fe.scrollTop,Qt=ot):Ht=setTimeout(()=>{Dt.value=Fe.scrollTop,Qt=Date.now(),Ht=null},Uc)};let qt=null;return Ie(async()=>{qt=bs(),qt.bind("mod+a",ge=>{var ot,wt;const Fe=(ot=document.activeElement)==null?void 0:ot.tagName;Fe==="INPUT"||Fe==="TEXTAREA"||(wt=document.activeElement)!=null&&wt.isContentEditable||(ge.preventDefault(),N(ye.value))}),qt.bind("escape",()=>{var Fe,ot;const ge=(Fe=document.activeElement)==null?void 0:Fe.tagName;ge==="INPUT"||ge==="TEXTAREA"||(ot=document.activeElement)!=null&&ot.isContentEditable||(re.value?Ee():ae())}),$e.value=[{key:"title",title:H.$t("Title"),width:150,minWidth:100},{key:"sku",title:H.$t("SKU"),width:120,minWidth:80},{key:"media",title:H.$t("Media"),width:100,minWidth:50},{key:"categories",title:H.$t("Categories"),width:200,minWidth:150},{key:"description",title:H.$t("Description"),width:200,minWidth:150},{key:"short_description",title:H.$t("Short Description"),width:150,minWidth:100},{key:"status",title:H.$t("Status"),width:100,minWidth:50},{key:"product_type",title:H.$t("Product Type"),width:200,minWidth:150},{key:"pricing_type",title:H.$t("Pricing Type"),width:200,minWidth:150},{key:"payment_type",title:H.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:H.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:H.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:H.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:H.$t("Compare-at Price"),width:200,minWidth:150},{key:"track_quantity",title:H.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:H.$t("Stock"),width:150,minWidth:150},{key:"actions",title:"",width:110,minWidth:110}],Ft.restoreColumnWidths($e.value),Ft.setupColumnVisibility(),Ft.fetchCategories(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",Ke),window.addEventListener("keyup",We)}),cl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",Ke),window.removeEventListener("keyup",We),qt&&qt.reset()}),(ge,Fe)=>{const ot=C("el-button"),wt=C("el-progress"),kt=C("el-checkbox"),Xt=C("el-checkbox-group"),vt=C("el-tooltip"),ea=C("el-popover"),ta=C("el-input"),zt=C("el-icon"),wa=C("el-option"),qa=C("el-select"),il=C("el-switch"),Ya=C("el-dialog");return r(),h("div",sye,[n(ol,{title:ge.$t("Bulk Insert")},{action:d(()=>[n(bge,{onOnDataPopulated:j}),n(ot,{onClick:L},{default:d(()=>[R(m(ge.$t("Add Product")),1)]),_:1}),n(ot,{type:"primary",onClick:p,loading:s.value,disabled:s.value||A(a).length===0},{default:d(()=>[R(m(s.value?ge.$t("Saving %s/%s...").replace("%s",i.value.completed).replace("%s",i.value.total):ge.$t("Save All Products")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),s.value?(r(),E(wt,{key:0,percentage:c.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),n(Se,null,{default:d(()=>{var ma;return[A(a).length>0?(r(),E(Ve,{key:0,title:((ma=A(a))==null?void 0:ma.length)===1?ge.$t("Product"):ge.$t("Products"),border_bottom:""},{action:d(()=>[o("div",nye,[n(ot,{disabled:A(fe)===0,onClick:I,size:"small",type:"danger",soft:""},{default:d(()=>[Fe[8]||(Fe[8]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+m(ge.$t("Delete")),1)]),_:1,__:[8]},8,["disabled"]),n(ot,{disabled:A(fe)===0,onClick:V,size:"small",type:"info",soft:""},{default:d(()=>[Fe[9]||(Fe[9]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+m(ge.$t("Duplicate")),1)]),_:1,__:[9]},8,["disabled"]),n(ot,{class:de({"is-active":A(re)}),disabled:A(fe)<2&&!A(re),onClick:A(Ee),size:"small",type:"info",soft:""},{default:d(()=>[Fe[10]||(Fe[10]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+m(A(re)?ge.$t("Unlink"):ge.$t("Link")),1)]),_:1,__:[10]},8,["class","disabled","onClick"]),n(kt,{modelValue:z.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=X=>z.value=X),label:ge.$t("Pin Actions")},null,8,["modelValue","label"]),n(ea,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(vt,{effect:"light",content:ge.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button",size:"small"},{default:d(()=>[n(Y,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",oye,[o("h3",iye,m(ge.$t("Columns")),1),n(Xt,{modelValue:A(Ft).data.visibleColumns,"onUpdate:modelValue":Fe[1]||(Fe[1]=X=>A(Ft).data.visibleColumns=X),class:"fct-checkbox-blocks",onChange:Fe[2]||(Fe[2]=X=>A(Ft).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(P,null,te(A(Ft).getToggleableColumns(),X=>(r(),E(kt,{key:X.value,value:X.value,label:ge.$t(X.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])]),_:1},8,["title"])):x("",!0),n(ke,{class:"p-0"},{default:d(()=>[A(a).length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(re),"is-shift-held":Ue.value}])},[n(Bf,{columns:He.value,"sticky-last":z.value,onScroll:ht,onResizeEnd:yt},{"header-first":d(()=>[n(kt,{"model-value":A(fe)>0&&A(fe)===ye.value.length,indeterminate:A(fe)>0&&A(fe)<ye.value.length,onChange:Fe[3]||(Fe[3]=X=>A(J)(ye.value))},null,8,["model-value","indeterminate"])]),"header-last":d(()=>[R(m(ge.$t("Actions")),1)]),default:d(()=>[St.value>0?(r(),h("tr",rye,[o("td",{colspan:He.value.length+1,style:ra({height:St.value+"px",padding:0,border:"none"})},null,12,dye)])):x("",!0),(r(!0),h(P,null,te(bt.value,X=>{var we,le,he,Ye,st,je,Xe,mt,et,It,pe,_e,Oe,Me,ct;return r(),h(P,{key:X.productId},[o("tr",{class:de(["bulk-product-row",{"is-saving":f(X.product),"is-saved":_(X.product),"has-product-error":y(X.product),"is-selected":A(oe)(`p:${X.productId}`)}]),onClick:ee=>Be(`p:${X.productId}`,ee)},[o("td",{class:"bulk-checkbox-cell",onClick:ee=>A(ie)(`p:${X.productId}`,ee,ye.value)},[n(kt,{"model-value":A(oe)(`p:${X.productId}`),tabindex:"-1"},null,8,["model-value"])],8,cye),o("td",Aye,[o("div",pye,[X.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(ee=>Rt(X.product),["prevent"]),title:Tt(X.product)?ge.$t("Expand variants"):ge.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":Tt(X.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},Fe[11]||(Fe[11]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),Tt(X.product)?(r(),h("span",mye,m(X.variantCount),1)):x("",!0)],8,fye)):x("",!0),n(ta,{class:de(["fct-bulk-input",{"is-error":S(X.product,"post_title")}]),modelValue:X.product.post_title,"onUpdate:modelValue":ee=>X.product.post_title=ee,placeholder:ge.$t("Product title"),size:"small",disabled:g(X.product),onInput:ee=>ve("title",ee,`p:${X.productId}`)},null,8,["class","modelValue","onUpdate:modelValue","placeholder","disabled","onInput"]),f(X.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:ge.$t("Saving...")},[n(zt,{class:"is-loading",size:14},{default:d(()=>[n(A(en))]),_:1})],8,hye)):_(X.product)?(r(),h("span",{key:2,class:"bulk-status-icon is-saved",title:ge.$t("Saved")},Fe[12]||(Fe[12]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"16",height:"16"},[o("path",{d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-.997-6l7.07-7.071-1.414-1.414-5.656 5.657-2.829-2.829-1.414 1.414L11.003 16z"})],-1)]),8,_ye)):w(X.product)||l(X.product)&&y(X.product)?(r(),E(vt,{key:3,content:v(X.product),placement:"top"},{default:d(()=>[o("span",vye,[n(zt,{size:16},{default:d(()=>[n(A(Vo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Re("sku")?(r(),h("td",gye,[((le=(we=X.product)==null?void 0:we.detail)==null?void 0:le.variation_type)==="simple"&&((he=X.product.variants)!=null&&he[0])?(r(),E(ta,{key:0,class:de(["fct-bulk-input",{"is-error":S(X.product,"variants.0.sku")}]),modelValue:X.product.variants[0].sku,"onUpdate:modelValue":[ee=>X.product.variants[0].sku=ee,ee=>ve("sku",ee,`p:${X.productId}`)],placeholder:"SKU",size:"small",disabled:g(X.product)},null,8,["class","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",yye,"—"))])):x("",!0),Re("media")?(r(),h("td",bye,[n(yl,{modelValue:X.product.gallery,"onUpdate:modelValue":ee=>X.product.gallery=ee,"show-url-tab":"",disabled:g(X.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Re("categories")?(r(),h("td",wye,[n(xf,{modelValue:X.product.categories,"onUpdate:modelValue":ee=>X.product.categories=ee,options:A(Ft).data.categoryOptions,disabled:g(X.product),onChange:ee=>{O(X.product,ee),ve("categories",X.product.categories,`p:${X.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),Re("description")?(r(),h("td",Cye,[n(li,{value:X.product.post_content,placeholder:ge.$t("Description"),onClick:ee=>G(X.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),Re("short_description")?(r(),h("td",kye,[n(li,{value:X.product.post_excerpt,placeholder:ge.$t("Short description"),onClick:ee=>G(X.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),Re("status")?(r(),h("td",Bye,[n(qa,{modelValue:X.product.post_status,"onUpdate:modelValue":ee=>X.product.post_status=ee,size:"small",class:de({"is-field-error":S(X.product,"post_status")}),disabled:g(X.product),onChange:ee=>ve("status",X.product.post_status,`p:${X.productId}`)},{default:d(()=>[(r(!0),h(P,null,te(A(t).status,ee=>(r(),E(wa,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),Re("product_type")&&((Ye=X.product)!=null&&Ye.detail)?(r(),h("td",xye,[n(qa,{modelValue:X.product.detail.fulfillment_type,"onUpdate:modelValue":ee=>X.product.detail.fulfillment_type=ee,size:"small",class:de({"is-field-error":S(X.product,"detail.fulfillment_type")}),disabled:g(X.product),onChange:ee=>ve("product_type",X.product.detail.fulfillment_type,`p:${X.productId}`)},{default:d(()=>[(r(!0),h(P,null,te(A(t).fulfilment,ee=>(r(),E(wa,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Re("product_type")?(r(),h("td",Sye)):x("",!0),Re("pricing_type")&&((st=X.product)!=null&&st.detail)?(r(),h("td",Fye,[n(qa,{modelValue:X.product.detail.variation_type,"onUpdate:modelValue":ee=>X.product.detail.variation_type=ee,size:"small",class:de({"is-field-error":S(X.product,"detail.variation_type")}),disabled:g(X.product),onChange:ee=>{A(Ft).handleVariationChanged(X.product,ee),ve("pricing_type",ee,`p:${X.productId}`)}},{default:d(()=>[(r(!0),h(P,null,te(A(t).variation,ee=>(r(),E(wa,{key:ee.value,label:ge.$t(ee.title),value:ee.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):Re("pricing_type")?(r(),h("td",$ye)):x("",!0),Re("payment_type")?(r(),h("td",Eye,[n(Zo,{variant:l(X.product)?(je=X.product.variants)==null?void 0:je[0]:null,disabled:g(X.product),"has-error":S(X.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:ee=>{var Ne;M(ee),ve("payment_type",(Ne=ee.other_info)==null?void 0:Ne.payment_type,`p:${X.productId}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Re("interval")?(r(),h("td",Uye,[n(ei,{variant:l(X.product)?(Xe=X.product.variants)==null?void 0:Xe[0]:null,disabled:g(X.product),"has-error":S(X.product,"variants.0.other_info.repeat_interval"),onChange:ee=>{var Ne,pt,De;return ve("interval",(De=(pt=(Ne=X.product.variants)==null?void 0:Ne[0])==null?void 0:pt.other_info)==null?void 0:De.repeat_interval,`p:${X.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("trial_days")?(r(),h("td",Iye,[n(ti,{variant:l(X.product)?(mt=X.product.variants)==null?void 0:mt[0]:null,disabled:g(X.product),"has-error":S(X.product,"variants.0.other_info.trial_days"),onChange:ee=>{var Ne,pt,De;return ve("trial_days",(De=(pt=(Ne=X.product.variants)==null?void 0:Ne[0])==null?void 0:pt.other_info)==null?void 0:De.trial_days,`p:${X.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("best_price")?(r(),h("td",Qye,[n(Xo,{variant:l(X.product)?(et=X.product.variants)==null?void 0:et[0]:null,disabled:g(X.product),"has-error":S(X.product,"variants.0.item_price"),onChange:ee=>{var Ne,pt;return ve("price",(pt=(Ne=X.product.variants)==null?void 0:Ne[0])==null?void 0:pt.item_price,`p:${X.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("compare_price")?(r(),h("td",Dye,[n(ai,{variant:l(X.product)?(It=X.product.variants)==null?void 0:It[0]:null,disabled:g(X.product),"has-error":S(X.product,"variants.0.compare_price"),onChange:ee=>{var Ne,pt;return ve("compare_price",(pt=(Ne=X.product.variants)==null?void 0:Ne[0])==null?void 0:pt.compare_price,`p:${X.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("track_quantity")?(r(),h("td",Vye,[(pe=X.product)!=null&&pe.detail?(r(),E(il,{key:0,modelValue:X.product.detail.manage_stock,"onUpdate:modelValue":ee=>X.product.detail.manage_stock=ee,"active-value":"1","inactive-value":"0",disabled:g(X.product),onChange:ee=>{A(Ft).syncStockStatus(X.product),ve("manage_stock",X.product.detail.manage_stock,`p:${X.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),Re("stock")?(r(),h("td",Tye,[((Oe=(_e=X.product)==null?void 0:_e.detail)==null?void 0:Oe.manage_stock)==="1"&&((ct=(Me=X.product)==null?void 0:Me.detail)==null?void 0:ct.variation_type)==="simple"?(r(),E(ta,{key:0,modelValue:X.product.detail.total_stock,"onUpdate:modelValue":[ee=>X.product.detail.total_stock=ee,ee=>{var Ne;(Ne=X.product.variants)!=null&&Ne[0]&&(X.product.variants[0].total_stock=ee,X.product.variants[0].available=ee),A(Ft).syncStockStatus(X.product),ve("stock",ee,`p:${X.productId}`)}],disabled:g(X.product),size:"small",placeholder:ge.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",Mye,"—"))])):x("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":z.value}])},[o("div",Lye,[_(X.product)&&X.product.view_url?(r(),h("a",{key:0,href:X.product.view_url,target:"_blank",class:"bulk-action-btn bulk-view-link",title:ge.$t("View Product")},[n(Y,{name:"External"})],8,Rye)):x("",!0),n(at,{tag:"button",size:"x-small",onClick:Ge(ee=>B(X.product),["prevent"]),disabled:s.value||g(X.product),title:ge.$t("Duplicate")},{default:d(()=>[n(Y,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(at,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(ee=>D(X.product),["prevent"]),disabled:s.value||g(X.product),title:ge.$t("Delete")},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,uye),X.hasVariants?(r(),h("tr",Oye,[o("td",{colspan:He.value.length+1,class:"!p-0 !border-b-0"},[n(ya,{accordion:"",visible:!X.collapsed,duration:200},{default:d(()=>[o("table",Hye,[o("colgroup",null,[Fe[13]||(Fe[13]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,te(He.value,(ee,Ne)=>(r(),h("col",{key:Ne,style:ra({width:ee.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,te(X.product.variants,(ee,Ne)=>{var pt,De;return r(),h("tr",{key:Ne,class:de(["bulk-variation-row",{"is-selected":A(oe)(`v:${X.productId}:${Ne}`)}]),onClick:xt=>Be(`v:${X.productId}:${Ne}`,xt)},[o("td",Kye,[n(kt,{"model-value":A(oe)(`v:${X.productId}:${Ne}`),tabindex:"-1",onChange:xt=>A(ie)(`v:${X.productId}:${Ne}`,xt,ye.value)},null,8,["model-value","onChange"])]),o("td",Gye,[o("div",zye,[Fe[14]||(Fe[14]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(ta,{size:"small",modelValue:ee.variation_title,"onUpdate:modelValue":[xt=>ee.variation_title=xt,xt=>ve("title",xt,`v:${X.productId}:${Ne}`)],placeholder:ge.$t("Variation title"),disabled:g(X.product),class:de({"is-error":$(X.product,Ne,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),k(X.product,Ne)?(r(),E(vt,{key:0,content:b(X.product,Ne),placement:"top"},{default:d(()=>[o("span",jye,[n(zt,{size:14},{default:d(()=>[n(A(Vo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),Re("sku")?(r(),h("td",qye,[n(ta,{size:"small",modelValue:ee.sku,"onUpdate:modelValue":[xt=>ee.sku=xt,xt=>ve("sku",xt,`v:${X.productId}:${Ne}`)],placeholder:"SKU",disabled:g(X.product),class:de({"is-error":$(X.product,Ne,"sku")})},null,8,["modelValue","onUpdate:modelValue","disabled","class"])])):x("",!0),Re("media")?(r(),h("td",Yye,[n(yl,{modelValue:ee.media,"onUpdate:modelValue":xt=>ee.media=xt,"show-url-tab":"",disabled:g(X.product)},null,8,["modelValue","onUpdate:modelValue","disabled"])])):x("",!0),Re("categories")?(r(),h("td",Wye,Fe[15]||(Fe[15]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("description")?(r(),h("td",Jye,Fe[16]||(Fe[16]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("short_description")?(r(),h("td",Xye,Fe[17]||(Fe[17]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("status")?(r(),h("td",Zye,Fe[18]||(Fe[18]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("product_type")?(r(),h("td",e1e,Fe[19]||(Fe[19]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("pricing_type")?(r(),h("td",t1e,Fe[20]||(Fe[20]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("payment_type")?(r(),h("td",a1e,[n(Zo,{variant:ee,disabled:g(X.product),"has-error":$(X.product,Ne,"other_info.payment_type"),onPaymentTypeChange:xt=>{var Wa;M(xt),ve("payment_type",(Wa=xt.other_info)==null?void 0:Wa.payment_type,`v:${X.productId}:${Ne}`)}},null,8,["variant","disabled","has-error","onPaymentTypeChange"])])):x("",!0),Re("interval")?(r(),h("td",l1e,[n(ei,{variant:ee,disabled:g(X.product),"has-error":$(X.product,Ne,"other_info.repeat_interval"),onChange:xt=>{var Wa;return ve("interval",(Wa=ee.other_info)==null?void 0:Wa.repeat_interval,`v:${X.productId}:${Ne}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("trial_days")?(r(),h("td",s1e,[n(ti,{variant:ee,disabled:g(X.product),"has-error":$(X.product,Ne,"other_info.trial_days"),onChange:xt=>{var Wa;return ve("trial_days",(Wa=ee.other_info)==null?void 0:Wa.trial_days,`v:${X.productId}:${Ne}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("best_price")?(r(),h("td",n1e,[n(Xo,{variant:ee,disabled:g(X.product),"has-error":$(X.product,Ne,"item_price"),onChange:xt=>ve("price",ee.item_price,`v:${X.productId}:${Ne}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("compare_price")?(r(),h("td",o1e,[n(ai,{variant:ee,disabled:g(X.product),"has-error":$(X.product,Ne,"compare_price"),onChange:xt=>ve("compare_price",ee.compare_price,`v:${X.productId}:${Ne}`)},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),Re("track_quantity")?(r(),h("td",i1e,Fe[21]||(Fe[21]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),Re("stock")?(r(),h("td",r1e,[((De=(pt=X.product)==null?void 0:pt.detail)==null?void 0:De.manage_stock)==="1"?(r(),E(ta,{key:0,class:"fc-bulk-input",size:"small",modelValue:ee.total_stock,"onUpdate:modelValue":[xt=>ee.total_stock=xt,xt=>{ee.available=xt,A(Ft).syncStockStatus(X.product),ve("stock",xt,`v:${X.productId}:${Ne}`)}],disabled:g(X.product),placeholder:ge.$t("e.g 10")},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):(r(),h("span",d1e,"—"))])):x("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":z.value}])},[o("div",u1e,[n(at,{tag:"button",size:"x-small",onClick:Ge(xt=>U(X.product,ee),["prevent"]),disabled:s.value||g(X.product),title:ge.$t("Duplicate")},{default:d(()=>[n(Y,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(at,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(xt=>F(X.product,ee),["prevent"]),disabled:s.value||g(X.product),title:ge.$t("Delete")},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,Nye)}),128)),o("tr",c1e,[o("td",{colspan:He.value.length+1},[o("div",p1e,[n(ot,{size:"small",text:"",type:"primary",onClick:Ge(ee=>A(Ft).addVariationToProduct(X.product),["prevent"])},{default:d(()=>[R(" + "+m(ge.$t("Add Variant")),1)]),_:2},1032,["onClick"])])],8,A1e)])])])]),_:2},1032,["visible"])],8,Pye)])):x("",!0)],64)}),128)),Pt.value>0?(r(),h("tr",f1e,[o("td",{colspan:He.value.length+1,style:ra({height:Pt.value+"px",padding:0,border:"none"})},null,12,m1e)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):(r(),E(Ct,{key:1,icon:"Empty/ListView","has-dark":!0,text:A(u)("No products yet. Import a CSV or add products manually.")},null,8,["text"]))]),_:1})]}),_:1}),n(Ya,{modelValue:W.value.visible,"onUpdate:modelValue":Fe[6]||(Fe[6]=ma=>W.value.visible=ma),title:ce.value,width:"700px","close-on-click-modal":!1,onClosed:Fe[7]||(Fe[7]=ma=>W.value.product=null)},{footer:d(()=>[n(ot,{onClick:Fe[5]||(Fe[5]=ma=>W.value.visible=!1)},{default:d(()=>[R(m(ge.$t("Cancel")),1)]),_:1}),n(ot,{type:"primary",onClick:ne},{default:d(()=>[R(m(ge.$t("Save")),1)]),_:1})]),default:d(()=>[W.value.visible&&W.value.field==="post_content"?(r(),E(ls,{key:0,"model-value":W.value.value,height:300,onUpdate:Z},null,8,["model-value"])):x("",!0),W.value.visible&&W.value.field==="post_excerpt"?(r(),E(ta,{key:1,modelValue:W.value.value,"onUpdate:modelValue":Fe[4]||(Fe[4]=ma=>W.value.value=ma),type:"textarea",rows:6,placeholder:ge.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}};class g1e extends Dd{beforeInit(){this.data.products=[],this.data.dirty=new Set,this.data.loading=!1,this.data.saving=!1,this.data.pagination={page:1,per_page:5,total:0,hasMore:!1},this.data.saveProgress={total:0,completed:0,errors:[],updatedIds:[]},this.data.savingIds=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map,this.data.advanceFilters=[[]],this.data.filterType="simple",this.data.selectedView="all",this.data.searching=!1,this.data.search="",this.data.duplicatingIds=new Set,this.data.deletingIds=new Set,this.data.categoryOptions=[],this.data.constrainedProductIds="",this.data.constrainedVariantIds="",this.data.savedViews=[],this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null}getTabs(){return{all:u("All"),publish:u("Published"),draft:u("Draft"),physical:u("Physical"),digital:u("Digital")}}getTabsCount(){return Object.values(this.getTabs()).length}getSelectedTab(){return this.data.selectedView}handleTabChanged(t){t!==this.data.selectedView&&(this.data.selectedView=t,this.fetchProducts({},!1))}isSearching(){return this.data.searching!==!1}openSearch(){this.data.searching=!0}closeSearch(){this.data.searching=!1,this.data.search="",this.fetchProducts({},!1)}search(){this.fetchProducts({},!1)}useFullWidthSearch(){return!1}getSearchHint(){return u("Search by Id, product title or variation title")}getSearchGuideOptions(){return null}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}isUsingSimpleFilter(){return this.data.filterType==="simple"}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}getAdvanceFilterOptions(){var t,a,l;return((l=(a=(t=window.fluentCartAdminApp)==null?void 0:t.filter_options)==null?void 0:a.product_filter_options)==null?void 0:l.advance)||null}onFilterTypeChanged(t){t==="advanced"?(this.data.searching=!1,this.data.search=""):this.data.advanceFilters=[[]],this.fetchProducts({},!1)}applyAdvancedFilter(t=!1){this.fetchProducts({},!1)}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(t){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(t,1)}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.fetchProducts({},!1)}getColumnWidthStorageKey(){return"bulk_edit_column_widths"}getColumnStorageKey(){return"bulk_edit_columns"}getToggleableColumns(){return[{label:"Image",value:"image"},{label:"SKU",value:"sku"},{label:"Categories",value:"categories"},{label:"Description",value:"description"},{label:"Short Description",value:"short_description"},{label:"Status",value:"status"},{label:"Product Type",value:"product_type"},{label:"Pricing Type",value:"pricing_type"},{label:"Payment Type",value:"payment_type"},{label:"Interval",value:"interval"},{label:"Trial Days",value:"trial_days"},{label:"Best Price",value:"best_price"},{label:"Compare-at Price",value:"compare_price"},{label:"Track Quantity",value:"track_quantity"},{label:"Stock",value:"stock"}]}getSortableColumns(){return[]}markDirty(t){this._suppressDirty||(this.data.dirty.add(t),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.has(t)&&(this.data.savedIds.delete(t),this.data.savedIds=new Set(this.data.savedIds)),this.data.productErrors.has(t)&&(this.data.productErrors.delete(t),this.data.productErrors=new Map(this.data.productErrors)))}get dirtyCount(){return this.data.dirty.size}getDirtyProducts(){return this.data.products.filter(t=>this.data.dirty.has(t.ID))}chunkArray(t,a){const l=[];for(let s=0;s<t.length;s+=a)l.push(t.slice(s,s+a));return l}async fetchProducts(t={},a=!1,l="",s=""){var i;this.data.loading=!0;try{l&&(this.data.constrainedProductIds=l,this.data.constrainedVariantIds=s);const c=l||this.data.constrainedProductIds,p=s||this.data.constrainedVariantIds,f={per_page:this.data.pagination.per_page,page:a?this.data.pagination.page+1:1};c&&(f.product_ids=c,f.variant_ids=p),this.data.filterType==="advanced"?(f.advanced_filters=JSON.stringify(this.data.advanceFilters),f.filter_type="advanced"):(this.data.search&&(f.search=this.data.search),this.data.selectedView&&this.data.selectedView!=="all"&&(f.active_view=this.data.selectedView)),Object.assign(f,t);const _=await Ae.get("products/bulk-edit-data",f),g=_.products||[];this._suppressDirty=!0,a?this.data.products.push(...g):(this.data.products=g,this.data.dirty=new Set,this.data.savedIds=new Set,this.data.productErrors=new Map),xe(()=>{this._suppressDirty=!1}),this.data.pagination={page:_.page||f.page,per_page:_.per_page||f.per_page,total:_.total||0,hasMore:_.page*_.per_page<_.total}}catch(c){const p=((i=c==null?void 0:c.data)==null?void 0:i.message)||"Failed to fetch products";q.error(p)}finally{this.data.loading=!1}}isSavingProduct(t){return this.data.savingIds.has(t)}isDirty(t){return this.data.dirty.has(t)}isSaved(t){return this.data.savedIds.has(t)}isRowDisabled(t){return this.isSavingProduct(t)}isDuplicating(t){return this.data.duplicatingIds.has(t)}isDeleting(t){return this.data.deletingIds.has(t)}hasError(t){return this.data.productErrors.has(t)}getError(t){const a=this.data.productErrors.get(t);return a?a.fields&&Object.keys(a.fields).length?Object.values(a.fields).join("; "):a.message||"":""}hasProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?!!a.message:Object.keys(a.fields).some(l=>!l.startsWith("variants.")):!1}getProductLevelError(t){const a=this.data.productErrors.get(t);return a?!a.fields||!Object.keys(a.fields).length?a.message||"":Object.entries(a.fields).filter(([s])=>!s.startsWith("variants.")).map(([,s])=>s).join("; ")||"":""}hasVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return!1;const s=`variants.${a}.`;return Object.keys(l.fields).some(i=>i.startsWith(s))}getVariantError(t,a){const l=this.data.productErrors.get(t);if(!(l!=null&&l.fields))return"";const s=`variants.${a}.`;return Object.entries(l.fields).filter(([c])=>c.startsWith(s)).map(([,c])=>c).join("; ")}hasFieldError(t,a){var s;const l=this.data.productErrors.get(t);return!!((s=l==null?void 0:l.fields)!=null&&s[a])}hasVariantFieldError(t,a,l){return this.hasFieldError(t,`variants.${a}.${l}`)}async saveProduct(t){var l,s,i,c;const a=t.ID;if(!this.data.savingIds.has(a)){this.data.savingIds.add(a),this.data.savingIds=new Set(this.data.savingIds);try{const p=await Ae.post("products/bulk-update",{products:[t]});if((l=p.updated)!=null&&l.length)this.data.dirty.delete(a),this.data.dirty=new Set(this.data.dirty),this.data.savedIds.add(a),this.data.savedIds=new Set(this.data.savedIds),this.data.productErrors.delete(a),this.data.productErrors=new Map(this.data.productErrors),q.success(u("Product updated successfully"));else if((s=p.errors)!=null&&s.length){const f=p.errors[0];f!=null&&f.fields&&(this.data.productErrors.set(a,f),this.data.productErrors=new Map(this.data.productErrors)),q.error((f==null?void 0:f.message)||"Failed to save product")}}catch(p){const f=((i=p==null?void 0:p.data)==null?void 0:i.message)||"Failed to save product",_=(c=p==null?void 0:p.data)==null?void 0:c.errors;if(_!=null&&_.length){const g=_[0];g!=null&&g.fields&&(this.data.productErrors.set(a,g),this.data.productErrors=new Map(this.data.productErrors))}q.error(f)}finally{this.data.savingIds.delete(a),this.data.savingIds=new Set(this.data.savingIds)}}}async saveProducts(){var l,s;const t=this.getDirtyProducts().filter(i=>!this.data.savedIds.has(i.ID));if(t.length===0){q.info(u("No changes to save"));return}const a=this.chunkArray(t,10);this.data.saving=!0,this.data.saveProgress={total:a.length,completed:0,errors:[],updatedIds:[]};try{for(const p of a){const f=p.map(_=>_.ID);for(const _ of f)this.data.savingIds.add(_);this.data.savingIds=new Set(this.data.savingIds);try{const _=await Ae.post("products/bulk-update",{products:p});if(_.updated){this.data.saveProgress.updatedIds.push(..._.updated);for(const g of _.updated)this.data.savedIds.add(g),this.data.dirty.delete(g),this.data.productErrors.delete(g);this.data.savedIds=new Set(this.data.savedIds),this.data.dirty=new Set(this.data.dirty),this.data.productErrors=new Map(this.data.productErrors)}if(_.errors&&_.errors.length){this.data.saveProgress.errors.push(..._.errors);for(const g of _.errors)g.post_id&&g.fields&&this.data.productErrors.set(g.post_id,g);this.data.productErrors=new Map(this.data.productErrors)}}catch(_){const g=((l=_==null?void 0:_.data)==null?void 0:l.message)||"A chunk failed to save";this.data.saveProgress.errors.push({message:g});const y=(s=_==null?void 0:_.data)==null?void 0:s.errors;if(y!=null&&y.length){for(const v of y)v.post_id&&v.fields&&this.data.productErrors.set(v.post_id,v);this.data.productErrors=new Map(this.data.productErrors)}}for(const _ of f)this.data.savingIds.delete(_);this.data.savingIds=new Set(this.data.savingIds),this.data.saveProgress.completed++}const{updatedIds:i,errors:c}=this.data.saveProgress;c.length===0?q.success(`${i.length} product(s) updated successfully`):i.length>0?q.info(`${i.length} product(s) updated, ${c.length} error(s)`):q.error(u("All products failed to save"))}finally{this.data.saving=!1}}async duplicateProduct(t){var l;const a=t.ID;if(!(!a||this.data.duplicatingIds.has(a))){this.data.duplicatingIds.add(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const i=(await Ae.post(`products/${a}/duplicate`,{})).product_id;if(i){const p=(await Ae.get("products/bulk-edit-data",{search:i,per_page:1})).products||[];if(p.length>0){const f=this.data.products.indexOf(t);this.data.products.splice(f+1,0,p[0])}}}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to duplicate product";q.error(i)}finally{this.data.duplicatingIds.delete(a),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}async duplicateProductWithVariants(t,a){var s;const l=t.ID;if(!(!l||this.data.duplicatingIds.has(l))){this.data.duplicatingIds.add(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds);try{const c=(await Ae.post(`products/${l}/duplicate`,{})).product_id;if(!c)return;const f=(await Ae.get("products/bulk-edit-data",{search:c,per_page:1})).products||[];if(!f.length)return;const _=f[0],g=t.variants||[],y=new Set;for(const w of g)a.includes(w.id)&&w.serial_index!=null&&y.add(w.serial_index);_.variants&&y.size>0&&(_.variants=_.variants.filter(w=>y.has(w.serial_index)));const v=this.data.products.indexOf(t);this.data.products.splice(v+1,0,_),this.markDirty(_.ID)}catch(i){const c=((s=i==null?void 0:i.data)==null?void 0:s.message)||"Failed to duplicate product";q.error(c)}finally{this.data.duplicatingIds.delete(l),this.data.duplicatingIds=new Set(this.data.duplicatingIds)}}}duplicateVariant(t,a){const l=JSON.parse(JSON.stringify(a));l.variation_title=l.variation_title?l.variation_title+" (Copy)":"",l.sku="",delete l.id,delete l.post_id;const s=t.variants.indexOf(a);t.variants.splice(s+1,0,l),this.markDirty(t.ID)}async deleteProduct(t){var l;const a=t.ID;if(!(!a||this.data.deletingIds.has(a))){this.data.deletingIds.add(a),this.data.deletingIds=new Set(this.data.deletingIds);try{await Ae.delete(`products/${a}`);const s=this.data.products.indexOf(t);s!==-1&&this.data.products.splice(s,1),this.data.dirty.delete(a),this.data.savedIds.delete(a)}catch(s){const i=((l=s==null?void 0:s.data)==null?void 0:l.message)||"Failed to delete product";q.error(i)}finally{this.data.deletingIds.delete(a),this.data.deletingIds=new Set(this.data.deletingIds)}}}removeVariant(t,a){if(t.variants.length<=1)return q.error(u("A product must have at least one variant.")),!1;const l=t.variants.indexOf(a);return l!==-1&&t.variants.splice(l,1),this.markDirty(t.ID),!0}resetPaymentTypeDefaults(t){t.other_info.payment_type==="onetime"&&(t.other_info.installment="no",t.other_info.times="",t.other_info.manage_setup_fee="no",t.other_info.signup_fee="",t.other_info.signup_fee_name="")}flattenCategoryTree(t,a=""){var s;const l=[];for(const i of t){const c=a?`${a} > ${i.label}`:i.label;l.push({label:c,value:c}),(s=i.children)!=null&&s.length&&l.push(...this.flattenCategoryTree(i.children,c))}return l}async fetchCategories(){try{const a=(await Ae.get("products/fetch-term")).taxonomies||{},l=Object.values(a).find(s=>s.name==="product-categories");l!=null&&l.terms&&(this.data.categoryOptions=this.flattenCategoryTree(l.terms))}catch{}}setupSavedViews(){var a,l;const t=(a=window.fluentCartAdminApp)==null?void 0:a.table_config;this.data.savedViews=((l=t==null?void 0:t.products)==null?void 0:l.saved_views)||[]}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}applySavedView(t){const a=this.data.savedViews.find(l=>l.slug===t);a&&(this.data.activeSavedViewId=t,this.data.savedViewQueryParams=a.query_params)}isViewOwner(t){var a,l;return!t||!t.owner_id?!1:t.owner_id===((l=(a=window.fluentCartAdminApp)==null?void 0:a.me)==null?void 0:l.id)}renameSavedView(t,a){}updateSavedView(t){}deleteSavedView(t){}}const it=g1e.init(),y1e={class:"fct-bulk-edit-page fct-layout-width"},b1e={class:"fct-table-wrapper"},w1e={class:"fct-card-header-top"},C1e={class:"fct-card-header-left flex-1"},k1e={class:"fct-card-header-actions"},B1e={key:0,class:"fct-advanced-filter-toggle-wrapper"},x1e={key:1,class:"fct-btn-group sm hidden md:flex"},S1e={key:0,class:"filter-search-wrap"},F1e={class:"search-bar"},$1e={class:"text-xs text-system-light pt-2 dark:text-gray-300"},E1e={class:"fct-bulk-edit-table-wrap"},U1e={key:0,class:"px-5 py-3 flex items-center justify-between border border-solid border-x-0 border-gray-divider border-t-0 dark:border-dark-400"},I1e={class:"m-0 text-base"},Q1e={key:0,class:"text-system-mid text-sm font-normal dark:text-gray-300"},D1e={class:"fct-btn-group sm justify-end"},V1e={class:"filter-popover-item"},T1e={class:"filter-popover-title"},M1e={class:"fct-bulk-edit-table"},L1e={key:0,"aria-hidden":"true"},R1e=["colspan"],O1e=["onClick"],P1e=["onClick"],H1e={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},N1e={class:"flex items-center"},K1e=["onClick","title"],G1e={key:0,class:"bulk-collapse-count"},z1e=["title"],j1e={class:"bulk-status-icon is-error"},q1e=["disabled","onClick","title"],Y1e={key:0,class:"fct-bulk-media-cell"},W1e={key:1,class:"fct-bulk-sku-cell"},J1e={key:1,class:"text-gray-300 text-sm flex justify-center"},X1e={key:2,class:"fct-bulk-categories-cell"},Z1e={key:3,class:"fct-bulk-desc-cell"},ebe={key:4,class:"fct-bulk-short-desc-cell"},tbe={key:5,class:"fct-bulk-status-cell"},abe={key:6,class:"fct-bulk-product-type-cell"},lbe={class:"bulk-readonly-label"},sbe={key:7,class:"fct-bulk-pricing-type-cell"},nbe={class:"bulk-readonly-label"},obe={key:8,class:"fct-bulk-payment-type-cell"},ibe={key:9,class:"fct-bulk-interval-cell"},rbe={key:10,class:"fct-bulk-trial-days-cell"},dbe={key:11,class:"fct-bulk-best-price-cell"},ube={key:12,class:"fct-bulk-compare-price-cell"},cbe={key:13,class:"fct-bulk-qty-cell !pl-5"},Abe={key:14,class:"fct-bulk-stock-cell"},pbe={key:1,class:"text-gray-300 text-sm flex justify-center"},fbe={class:"fct-btn-group sm justify-end"},mbe={key:0,class:"bulk-variants-block-row"},hbe=["colspan"],_be={class:"bulk-inner-table",style:{tableLayout:"fixed",width:"100%",borderCollapse:"collapse"}},vbe=["onClick"],gbe={class:"bulk-checkbox-cell"},ybe={class:"fct-bulk-product-title-cell sticky-col",style:{left:"40px"}},bbe={class:"flex items-center gap-1 pl-4"},wbe={class:"bulk-status-icon is-error"},Cbe={key:0},kbe={key:1},Bbe={key:2},xbe={key:3},Sbe={key:4},Fbe={key:5},$be={key:6},Ebe={key:7},Ube={key:8},Ibe={key:9},Qbe={key:10},Dbe={key:11},Vbe={key:12},Tbe={key:13,class:"text-center"},Mbe={key:14},Lbe={key:1,class:"text-gray-300 text-sm flex justify-center"},Rbe={class:"fct-btn-group sm justify-end"},Obe={key:1,"aria-hidden":"true"},Pbe=["colspan"],Hbe={key:1,class:"flex flex-col items-center justify-center py-16 text-center"},Nbe={class:"text-system-mid text-sm"},Kbe={key:2,class:"flex items-center justify-center py-8"},Gbe={class:"text-system-mid text-sm"},zbe={key:1,class:"flex items-center justify-center py-3 border-top"},jbe={class:"text-system-mid text-sm"},cr=43,qbe=10,Ic=800,Qc=100,Ybe=200,Wbe={__name:"BulkEdit",setup(e){const t=Jt().ctx,a=nl(),{options:l}=it.data,s=le=>{var he;return((he=le==null?void 0:le.detail)==null?void 0:he.variation_type)==="simple"},i=K(()=>it.data.products),c=K(()=>it.data.loading),p=K(()=>it.data.saving),f=K(()=>it.data.saveProgress),_=K(()=>it.data.pagination),g=K(()=>it.data.dirty),y=K(()=>g.value.size),v=K(()=>Math.max(0,_.value.total-i.value.length)),w=K(()=>Math.min(_.value.per_page,v.value)),k=K(()=>{const le=it.data.saveProgress;return le.total?Math.round(le.completed/le.total*100):0}),b=td("search-input"),S=()=>{it.openSearch(),xe(()=>{var le;(le=b.value)==null||le.focus()})},$=(le=!1)=>{it.fetchProducts({},le)},D=()=>{it.saveProducts()},F=le=>{it.markDirty(le.ID)},B=(le,he)=>{it.resetPaymentTypeDefaults(he),F(le)},U=(le,he)=>{const Ye=it.data.categoryOptions;for(const st of he)Ye.find(je=>je.value===st)||Ye.push({label:st,value:st});F(le)},Q=le=>it.isDirty(le.ID),V=le=>it.isSavingProduct(le.ID),I=le=>it.isSaved(le.ID),M=le=>it.isRowDisabled(le.ID),O=le=>it.isDuplicating(le.ID),L=le=>it.isDeleting(le.ID),H=le=>it.hasError(le.ID),j=le=>it.getError(le.ID),W=le=>it.hasProductLevelError(le.ID),G=(le,he)=>it.hasVariantError(le.ID,he),Z=(le,he)=>it.getVariantError(le.ID,he),ne=(le,he)=>it.hasFieldError(le.ID,he),ce=(le,he,Ye)=>it.hasVariantFieldError(le.ID,he,Ye),z=le=>it.saveProduct(le),ue=le=>it.duplicateProduct(le),ie=(le,he)=>it.duplicateVariant(le,he),J=T(!0),{selectedKeys:N,handleRowClick:ae,toggleSelectAll:oe,selectAll:fe,deselectAll:re,isSelected:Ee,selectedCount:ye,isLinkMode:Ce,toggleLinkMode:ve}=Sf(),Ue=K(()=>{const le=[];for(const he of kt.value)if(le.push(`p:${he.productId}`),he.hasVariants&&!he.collapsed)for(const Ye of he.product.variants)le.push(`v:${Ye.id}`);return le}),Ke=le=>{var he;if(le.startsWith("p:")){const Ye=parseInt(le.slice(2)),st=kt.value.find(je=>je.productId===Ye);return st?{type:"product",data:st.product,product:st.product}:null}else if(le.startsWith("v:")){const Ye=parseInt(le.slice(2));for(const st of kt.value){const je=(he=st.product.variants)==null?void 0:he.find(Xe=>Xe.id===Ye);if(je)return{type:"variant",data:je,product:st.product}}}return null},We=(le,he,Ye)=>{!Ce.value||!Ee(Ye)||$f(le,he,Ye,N.value,Ke,F,lye)},Be=T(!1),$e=le=>{le.key==="Shift"&&(Be.value=!0)},He=le=>{le.key==="Shift"&&(Be.value=!1)},Re=(le,he)=>{if(!he.shiftKey||he.target.closest(".bulk-checkbox-cell"))return;he.preventDefault();const Ye=new Set(N.value);Ye.has(le)?Ye.delete(le):Ye.add(le),N.value=Ye},yt=()=>{const le=[];for(const he of kt.value){const Ye=`p:${he.productId}`,st=N.value.has(Ye),je=[];if(he.product.variants)for(const Xe of he.product.variants)N.value.has(`v:${Xe.id}`)&&je.push(Xe.id);!st&&je.length===0||(st&&je.length===0?le.push({product:he.product,type:"full"}):!st&&je.length>0?le.push({product:he.product,type:"variants-only",variantIds:je}):le.push({product:he.product,type:"partial",variantIds:je}))}return le},gt=async()=>{const le=yt();if(!le.length)return;const he=le.filter(mt=>mt.type==="full").length,Ye=le.filter(mt=>mt.type==="partial").length,je=le.filter(mt=>mt.type==="variants-only").reduce((mt,et)=>mt+et.variantIds.length,0),Xe=[];he>0&&Xe.push(`${he} product(s) with all variants`),Ye>0&&Xe.push(`${Ye} product(s) with selected variants`),je>0&&Xe.push(`${je} variant(s)`);try{await Fl.confirm(t.$t("Duplicate %s?").replace("%s",Xe.join(", ")),t.$t("Bulk Duplicate"),{confirmButtonText:t.$t("Duplicate"),cancelButtonText:t.$t("Cancel"),type:"info"})}catch{return}for(const mt of le)if(mt.type==="full")await it.duplicateProduct(mt.product);else if(mt.type==="variants-only")for(const et of mt.variantIds){const It=mt.product.variants.find(pe=>pe.id===et);It&&it.duplicateVariant(mt.product,It)}else mt.type==="partial"&&await it.duplicateProductWithVariants(mt.product,mt.variantIds);re()},Rt=async()=>{const le=[],he=[];for(const je of kt.value){const Xe=`p:${je.productId}`;if(N.value.has(Xe)){le.push(je.product);continue}const et=[];if(je.product.variants)for(const It of je.product.variants)N.value.has(`v:${It.id}`)&&et.push(It);et.length>0&&he.push({product:je.product,variants:et})}if(!le.length&&!he.length)return;const Ye=he.reduce((je,Xe)=>je+Xe.variants.length,0),st=[];le.length>0&&st.push(`${le.length} product(s)`),Ye>0&&st.push(`${Ye} variant(s)`);try{await Fl.confirm(t.$t("Permanently delete %s? This cannot be undone.").replace("%s",st.join(" and ")),t.$t("Bulk Delete"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}for(const je of le)await it.deleteProduct(je);for(const{product:je,variants:Xe}of he)for(const mt of Xe)it.removeVariant(je,mt);re()},Tt=async le=>{const he=le.ID;if(!he||it.isDeleting(he))return;const Ye=le.post_title||t.$t("Untitled product"),st=Array.isArray(le.variants)?le.variants.length:0,je=st>0?t.$t('This will permanently delete "%1$s" and its %2$s variant(s).',Ye,st):t.$t('This will permanently delete "%1$s".',Ye);try{await Fl.confirm(je,t.$t("Delete Product"),{confirmButtonText:t.$t("Delete"),cancelButtonText:t.$t("Cancel"),type:"warning"})}catch{return}it.deleteProduct(le)},Dt=(le,he)=>{if(le.variants.length<=1){it.removeVariant(le,he);return}const Ye=he.variation_title||t.$t("Untitled variant");Fl.confirm(t.$t('This will remove the variant "%1$s".',Ye),t.$t("Remove Variant"),{confirmButtonText:t.$t("Remove"),cancelButtonText:t.$t("Cancel"),type:"warning"}).then(()=>{it.removeVariant(le,he)}).catch(()=>{})},_t=T({visible:!1,field:"",product:null,value:""}),Gt=(le,he)=>{_t.value={visible:!0,field:he,product:le,value:le[he]||""}},bt=le=>{_t.value.value=le},St=()=>{const{product:le,field:he,value:Ye}=_t.value;le&&(le[he]=Ye,F(le)),_t.value.visible=!1},Pt=K(()=>_t.value.field==="post_content"?t.$t("Edit Description"):t.$t("Edit Short Description")),Ht=T([]),Qt=K(()=>Ht.value.filter(le=>le.key==="title"||le.key==="actions"?!0:it.isColumnVisible(le.key))),ht=le=>it.isColumnVisible(le),qt=()=>{it.saveColumnWidths(Ht.value)},ge=T(new Set),Fe=le=>{const he=le.ID;ge.value.has(he)?ge.value.delete(he):ge.value.add(he),ge.value=new Set(ge.value)},ot=le=>ge.value.has(le.ID),wt=T(0),kt=K(()=>{let le=0;return i.value.map(he=>{var pe;const Ye=he.ID,st=((pe=he.detail)==null?void 0:pe.variation_type)!=="simple"&&Array.isArray(he.variants)&&he.variants.length>0,je=st?he.variants.length:0,Xe=ge.value.has(Ye),mt=st&&!Xe?je*cr:0,et=cr+mt,It={product:he,productId:Ye,hasVariants:st,variantCount:je,collapsed:Xe,groupHeight:et,offset:le};return le+=et,It})}),Xt=K(()=>{const le=kt.value;if(le.length===0)return 0;const he=le[le.length-1];return he.offset+he.groupHeight}),vt=K(()=>{const le=kt.value,he=wt.value,Ye=he+Ic,st=qbe*cr;return le.filter(je=>je.offset+je.groupHeight>=he-st&&je.offset<=Ye+st)}),ea=K(()=>vt.value.length===0?0:vt.value[0].offset),ta=K(()=>{if(vt.value.length===0)return 0;const le=vt.value[vt.value.length-1];return Xt.value-le.offset-le.groupHeight});let zt=null,wa=0;const qa=()=>{if(c.value||!_.value.hasMore||i.value.length===0)return;Xt.value-(wt.value+Ic)<Ybe&&$(!0)},il=le=>{const he=le.target,Ye=Date.now();zt&&clearTimeout(zt),Ye-wa>=Qc?(wt.value=he.scrollTop,wa=Ye,qa()):zt=setTimeout(()=>{wt.value=he.scrollTop,wa=Date.now(),zt=null,qa()},Qc)},Ya=le=>({physical:"Physical",digital:"Digital"})[le]||le||"—",ma=le=>({simple:"Simple",simple_variations:"Variable"})[le]||le||"—";let X=null;const we=()=>{const le=a.query.product_ids,he=a.query.variant_ids;le&&he?it.fetchProducts({},!1,le,he):$(!1)};return Ie(async()=>{X=bs(),X.bind("mod+a",le=>{var Ye,st;const he=(Ye=document.activeElement)==null?void 0:Ye.tagName;he==="INPUT"||he==="TEXTAREA"||(st=document.activeElement)!=null&&st.isContentEditable||(le.preventDefault(),fe(Ue.value))}),X.bind("escape",()=>{var he,Ye;const le=(he=document.activeElement)==null?void 0:he.tagName;le==="INPUT"||le==="TEXTAREA"||(Ye=document.activeElement)!=null&&Ye.isContentEditable||(Ce.value?ve():re())}),Ht.value=[{key:"title",title:t.$t("Title"),width:150,minWidth:100},{key:"image",title:t.$t("Image"),width:60,minWidth:50},{key:"sku",title:t.$t("SKU"),width:120,minWidth:80},{key:"categories",title:t.$t("Categories"),width:200,minWidth:150},{key:"description",title:t.$t("Description"),width:200,minWidth:150},{key:"short_description",title:t.$t("Short Description"),width:150,minWidth:100},{key:"status",title:t.$t("Status"),width:100,minWidth:50},{key:"product_type",title:t.$t("Product Type"),width:120,minWidth:80},{key:"pricing_type",title:t.$t("Pricing Type"),width:120,minWidth:80},{key:"payment_type",title:t.$t("Payment Type"),width:120,minWidth:100},{key:"interval",title:t.$t("Interval"),width:120,minWidth:80},{key:"trial_days",title:t.$t("Trial Days"),width:100,minWidth:70},{key:"best_price",title:t.$t("Best Price"),width:100,minWidth:100},{key:"compare_price",title:t.$t("Compare-at Price"),width:150,minWidth:100},{key:"track_quantity",title:t.$t("Track Quantity"),width:100,minWidth:100},{key:"stock",title:t.$t("Stock"),width:120,minWidth:80},{key:"actions",title:"",width:110,minWidth:110}],it.restoreColumnWidths(Ht.value),it.setupColumnVisibility(),it.setupSavedViews(),it.fetchCategories(),we(),document.body.classList.add("fct-bulk-page"),window.addEventListener("keydown",$e),window.addEventListener("keyup",He)}),cl(()=>{document.body.classList.remove("fct-bulk-page"),window.removeEventListener("keydown",$e),window.removeEventListener("keyup",He),X&&X.reset()}),(le,he)=>{const Ye=C("el-button"),st=C("el-progress"),je=C("el-switch"),Xe=C("el-tooltip"),mt=C("el-input"),et=C("el-checkbox"),It=C("el-checkbox-group"),pe=C("el-popover"),_e=C("el-icon"),Oe=C("el-option"),Me=C("el-select"),ct=C("el-dialog");return r(),h("div",y1e,[n(ol,{title:le.$t("Bulk Edit")},{action:d(()=>[n(Ye,{type:"primary",onClick:D,loading:p.value,disabled:p.value||y.value===0},{default:d(()=>[R(m(p.value?le.$t("Saving %s/%s...").replace("%s",f.value.completed).replace("%s",f.value.total):y.value>0?le.$t("Save Changes")+` (${y.value})`:le.$t("Save Changes")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["title"]),p.value?(r(),E(st,{key:0,percentage:k.value,"stroke-width":6,class:"mb-4"},null,8,["percentage"])):x("",!0),o("div",b1e,[n(Se,null,{default:d(()=>[n(Ve,{border_bottom:""},{default:d(()=>[o("div",w1e,[o("div",C1e,[A(it).getTabsCount()&&!A(it).isUsingAdvanceFilter()?(r(),E(am,{key:0,class:de("hide-animation-on-mobile hidden md:inline-flex classic-tab-style"),table:A(it)},null,8,["table"])):x("",!0)]),o("div",k1e,[A(it).isAdvanceFilterEnabled()?(r(),h("div",B1e,[n(je,{class:"fct-advanced-filter-toggle",onChange:he[0]||(he[0]=ee=>{A(it).onFilterTypeChanged(ee)}),"active-value":"advanced","inactive-value":"simple",modelValue:A(it).data.filterType,"onUpdate:modelValue":he[1]||(he[1]=ee=>A(it).data.filterType=ee),"active-text":le.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):x("",!0),A(it).isUsingAdvanceFilter()?x("",!0):(r(),h("div",x1e,[A(it).isSearching()?x("",!0):(r(),E(Xe,{key:0,effect:"light",content:le.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button",onClick:Ge(S,["prevent"])},{default:d(()=>[n(Y,{name:"Search"})]),_:1})]),_:1},8,["content"]))]))])]),n(Yc,{table:A(it)},null,8,["table"]),A(it).isSearching()&&!A(it).isUsingAdvanceFilter()?(r(),h("div",S1e,[o("div",F1e,[n(mt,{ref:"search-input",onClear:he[2]||(he[2]=()=>{A(it).search()}),onKeyup:he[3]||(he[3]=xa(()=>{A(it).search()},["enter"])),modelValue:A(it).data.search,"onUpdate:modelValue":he[4]||(he[4]=ee=>A(it).data.search=ee),type:"text",placeholder:le.$t("Search"),clearable:""},{prefix:d(()=>[n(Y,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",$1e,m(A(it).getSearchHint()),1)]),n(Ye,{text:"",onClick:he[5]||(he[5]=()=>{A(it).closeSearch()})},{default:d(()=>[R(m(le.$t("Cancel")),1)]),_:1})])):x("",!0)]),_:1}),n(ke,{class:"p-0"},{default:d(()=>[o("div",E1e,[i.value.length>0?(r(),h("div",U1e,[o("h5",I1e,[R(m(i.value.length)+" "+m(i.value.length===1?le.$t("Product"):le.$t("Products"))+" ",1),_.value.total>i.value.length?(r(),h("span",Q1e,m(le.$t("of"))+" "+m(_.value.total)+" "+m(le.$t("total"))+" · "+m(w.value)+" "+m(le.$t("next")),1)):x("",!0)]),o("div",D1e,[n(Ye,{disabled:A(ye)===0,onClick:gt,size:"small"},{default:d(()=>[he[14]||(he[14]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})],-1)),R(" "+m(le.$t("Duplicate")),1)]),_:1,__:[14]},8,["disabled"]),n(Ye,{disabled:A(ye)===0,onClick:Rt,size:"small",type:"danger",plain:""},{default:d(()=>[he[15]||(he[15]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("polyline",{points:"3 6 5 6 21 6"}),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)),R(" "+m(le.$t("Delete")),1)]),_:1,__:[15]},8,["disabled"]),n(Ye,{class:de({"is-active":A(Ce)}),disabled:A(ye)<2&&!A(Ce),onClick:A(ve),size:"small"},{default:d(()=>[he[16]||(he[16]=o("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),o("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})],-1)),R(" "+m(A(Ce)?le.$t("Unlink"):le.$t("Link")),1)]),_:1,__:[16]},8,["class","disabled","onClick"]),n(et,{modelValue:J.value,"onUpdate:modelValue":he[6]||(he[6]=ee=>J.value=ee),label:le.$t("Pin Actions")},null,8,["modelValue","label"]),n(pe,{trigger:"click",placement:"bottom-end",width:"240","popper-class":"filter-popover"},{reference:d(()=>[o("span",null,[n(Xe,{effect:"light",content:le.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:d(()=>[n(at,{tag:"button",size:"small"},{default:d(()=>[n(Y,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:d(()=>[o("div",V1e,[o("h3",T1e,m(le.$t("Columns")),1),n(It,{modelValue:A(it).data.visibleColumns,"onUpdate:modelValue":he[7]||(he[7]=ee=>A(it).data.visibleColumns=ee),class:"fct-checkbox-blocks",onChange:he[8]||(he[8]=ee=>A(it).handleColumnVisibilityChange())},{default:d(()=>[(r(!0),h(P,null,te(A(it).getToggleableColumns(),ee=>(r(),E(et,{key:ee.value,value:ee.value,label:le.$t(ee.label)},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})])])):x("",!0),o("div",M1e,[i.value.length>0?(r(),h("div",{key:0,class:de(["relative",{"is-link-mode":A(Ce),"is-shift-held":Be.value}])},[n(Bf,{columns:Qt.value,"sticky-last":J.value,onScroll:il,onResizeEnd:qt},{"header-first":d(()=>[Wt(n(et,{checked:A(ye)>0&&A(ye)===Ue.value.length,onChange:he[9]||(he[9]=ee=>A(oe)(Ue.value))},null,8,["checked"]),[[A(tye),A(ye)>0&&A(ye)<Ue.value.length]])]),"header-last":d(()=>[R(m(le.$t("Actions")),1)]),default:d(()=>[ea.value>0?(r(),h("tr",L1e,[o("td",{colspan:Qt.value.length+1,style:ra({height:ea.value+"px",padding:0,border:"none"})},null,12,R1e)])):x("",!0),(r(!0),h(P,null,te(vt.value,ee=>{var Ne,pt,De,xt,Wa,se,me,Qe,Le,qe,At,tt,Ut,jt,Ta,$t,Zt,ha;return r(),h(P,{key:ee.productId},[o("tr",{class:de(["bulk-product-row",{"is-dirty":Q(ee.product),"is-saving":V(ee.product),"is-saved":I(ee.product),"has-product-error":H(ee.product),"is-selected":A(Ee)(`p:${ee.productId}`)}]),onClick:Ze=>Re(`p:${ee.productId}`,Ze)},[o("td",{class:"bulk-checkbox-cell",onClick:Ze=>A(ae)(`p:${ee.productId}`,Ze,Ue.value)},[n(et,{"model-value":A(Ee)(`p:${ee.productId}`),tabindex:"-1"},null,8,["model-value"])],8,P1e),o("td",H1e,[o("div",N1e,[ee.hasVariants?(r(),h("button",{key:0,class:"bulk-collapse-btn",onClick:Ge(Ze=>Fe(ee.product),["prevent"]),title:ot(ee.product)?le.$t("Expand variants"):le.$t("Collapse variants")},[(r(),h("svg",{class:de(["bulk-collapse-icon",{"is-collapsed":ot(ee.product)}]),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},he[17]||(he[17]=[o("path",{d:"M6 4L10 8L6 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2)),ot(ee.product)?(r(),h("span",G1e,m(ee.variantCount),1)):x("",!0)],8,K1e)):x("",!0),n(mt,{class:de(["fct-bulk-input",{"is-error":ne(ee.product,"post_title")}]),modelValue:ee.product.post_title,"onUpdate:modelValue":[Ze=>ee.product.post_title=Ze,Ze=>{F(ee.product),We("title",Ze,`p:${ee.productId}`)}],placeholder:le.$t("Product title"),disabled:M(ee.product),size:"small"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),V(ee.product)?(r(),h("span",{key:1,class:"bulk-status-icon is-syncing",title:le.$t("Saving...")},[n(_e,{class:"is-loading",size:14},{default:d(()=>[n(A(en))]),_:1})],8,z1e)):W(ee.product)||s(ee.product)&&H(ee.product)?(r(),E(Xe,{key:2,content:j(ee.product),placement:"top"},{default:d(()=>[o("span",j1e,[n(_e,{size:16},{default:d(()=>[n(A(Vo))]),_:1})])]),_:2},1032,["content"])):Q(ee.product)?(r(),h("button",{key:3,class:"bulk-inline-save",disabled:M(ee.product),onClick:Ge(Ze=>z(ee.product),["prevent"]),title:le.$t("Save")},he[18]||(he[18]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",width:"16",height:"16"},[o("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z",fill:"currentColor"})],-1)]),8,q1e)):x("",!0)])]),ht("image")?(r(),h("td",Y1e,[n(yl,{modelValue:ee.product.gallery,"onUpdate:modelValue":Ze=>ee.product.gallery=Ze,onChange:Ze=>F(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),ht("sku")?(r(),h("td",W1e,[((pt=(Ne=ee.product)==null?void 0:Ne.detail)==null?void 0:pt.variation_type)==="simple"&&((De=ee.product.variants)!=null&&De[0])?(r(),E(mt,{key:0,class:de(["fct-bulk-input",{"is-error":ne(ee.product,"variants.0.sku")}]),modelValue:ee.product.variants[0].sku,"onUpdate:modelValue":[Ze=>ee.product.variants[0].sku=Ze,Ze=>{F(ee.product),We("sku",Ze,`p:${ee.productId}`)}],placeholder:"SKU",size:"small",disabled:M(ee.product)},null,8,["modelValue","onUpdate:modelValue","disabled","class"])):(r(),h("span",J1e,"—"))])):x("",!0),ht("categories")?(r(),h("td",X1e,[n(xf,{modelValue:ee.product.categories,"onUpdate:modelValue":Ze=>ee.product.categories=Ze,options:A(it).data.categoryOptions,disabled:M(ee.product),onChange:Ze=>{U(ee.product,Ze),We("categories",ee.product.categories,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","options","disabled","onChange"])])):x("",!0),ht("description")?(r(),h("td",Z1e,[n(li,{value:ee.product.post_content,placeholder:le.$t("Description"),onClick:Ze=>Gt(ee.product,"post_content")},null,8,["value","placeholder","onClick"])])):x("",!0),ht("short_description")?(r(),h("td",ebe,[n(li,{value:ee.product.post_excerpt,placeholder:le.$t("Short description"),onClick:Ze=>Gt(ee.product,"post_excerpt")},null,8,["value","placeholder","onClick"])])):x("",!0),ht("status")?(r(),h("td",tbe,[n(Me,{modelValue:ee.product.post_status,"onUpdate:modelValue":Ze=>ee.product.post_status=Ze,size:"small",class:de({"is-field-error":ne(ee.product,"post_status")}),disabled:M(ee.product),onChange:Ze=>{F(ee.product),We("status",ee.product.post_status,`p:${ee.productId}`)}},{default:d(()=>[n(Oe,{label:le.$t("Published"),value:"publish"},null,8,["label"]),n(Oe,{label:le.$t("Draft"),value:"draft"},null,8,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])])):x("",!0),ht("product_type")?(r(),h("td",abe,[o("span",lbe,m(Ya((Wa=(xt=ee.product)==null?void 0:xt.detail)==null?void 0:Wa.fulfillment_type)),1)])):x("",!0),ht("pricing_type")?(r(),h("td",sbe,[o("span",nbe,m(ma((me=(se=ee.product)==null?void 0:se.detail)==null?void 0:me.variation_type)),1)])):x("",!0),ht("payment_type")?(r(),h("td",obe,[n(Zo,{variant:s(ee.product)?(Qe=ee.product.variants)==null?void 0:Qe[0]:null,disabled:M(ee.product),"has-error":ne(ee.product,"variants.0.other_info.payment_type"),onPaymentTypeChange:Ze=>{var aa;B(ee.product,Ze),We("payment_type",(aa=Ze.other_info)==null?void 0:aa.payment_type,`p:${ee.productId}`)},onChange:Ze=>F(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),ht("interval")?(r(),h("td",ibe,[n(ei,{variant:s(ee.product)?(Le=ee.product.variants)==null?void 0:Le[0]:null,disabled:M(ee.product),"has-error":ne(ee.product,"variants.0.other_info.repeat_interval"),onChange:Ze=>{var aa,Ha,Je;F(ee.product),We("interval",(Je=(Ha=(aa=ee.product.variants)==null?void 0:aa[0])==null?void 0:Ha.other_info)==null?void 0:Je.repeat_interval,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("trial_days")?(r(),h("td",rbe,[n(ti,{variant:s(ee.product)?(qe=ee.product.variants)==null?void 0:qe[0]:null,disabled:M(ee.product),"has-error":ne(ee.product,"variants.0.other_info.trial_days"),onChange:Ze=>{var aa,Ha,Je;F(ee.product),We("trial_days",(Je=(Ha=(aa=ee.product.variants)==null?void 0:aa[0])==null?void 0:Ha.other_info)==null?void 0:Je.trial_days,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("best_price")?(r(),h("td",dbe,[n(Xo,{variant:s(ee.product)?(At=ee.product.variants)==null?void 0:At[0]:null,disabled:M(ee.product),"has-error":ne(ee.product,"variants.0.item_price"),onChange:Ze=>{var aa,Ha;F(ee.product),We("price",(Ha=(aa=ee.product.variants)==null?void 0:aa[0])==null?void 0:Ha.item_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("compare_price")?(r(),h("td",ube,[n(ai,{variant:s(ee.product)?(tt=ee.product.variants)==null?void 0:tt[0]:null,disabled:M(ee.product),"has-error":ne(ee.product,"variants.0.compare_price"),onChange:Ze=>{var aa,Ha;F(ee.product),We("compare_price",(Ha=(aa=ee.product.variants)==null?void 0:aa[0])==null?void 0:Ha.compare_price,`p:${ee.productId}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("track_quantity")?(r(),h("td",cbe,[(Ut=ee.product)!=null&&Ut.detail?(r(),E(je,{key:0,modelValue:ee.product.detail.manage_stock,"onUpdate:modelValue":Ze=>ee.product.detail.manage_stock=Ze,"active-value":1,"inactive-value":0,disabled:M(ee.product),onChange:Ze=>{F(ee.product),A(it).syncStockStatus(ee.product),We("manage_stock",ee.product.detail.manage_stock,`p:${ee.productId}`)}},null,8,["modelValue","onUpdate:modelValue","disabled","onChange"])):x("",!0)])):x("",!0),ht("stock")?(r(),h("td",Abe,[(Ta=(jt=ee.product)==null?void 0:jt.detail)!=null&&Ta.manage_stock&&((Zt=($t=ee.product)==null?void 0:$t.detail)==null?void 0:Zt.variation_type)==="simple"&&((ha=ee.product.variants)!=null&&ha[0])?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:ee.product.variants[0].available,"onUpdate:modelValue":[Ze=>ee.product.variants[0].available=Ze,Ze=>{ee.product.variants[0].total_stock=Ze,F(ee.product),A(it).syncStockStatus(ee.product),We("stock",Ze,`p:${ee.productId}`)}],disabled:M(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",pbe,"—"))])):x("",!0),o("td",{class:de(["fct-bulk-actions-cell",{"sticky-col sticky-col-right":J.value}])},[o("div",fbe,[ee.product.view_url?(r(),E(at,{key:0,tag:"a",size:"x-small",href:ee.product.view_url,target:"_blank",title:le.$t("View Product")},{default:d(()=>[n(Y,{name:"External"})]),_:2},1032,["href","title"])):x("",!0),n(at,{tag:"button",size:"x-small",onClick:Ge(Ze=>ue(ee.product),["prevent"]),disabled:p.value||M(ee.product)||O(ee.product),title:le.$t("Duplicate")},{default:d(()=>[O(ee.product)?(r(),E(_e,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(en))]),_:1})):(r(),E(Y,{key:1,name:"Copy"}))]),_:2},1032,["onClick","disabled","title"]),n(at,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(Ze=>Tt(ee.product),["prevent"]),disabled:p.value||M(ee.product)||L(ee.product),title:le.$t("Delete")},{default:d(()=>[L(ee.product)?(r(),E(_e,{key:0,class:"is-loading",size:14},{default:d(()=>[n(A(en))]),_:1})):(r(),E(Y,{key:1,name:"Delete"}))]),_:2},1032,["onClick","disabled","title"])])],2)],10,O1e),ee.hasVariants?(r(),h("tr",mbe,[o("td",{colspan:Qt.value.length+1,class:"!p-0 !border-b-0"},[n(ya,{accordion:"",visible:!ee.collapsed,duration:200},{default:d(()=>[o("table",_be,[o("colgroup",null,[he[19]||(he[19]=o("col",{style:{width:"40px"}},null,-1)),(r(!0),h(P,null,te(Qt.value,(Ze,aa)=>(r(),h("col",{key:aa,style:ra({width:Ze.width+"px"})},null,4))),128))]),o("tbody",null,[(r(!0),h(P,null,te(ee.product.variants,(Ze,aa)=>{var Ha,Je;return r(),h("tr",{key:Ze.id||aa,class:de(["bulk-variation-row",{"is-selected":A(Ee)(`v:${Ze.id}`)}]),onClick:Lt=>Re(`v:${Ze.id}`,Lt)},[o("td",gbe,[n(et,{"model-value":A(Ee)(`v:${Ze.id}`),tabindex:"-1",onChange:Lt=>A(ae)(`v:${Ze.id}`,Lt,Ue.value)},null,8,["model-value","onChange"])]),o("td",ybe,[o("div",bbe,[he[20]||(he[20]=o("span",{class:"text-gray-300 text-xs"},"└",-1)),n(mt,{size:"small",modelValue:Ze.variation_title,"onUpdate:modelValue":[Lt=>Ze.variation_title=Lt,Lt=>{F(ee.product),We("title",Lt,`v:${Ze.id}`)}],placeholder:le.$t("Variation title"),disabled:M(ee.product),class:de({"is-error":ce(ee.product,aa,"variation_title")})},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"]),G(ee.product,aa)?(r(),E(Xe,{key:0,content:Z(ee.product,aa),placement:"top"},{default:d(()=>[o("span",wbe,[n(_e,{size:14},{default:d(()=>[n(A(Vo))]),_:1})])]),_:2},1032,["content"])):x("",!0)])]),ht("image")?(r(),h("td",Cbe,[n(yl,{modelValue:Ze.media,"onUpdate:modelValue":Lt=>Ze.media=Lt,onChange:Lt=>F(ee.product)},null,8,["modelValue","onUpdate:modelValue","onChange"])])):x("",!0),ht("sku")?(r(),h("td",kbe,[n(mt,{class:de(["fct-bulk-input",{"is-error":ce(ee.product,aa,"sku")}]),size:"small",modelValue:Ze.sku,"onUpdate:modelValue":[Lt=>Ze.sku=Lt,Lt=>{F(ee.product),We("sku",Lt,`v:${Ze.id}`)}],placeholder:le.$t("SKU"),disabled:M(ee.product)},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled","class"])])):x("",!0),ht("categories")?(r(),h("td",Bbe,he[21]||(he[21]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("description")?(r(),h("td",xbe,he[22]||(he[22]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("short_description")?(r(),h("td",Sbe,he[23]||(he[23]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("status")?(r(),h("td",Fbe,he[24]||(he[24]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("product_type")?(r(),h("td",$be,he[25]||(he[25]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("pricing_type")?(r(),h("td",Ebe,he[26]||(he[26]=[o("span",{class:"text-gray-300 text-sm flex justify-center"},"—",-1)]))):x("",!0),ht("payment_type")?(r(),h("td",Ube,[n(Zo,{variant:Ze,disabled:M(ee.product),"has-error":ce(ee.product,aa,"other_info.payment_type"),onPaymentTypeChange:Lt=>{var os;B(ee.product,Lt),We("payment_type",(os=Lt.other_info)==null?void 0:os.payment_type,`v:${Ze.id}`)},onChange:Lt=>F(ee.product)},null,8,["variant","disabled","has-error","onPaymentTypeChange","onChange"])])):x("",!0),ht("interval")?(r(),h("td",Ibe,[n(ei,{variant:Ze,disabled:M(ee.product),"has-error":ce(ee.product,aa,"other_info.repeat_interval"),onChange:Lt=>{var os;F(ee.product),We("interval",(os=Ze.other_info)==null?void 0:os.repeat_interval,`v:${Ze.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("trial_days")?(r(),h("td",Qbe,[n(ti,{variant:Ze,disabled:M(ee.product),"has-error":ce(ee.product,aa,"other_info.trial_days"),onChange:Lt=>{var os;F(ee.product),We("trial_days",(os=Ze.other_info)==null?void 0:os.trial_days,`v:${Ze.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("best_price")?(r(),h("td",Dbe,[n(Xo,{variant:Ze,disabled:M(ee.product),"has-error":ce(ee.product,aa,"item_price"),onChange:Lt=>{F(ee.product),We("price",Ze.item_price,`v:${Ze.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("compare_price")?(r(),h("td",Vbe,[n(ai,{variant:Ze,disabled:M(ee.product),"has-error":ce(ee.product,aa,"compare_price"),onChange:Lt=>{F(ee.product),We("compare_price",Ze.compare_price,`v:${Ze.id}`)}},null,8,["variant","disabled","has-error","onChange"])])):x("",!0),ht("track_quantity")?(r(),h("td",Tbe,he[27]||(he[27]=[o("span",{class:"text-gray-300 text-sm"},"—",-1)]))):x("",!0),ht("stock")?(r(),h("td",Mbe,[(Je=(Ha=ee.product)==null?void 0:Ha.detail)!=null&&Je.manage_stock?(r(),E(mt,{key:0,class:"fct-bulk-input",placeholder:le.$t("e.g 10"),size:"small",modelValue:Ze.available,"onUpdate:modelValue":[Lt=>Ze.available=Lt,Lt=>{Ze.total_stock=Lt,F(ee.product),A(it).syncStockStatus(ee.product),We("stock",Lt,`v:${Ze.id}`)}],disabled:M(ee.product)},null,8,["placeholder","modelValue","onUpdate:modelValue","disabled"])):(r(),h("span",Lbe,"—"))])):x("",!0),o("td",{class:de(["text-center",{"sticky-col sticky-col-right":J.value}])},[o("div",Rbe,[n(at,{tag:"button",size:"x-small",onClick:Ge(Lt=>ie(ee.product,Ze),["prevent"]),disabled:p.value||M(ee.product),title:le.$t("Duplicate")},{default:d(()=>[n(Y,{name:"Copy"})]),_:2},1032,["onClick","disabled","title"]),n(at,{tag:"button",size:"x-small",hover:"danger",onClick:Ge(Lt=>Dt(ee.product,Ze),["prevent"]),disabled:p.value||M(ee.product),title:le.$t("Delete")},{default:d(()=>[n(Y,{name:"Delete"})]),_:2},1032,["onClick","disabled","title"])])],2)],10,vbe)}),128))])])]),_:2},1032,["visible"])],8,hbe)])):x("",!0)],64)}),128)),ta.value>0?(r(),h("tr",Obe,[o("td",{colspan:Qt.value.length+1,style:ra({height:ta.value+"px",padding:0,border:"none"})},null,12,Pbe)])):x("",!0)]),_:1},8,["columns","sticky-last"])],2)):c.value?c.value?(r(),h("div",Kbe,[n(_e,{class:"is-loading mr-2"},{default:d(()=>he[28]||(he[28]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[28]}),o("span",Gbe,m(le.$t("Loading products...")),1)])):x("",!0):(r(),h("div",Hbe,[o("p",Nbe,m(le.$t("No products found.")),1)]))]),_.value.hasMore&&i.value.length>0&&c.value?(r(),h("div",zbe,[n(_e,{class:"is-loading mr-2"},{default:d(()=>he[29]||(he[29]=[o("i",{class:"el-icon-loading"},null,-1)])),_:1,__:[29]}),o("span",jbe,m(le.$t("Loading"))+" "+m(w.value)+" "+m(le.$t("more...")),1)])):x("",!0)])]),_:1})]),_:1})]),n(ct,{modelValue:_t.value.visible,"onUpdate:modelValue":he[12]||(he[12]=ee=>_t.value.visible=ee),title:Pt.value,width:"700px","close-on-click-modal":!1,onClosed:he[13]||(he[13]=ee=>_t.value.product=null)},{footer:d(()=>[n(Ye,{onClick:he[11]||(he[11]=ee=>_t.value.visible=!1)},{default:d(()=>[R(m(le.$t("Cancel")),1)]),_:1}),n(Ye,{type:"primary",onClick:St},{default:d(()=>[R(m(le.$t("Save")),1)]),_:1})]),default:d(()=>[_t.value.visible&&_t.value.field==="post_content"?(r(),E(ls,{key:0,"model-value":_t.value.value,height:300,onUpdate:bt},null,8,["model-value"])):x("",!0),_t.value.visible&&_t.value.field==="post_excerpt"?(r(),E(mt,{key:1,modelValue:_t.value.value,"onUpdate:modelValue":he[10]||(he[10]=ee=>_t.value.value=ee),type:"textarea",rows:6,placeholder:le.$t("Short description")},null,8,["modelValue","placeholder"])):x("",!0)]),_:1},8,["modelValue","title"])])}}},Ef=ze.get("payment_routes");for(const e of Ef)e.props=!0;const Jbe=ze.get("storage_driver_routes"),Uf=(Jbe||[]).filter(e=>e.name!=="s3");for(const e of Uf)e.props=!0;var Xbe={dashboard:{name:"dashboard",path:"/",component:YB,meta:{active_menu:"dashboard",title:u("Dashboard")}},orders:{path:"/orders",component:F$,meta:{active_menu:"orders",title:u("Orders")},children:[{name:"orders",path:"",component:vv,meta:{active_menu:"orders",title:u("Orders"),permission:"orders/view"}},{name:"view_order",path:":order_id(\\d+)/view",component:ND,props:!0,meta:{active_menu:"orders",title:u("View Order"),permission:["orders/view","orders/manage"]}},{name:"add_order",path:"add",component:bV,props:!0,meta:{active_menu:"orders",title:u("Create Order"),permission:"orders/create"}}]},products:{name:"products",path:"/products",component:h7,meta:{active_menu:"products",title:u("Products"),permission:"products/view"}},product_route:{path:"/products/:product_id(\\d+)",component:cT,name:"product_route",meta:{active_menu:"products",title:u("Products"),permission:["products/view","products/edit","integrations/manage"]},props:!0,children:[{name:"product_edit",path:"",props:!0,component:lq,meta:{active_menu:"products",title:u("Product Edit"),permission:"products/edit"}},{name:"product_integrations",path:"integrations",props:!0,component:gc,meta:{active_menu:"products",title:u("Integrations"),permission:"integrations/manage"}},{name:"product_integration_feed_editor",path:"integrations/:integration_id/:integration_name",component:nc,meta:{active_menu:"products",title:u("Edit Integration"),permission:"integrations/manage"}},{name:"SingleIntegration",path:"integrations/:integration_id",props:!0,component:AY,meta:{active_menu:"products",title:u("Integrations"),permission:"integrations/manage"}},{name:"product_upgrade_paths",path:"upgrade-paths",props:!0,component:Gq,meta:{active_menu:"products",title:u("Upgrade Paths"),permission:"integrations/manage"}},{name:"Integrations",path:"integrations",props:!0,component:gc,meta:{active_menu:"integrations",title:u("Product Integrations"),permission:"integrations/manage"}}]},product_bulk_insert:{name:"product_bulk_insert",path:"/products/bulk-insert",component:v1e,meta:{active_menu:"products",title:u("Product Bulk Insert"),permission:"products/create"}},product_bulk_edit:{name:"product_bulk_edit",path:"/products/bulk-edit",component:Wbe,meta:{active_menu:"products",title:u("Product Bulk Edit"),permission:"products/edit"}},product_attributes:{name:"product_attributes",path:"/products/attributes",component:$m,meta:{active_menu:"products",title:u("Attributes"),permission:"products/view"}},product_inventory:{name:"product_inventory",path:"/products/inventory",component:jJ,meta:{active_menu:"products",title:u("Inventory"),permission:"products/view"}},customers:{path:"/customers",component:Ig,meta:{active_menu:"customers",permission:["customers/view","customers/manage"]},children:[{name:"customers",path:"/customers",component:s_,meta:{active_menu:"customers",title:u("Customers"),permission:"customers/view"}},{name:"view_customer",path:":customer_id(\\d+)/view",component:xU,props:!0,meta:{active_menu:"customers",title:u("View Customer"),permission:"customers/view"}}]},reports:{name:"reports",path:"/reports",component:dte,meta:{active_menu:"reports",permission:"reports/view"},children:[{name:"reports_overview",path:"overview",component:mce,meta:{title:u("Overview"),permission:"reports/view"}},{name:"reports_sales",path:"sales",component:Rte,meta:{title:u("Sales"),permission:"reports/view"}},{name:"reports_orders",path:"orders",component:tne,meta:{title:u("Orders"),permission:"reports/view"}},{name:"reports_revenue",path:"revenue",component:Vae,meta:{title:u("Revenue"),permission:"reports/view"}},{name:"reports_refunds",path:"refunds",component:Lne,meta:{title:u("Refunds"),permission:"reports/view"}},{name:"reports_subscriptions",path:"subscriptions",component:Eoe,meta:{title:u("Subscriptions"),permission:"reports/view"}},{name:"subscriptions-retention",path:"subscriptions/subscriptions-retention",component:Kie,meta:{title:u("Retention"),permission:"reports/view"}},{name:"subscriptions-cohorts",path:"subscriptions/subscriptions-cohorts",component:()=>Yt(()=>import("./chunks/Cohort.js?ver=1.6.5"),[],import.meta.url),meta:{title:u("Cohorts"),permission:"reports/view"}},{name:"future_renewals",path:"subscriptions/future-renewals",component:Yoe,meta:{title:u("Future Renewals"),permission:"reports/view"}},{name:"reports_products",path:"products",component:bue,meta:{title:u("Product"),permission:"reports/view"}},{name:"reports_customer",path:"customer",component:mre,meta:{title:u("Customer"),permission:"reports/view"}},{name:"reports_sources",path:"sources",component:Xre,meta:{title:u("Sources"),permission:"reports/view"}}]},settings:{path:"/settings",component:vE,meta:{active_menu:"settings",title:u("Settings"),permission:["store/settings","store/sensitive"]},children:[{name:"store_settings",path:"store-settings",component:IV,meta:{active_menu:"settings",title:u("Settings"),permission:"store/settings"},children:[{name:"store_setup",path:"",component:Jl,meta:{title:u("Store Setup")}},{name:"pages_setup",path:"pages_setup",component:Jl,meta:{title:u("Pages Setup")}},{name:"single_product_setup",path:"single_product_setup",component:Jl,meta:{title:u("Product Page")}},{name:"cart_and_checkout",path:"cart_and_checkout",component:Jl,meta:{title:u("Cart & Checkout")}},{name:"subscriptions_setup",path:"subscriptions_setup",component:Jl,meta:{title:u("Subscriptions")}},{name:"checkout_fields",path:"checkout_fields",component:cge,meta:{}},{name:"appearance",path:"appearance",component:Jl,meta:{title:u("Appearance")}}]},{name:"compliance",path:"compliance",component:Jl,meta:{active_menu:"settings",title:u("Compliance"),permission:"store/settings"}},...ze.get("addon_settings_routes",[]).map(e=>({component:Jl,...e})),{name:"email_notifications",path:"email_notifications",component:vX,meta:{active_menu:"settings",title:u("Notifications"),permission:"store/sensitive"}},{name:"email_mailing_settings",path:"email_mailing_settings",component:cAe,meta:{active_menu:"settings",title:u("Mailing Settings"),permission:"store/sensitive"}},{name:"reminders",path:"email_mailing_settings/reminders",component:Jl,meta:{active_menu:"settings",title:u("Reminders"),permission:"store/sensitive"}},{name:"email_digest_settings",path:"email_digest_settings",component:gAe,meta:{active_menu:"settings",title:u("Store Digest"),permission:"store/sensitive"}},{path:"email_notifications/:name/",name:"email_notifications/edit",component:jX,meta:{active_menu:"settings",title:u("Edit Notification"),permission:"store/sensitive"},props:!0},{path:"email_notifications/add",name:"email_notifications/add",component:mZ,meta:{active_menu:"settings",title:u("Add Notification"),permission:"store/sensitive"}},{name:"licensing",path:"licensing",component:tT,meta:{active_menu:"settings",title:u("Licensing"),permission:"store/sensitive"}},{name:"payments",path:"payments",component:H$,meta:{active_menu:"settings",title:u("Payment Settings"),permission:"is_super_admin"}},{name:"gateway",component:hS,path:"payments",children:Ef,props:!0,meta:{active_menu:"settings",title:u("Payment Settings"),permission:"is_super_admin"}},{name:"invoice-packing",path:"invoice-packing",component:kv,meta:{active_menu:"settings",title:u("Invoice & Packing"),permission:"is_super_admin"}},{name:"pdf-template",path:"pdf-template",component:xv,meta:{active_menu:"settings",title:u("PDF Templates"),permission:"is_super_admin"},children:[{name:"pdf-template-list",path:"",component:Nv,meta:{active_menu:"settings",title:u("PDF Templates"),permission:"is_super_admin"}},{name:"pdf-template-settings",path:"settings",component:Fg,meta:{active_menu:"settings",title:u("PDF Template Settings"),permission:"is_super_admin"}},{name:"edit-pdf-template",path:":template/edit",component:rg,props:!0,meta:{active_menu:"settings",title:u("Edit PDF Template"),permission:"is_super_admin"}}]},{name:"roles",path:"roles",component:rE,meta:{active_menu:"settings",title:u("Role Settings"),permission:"is_super_admin"}},{name:"addons",path:"addons",component:Vce,meta:{active_menu:"settings",title:u("Features & addon"),permission:"is_super_admin"}},{name:"coupons",path:"coupons",component:Fc,meta:{active_menu:"coupons",title:u("Coupons Settings"),permission:"is_super_admin"}},{name:"storage",path:"storage",component:iZ,meta:{active_menu:"settings",title:u("Storage Providers"),permission:"is_super_admin"}},{name:"s3",path:"storage/s3",component:wc,props:!0,meta:{active_menu:"settings",title:u("S3"),permission:"is_super_admin"}},{name:"payment-design",path:"payments/:method/design",component:bS,meta:{active_menu:"settings",title:u("Gateway"),permission:"is_super_admin"},props:!0},{name:"drivers",component:wc,path:"storage",children:Uf,props:!0,meta:{active_menu:"settings",title:u("Storage Settings"),permission:"is_super_admin"}},{name:"tax_settings",path:"tax_settings",component:wAe,meta:{active_menu:"settings",title:u("Tax Settings"),permission:"store/settings"},children:[{name:"tax_configurations",path:"",component:Qpe,meta:{}},{name:"tax_rates",path:"tax_rates",component:Ype,meta:{}},{name:"eu",path:"eu",component:C_e,meta:{}},{name:"eu_country_tax_rates",path:"eu/:country/:group",component:Sc,props:!0,meta:{}},{name:"tax-rates-country-single",path:"tax_rates_country_single/:country/:group",component:Sc,props:!0,meta:{}}]}]},integrations:{name:"integrations",path:"/integrations",component:dx,meta:{active_menu:"integrations",title:u("Integrations"),permission:"integrations/view"}},global_feed_editor:{name:"feed_editor",path:"/global_integrations/:integration_id/:integration_name",component:nc,meta:{active_menu:"integrations",title:u("Global Integrations"),permission:"integrations/view"}},integration_editor:{name:"integration_editor",path:"/integrations/:integration_name",component:GS,meta:{active_menu:"integrations",title:u("Integrations"),permission:"integrations/manage"}},coupons:{name:"coupons",path:"/coupons",component:Fc,meta:{active_menu:"coupons",title:u("Coupons"),permission:"coupons/view"}},logs:{name:"logs",path:"/logs",component:aee,meta:{active_menu:"logs",title:u("Logs"),permission:"is_super_admin"}},taxes:{name:"taxes",path:"/taxes",component:wme,meta:{active_menu:"taxes",title:u("Taxes"),permission:"is_super_admin"}},add_or_edit_coupon_route:{name:"add_or_edit_coupon",path:"/coupons/add_or_edit_coupon/:coupon_id?",component:Kve,props:!0,meta:{active_menu:"coupons",title:u("Coupons"),permission:"coupons/manage"}},onboarding:{path:"/onboarding",component:x$,name:"onboarding",meta:{active_menu:"dashboard",title:u("Onboarding"),permission:"is_super_admin"}}};const Zbe={class:"fct-theme-button-container"},e0e={class:"theme-selected-button"},t0e={__name:"ThemeToggle",setup(e){const t=T(Te.MODE_LIGHT),a=c=>{t.value!==c&&(t.value=c,Te.apply(c))},l=[{value:"light",label:u("Light"),icon:"Sun"},{value:"dark",label:u("Dark"),icon:"Moon"},{value:"system",label:u("System"),icon:"Tools"}];Ds(()=>{const c=document.getElementById("theme-button-container");if(c){const p=c.querySelector(".fct-theme-button-container");p&&p.remove()}t.value=Te.getCurrentTheme(),t.value.toString().startsWith(Te.MODE_SYSTEM)&&(t.value=Te.MODE_SYSTEM)});const s=c=>{xe(()=>{t.value=Te.getCurrentTheme()})},i=c=>{a(c)};return Ie(()=>{window.addEventListener(Te.THEME_CHANGE_EVENT,s,!1)}),cl(()=>{window.removeEventListener(Te.THEME_CHANGE_EVENT,s,!1)}),(c,p)=>{const f=C("el-dropdown-item"),_=C("el-dropdown-menu"),g=C("el-dropdown");return r(),h("div",Zbe,[n(g,{placement:"bottom-end",trigger:"click","popper-class":"fct-dropdown",onCommand:i},{dropdown:d(()=>[n(_,null,{default:d(()=>[(r(),h(P,null,te(l,y=>n(f,{key:y.value,command:y.value,class:de({active:t.value===y.value})},{default:d(()=>[n(Y,{name:y.icon},null,8,["name"]),R(" "+m(y.label),1)]),_:2},1032,["command","class"])),64))]),_:1})]),default:d(()=>[o("div",e0e,[t.value==="light"?(r(),E(Y,{key:0,name:"Sun"})):t.value==="dark"?(r(),E(Y,{key:1,name:"Moon"})):t.value==="system"?(r(),E(Y,{key:2,name:"Tools"})):x("",!0)])]),_:1})])}}};function ns(e){return Array.isArray?Array.isArray(e):Df(e)==="[object Array]"}function a0e(e){if(typeof e=="string")return e;let t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function l0e(e){return e==null?"":a0e(e)}function Hl(e){return typeof e=="string"}function If(e){return typeof e=="number"}function s0e(e){return e===!0||e===!1||n0e(e)&&Df(e)=="[object Boolean]"}function Qf(e){return typeof e=="object"}function n0e(e){return Qf(e)&&e!==null}function hl(e){return e!=null}function Ar(e){return!e.trim().length}function Df(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const o0e="Incorrect 'index' type",i0e=e=>`Invalid value for key ${e}`,r0e=e=>`Pattern length exceeds max of ${e}.`,d0e=e=>`Missing ${e} property in key`,u0e=e=>`Property 'weight' in key '${e}' must be a positive integer`,Dc=Object.prototype.hasOwnProperty;class c0e{constructor(t){this._keys=[],this._keyMap={};let a=0;t.forEach(l=>{let s=Vf(l);this._keys.push(s),this._keyMap[s.id]=s,a+=s.weight}),this._keys.forEach(l=>{l.weight/=a})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Vf(e){let t=null,a=null,l=null,s=1,i=null;if(Hl(e)||ns(e))l=e,t=Vc(e),a=jr(e);else{if(!Dc.call(e,"name"))throw new Error(d0e("name"));const c=e.name;if(l=c,Dc.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(u0e(c));t=Vc(c),a=jr(c),i=e.getFn}return{path:t,id:a,weight:s,src:l,getFn:i}}function Vc(e){return ns(e)?e:e.split(".")}function jr(e){return ns(e)?e.join("."):e}function A0e(e,t){let a=[],l=!1;const s=(i,c,p)=>{if(hl(i))if(!c[p])a.push(i);else{let f=c[p];const _=i[f];if(!hl(_))return;if(p===c.length-1&&(Hl(_)||If(_)||s0e(_)))a.push(l0e(_));else if(ns(_)){l=!0;for(let g=0,y=_.length;g<y;g+=1)s(_[g],c,p+1)}else c.length&&s(_,c,p+1)}};return s(e,Hl(t)?t.split("."):t,0),l?a:a[0]}const p0e={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},f0e={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},m0e={location:0,threshold:.6,distance:100},h0e={useExtendedSearch:!1,getFn:A0e,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var Et={...f0e,...p0e,...m0e,...h0e};const _0e=/[^ ]+/g;function v0e(e=1,t=3){const a=new Map,l=Math.pow(10,t);return{get(s){const i=s.match(_0e).length;if(a.has(i))return a.get(i);const c=1/Math.pow(i,.5*e),p=parseFloat(Math.round(c*l)/l);return a.set(i,p),p},clear(){a.clear()}}}class Md{constructor({getFn:t=Et.getFn,fieldNormWeight:a=Et.fieldNormWeight}={}){this.norm=v0e(a,3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((a,l)=>{this._keysMap[a.id]=l})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,Hl(this.docs[0])?this.docs.forEach((t,a)=>{this._addString(t,a)}):this.docs.forEach((t,a)=>{this._addObject(t,a)}),this.norm.clear())}add(t){const a=this.size();Hl(t)?this._addString(t,a):this._addObject(t,a)}removeAt(t){this.records.splice(t,1);for(let a=t,l=this.size();a<l;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(t,a){return t[this._keysMap[a]]}size(){return this.records.length}_addString(t,a){if(!hl(t)||Ar(t))return;let l={v:t,i:a,n:this.norm.get(t)};this.records.push(l)}_addObject(t,a){let l={i:a,$:{}};this.keys.forEach((s,i)=>{let c=s.getFn?s.getFn(t):this.getFn(t,s.path);if(hl(c)){if(ns(c)){let p=[];const f=[{nestedArrIndex:-1,value:c}];for(;f.length;){const{nestedArrIndex:_,value:g}=f.pop();if(hl(g))if(Hl(g)&&!Ar(g)){let y={v:g,i:_,n:this.norm.get(g)};p.push(y)}else ns(g)&&g.forEach((y,v)=>{f.push({nestedArrIndex:v,value:y})})}l.$[i]=p}else if(Hl(c)&&!Ar(c)){let p={v:c,n:this.norm.get(c)};l.$[i]=p}}}),this.records.push(l)}toJSON(){return{keys:this.keys,records:this.records}}}function Tf(e,t,{getFn:a=Et.getFn,fieldNormWeight:l=Et.fieldNormWeight}={}){const s=new Md({getFn:a,fieldNormWeight:l});return s.setKeys(e.map(Vf)),s.setSources(t),s.create(),s}function g0e(e,{getFn:t=Et.getFn,fieldNormWeight:a=Et.fieldNormWeight}={}){const{keys:l,records:s}=e,i=new Md({getFn:t,fieldNormWeight:a});return i.setKeys(l),i.setIndexRecords(s),i}function ko(e,{errors:t=0,currentLocation:a=0,expectedLocation:l=0,distance:s=Et.distance,ignoreLocation:i=Et.ignoreLocation}={}){const c=t/e.length;if(i)return c;const p=Math.abs(l-a);return s?c+p/s:p?1:c}function y0e(e=[],t=Et.minMatchCharLength){let a=[],l=-1,s=-1,i=0;for(let c=e.length;i<c;i+=1){let p=e[i];p&&l===-1?l=i:!p&&l!==-1&&(s=i-1,s-l+1>=t&&a.push([l,s]),l=-1)}return e[i-1]&&i-l>=t&&a.push([l,i-1]),a}const Ss=32;function b0e(e,t,a,{location:l=Et.location,distance:s=Et.distance,threshold:i=Et.threshold,findAllMatches:c=Et.findAllMatches,minMatchCharLength:p=Et.minMatchCharLength,includeMatches:f=Et.includeMatches,ignoreLocation:_=Et.ignoreLocation}={}){if(t.length>Ss)throw new Error(r0e(Ss));const g=t.length,y=e.length,v=Math.max(0,Math.min(l,y));let w=i,k=v;const b=p>1||f,S=b?Array(y):[];let $;for(;($=e.indexOf(t,k))>-1;){let V=ko(t,{currentLocation:$,expectedLocation:v,distance:s,ignoreLocation:_});if(w=Math.min(V,w),k=$+g,b){let I=0;for(;I<g;)S[$+I]=1,I+=1}}k=-1;let D=[],F=1,B=g+y;const U=1<<g-1;for(let V=0;V<g;V+=1){let I=0,M=B;for(;I<M;)ko(t,{errors:V,currentLocation:v+M,expectedLocation:v,distance:s,ignoreLocation:_})<=w?I=M:B=M,M=Math.floor((B-I)/2+I);B=M;let O=Math.max(1,v-M+1),L=c?y:Math.min(v+M,y)+g,H=Array(L+2);H[L+1]=(1<<V)-1;for(let W=L;W>=O;W-=1){let G=W-1,Z=a[e.charAt(G)];if(b&&(S[G]=+!!Z),H[W]=(H[W+1]<<1|1)&Z,V&&(H[W]|=(D[W+1]|D[W])<<1|1|D[W+1]),H[W]&U&&(F=ko(t,{errors:V,currentLocation:G,expectedLocation:v,distance:s,ignoreLocation:_}),F<=w)){if(w=F,k=G,k<=v)break;O=Math.max(1,2*v-k)}}if(ko(t,{errors:V+1,currentLocation:v,expectedLocation:v,distance:s,ignoreLocation:_})>w)break;D=H}const Q={isMatch:k>=0,score:Math.max(.001,F)};if(b){const V=y0e(S,p);V.length?f&&(Q.indices=V):Q.isMatch=!1}return Q}function w0e(e){let t={};for(let a=0,l=e.length;a<l;a+=1){const s=e.charAt(a);t[s]=(t[s]||0)|1<<l-a-1}return t}const si=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class Mf{constructor(t,{location:a=Et.location,threshold:l=Et.threshold,distance:s=Et.distance,includeMatches:i=Et.includeMatches,findAllMatches:c=Et.findAllMatches,minMatchCharLength:p=Et.minMatchCharLength,isCaseSensitive:f=Et.isCaseSensitive,ignoreDiacritics:_=Et.ignoreDiacritics,ignoreLocation:g=Et.ignoreLocation}={}){if(this.options={location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:f,ignoreDiacritics:_,ignoreLocation:g},t=f?t:t.toLowerCase(),t=_?si(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const y=(w,k)=>{this.chunks.push({pattern:w,alphabet:w0e(w),startIndex:k})},v=this.pattern.length;if(v>Ss){let w=0;const k=v%Ss,b=v-k;for(;w<b;)y(this.pattern.substr(w,Ss),w),w+=Ss;if(k){const S=v-Ss;y(this.pattern.substr(S),S)}}else y(this.pattern,0)}searchIn(t){const{isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s}=this.options;if(t=a?t:t.toLowerCase(),t=l?si(t):t,this.pattern===t){let b={isMatch:!0,score:0};return s&&(b.indices=[[0,t.length-1]]),b}const{location:i,distance:c,threshold:p,findAllMatches:f,minMatchCharLength:_,ignoreLocation:g}=this.options;let y=[],v=0,w=!1;this.chunks.forEach(({pattern:b,alphabet:S,startIndex:$})=>{const{isMatch:D,score:F,indices:B}=b0e(t,b,S,{location:i+$,distance:c,threshold:p,findAllMatches:f,minMatchCharLength:_,includeMatches:s,ignoreLocation:g});D&&(w=!0),v+=F,D&&B&&(y=[...y,...B])});let k={isMatch:w,score:w?v/this.chunks.length:1};return w&&s&&(k.indices=y),k}}class Cs{constructor(t){this.pattern=t}static isMultiMatch(t){return Tc(t,this.multiRegex)}static isSingleMatch(t){return Tc(t,this.singleRegex)}search(){}}function Tc(e,t){const a=e.match(t);return a?a[1]:null}class C0e extends Cs{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const a=t===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class k0e extends Cs{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const l=t.indexOf(this.pattern)===-1;return{isMatch:l,score:l?0:1,indices:[0,t.length-1]}}}class B0e extends Cs{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const a=t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class x0e extends Cs{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const a=!t.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class S0e extends Cs{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const a=t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class F0e extends Cs{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const a=!t.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,t.length-1]}}}class Lf extends Cs{constructor(t,{location:a=Et.location,threshold:l=Et.threshold,distance:s=Et.distance,includeMatches:i=Et.includeMatches,findAllMatches:c=Et.findAllMatches,minMatchCharLength:p=Et.minMatchCharLength,isCaseSensitive:f=Et.isCaseSensitive,ignoreDiacritics:_=Et.ignoreDiacritics,ignoreLocation:g=Et.ignoreLocation}={}){super(t),this._bitapSearch=new Mf(t,{location:a,threshold:l,distance:s,includeMatches:i,findAllMatches:c,minMatchCharLength:p,isCaseSensitive:f,ignoreDiacritics:_,ignoreLocation:g})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Rf extends Cs{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let a=0,l;const s=[],i=this.pattern.length;for(;(l=t.indexOf(this.pattern,a))>-1;)a=l+i,s.push([l,a-1]);const c=!!s.length;return{isMatch:c,score:c?0:1,indices:s}}}const qr=[C0e,Rf,B0e,x0e,F0e,S0e,k0e,Lf],Mc=qr.length,$0e=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,E0e="|";function U0e(e,t={}){return e.split(E0e).map(a=>{let l=a.trim().split($0e).filter(i=>i&&!!i.trim()),s=[];for(let i=0,c=l.length;i<c;i+=1){const p=l[i];let f=!1,_=-1;for(;!f&&++_<Mc;){const g=qr[_];let y=g.isMultiMatch(p);y&&(s.push(new g(y,t)),f=!0)}if(!f)for(_=-1;++_<Mc;){const g=qr[_];let y=g.isSingleMatch(p);if(y){s.push(new g(y,t));break}}}return s})}const I0e=new Set([Lf.type,Rf.type]);class Q0e{constructor(t,{isCaseSensitive:a=Et.isCaseSensitive,ignoreDiacritics:l=Et.ignoreDiacritics,includeMatches:s=Et.includeMatches,minMatchCharLength:i=Et.minMatchCharLength,ignoreLocation:c=Et.ignoreLocation,findAllMatches:p=Et.findAllMatches,location:f=Et.location,threshold:_=Et.threshold,distance:g=Et.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:l,includeMatches:s,minMatchCharLength:i,findAllMatches:p,ignoreLocation:c,location:f,threshold:_,distance:g},t=a?t:t.toLowerCase(),t=l?si(t):t,this.pattern=t,this.query=U0e(this.pattern,this.options)}static condition(t,a){return a.useExtendedSearch}searchIn(t){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:l,isCaseSensitive:s,ignoreDiacritics:i}=this.options;t=s?t:t.toLowerCase(),t=i?si(t):t;let c=0,p=[],f=0;for(let _=0,g=a.length;_<g;_+=1){const y=a[_];p.length=0,c=0;for(let v=0,w=y.length;v<w;v+=1){const k=y[v],{isMatch:b,indices:S,score:$}=k.search(t);if(b){if(c+=1,f+=$,l){const D=k.constructor.type;I0e.has(D)?p=[...p,...S]:p.push(S)}}else{f=0,c=0,p.length=0;break}}if(c){let v={isMatch:!0,score:f/c};return l&&(v.indices=p),v}}return{isMatch:!1,score:1}}}const Yr=[];function D0e(...e){Yr.push(...e)}function Wr(e,t){for(let a=0,l=Yr.length;a<l;a+=1){let s=Yr[a];if(s.condition(e,t))return new s(e,t)}return new Mf(e,t)}const ni={AND:"$and",OR:"$or"},Jr={PATH:"$path",PATTERN:"$val"},Xr=e=>!!(e[ni.AND]||e[ni.OR]),V0e=e=>!!e[Jr.PATH],T0e=e=>!ns(e)&&Qf(e)&&!Xr(e),Lc=e=>({[ni.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Of(e,t,{auto:a=!0}={}){const l=s=>{let i=Object.keys(s);const c=V0e(s);if(!c&&i.length>1&&!Xr(s))return l(Lc(s));if(T0e(s)){const f=c?s[Jr.PATH]:i[0],_=c?s[Jr.PATTERN]:s[f];if(!Hl(_))throw new Error(i0e(f));const g={keyId:jr(f),pattern:_};return a&&(g.searcher=Wr(_,t)),g}let p={children:[],operator:i[0]};return i.forEach(f=>{const _=s[f];ns(_)&&_.forEach(g=>{p.children.push(l(g))})}),p};return Xr(e)||(e=Lc(e)),l(e)}function M0e(e,{ignoreFieldNorm:t=Et.ignoreFieldNorm}){e.forEach(a=>{let l=1;a.matches.forEach(({key:s,norm:i,score:c})=>{const p=s?s.weight:null;l*=Math.pow(c===0&&p?Number.EPSILON:c,(p||1)*(t?1:i))}),a.score=l})}function L0e(e,t){const a=e.matches;t.matches=[],hl(a)&&a.forEach(l=>{if(!hl(l.indices)||!l.indices.length)return;const{indices:s,value:i}=l;let c={indices:s,value:i};l.key&&(c.key=l.key.src),l.idx>-1&&(c.refIndex=l.idx),t.matches.push(c)})}function R0e(e,t){t.score=e.score}function O0e(e,t,{includeMatches:a=Et.includeMatches,includeScore:l=Et.includeScore}={}){const s=[];return a&&s.push(L0e),l&&s.push(R0e),e.map(i=>{const{idx:c}=i,p={item:t[c],refIndex:c};return s.length&&s.forEach(f=>{f(i,p)}),p})}class mn{constructor(t,a={},l){this.options={...Et,...a},this.options.useExtendedSearch,this._keyStore=new c0e(this.options.keys),this.setCollection(t,l)}setCollection(t,a){if(this._docs=t,a&&!(a instanceof Md))throw new Error(o0e);this._myIndex=a||Tf(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(t){hl(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){const a=[];for(let l=0,s=this._docs.length;l<s;l+=1){const i=this._docs[l];t(i,l)&&(this.removeAt(l),l-=1,s-=1,a.push(i))}return a}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:a=-1}={}){const{includeMatches:l,includeScore:s,shouldSort:i,sortFn:c,ignoreFieldNorm:p}=this.options;let f=Hl(t)?Hl(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return M0e(f,{ignoreFieldNorm:p}),i&&f.sort(c),If(a)&&a>-1&&(f=f.slice(0,a)),O0e(f,this._docs,{includeMatches:l,includeScore:s})}_searchStringList(t){const a=Wr(t,this.options),{records:l}=this._myIndex,s=[];return l.forEach(({v:i,i:c,n:p})=>{if(!hl(i))return;const{isMatch:f,score:_,indices:g}=a.searchIn(i);f&&s.push({item:i,idx:c,matches:[{score:_,value:i,norm:p,indices:g}]})}),s}_searchLogical(t){const a=Of(t,this.options),l=(p,f,_)=>{if(!p.children){const{keyId:y,searcher:v}=p,w=this._findMatches({key:this._keyStore.get(y),value:this._myIndex.getValueForItemAtKeyId(f,y),searcher:v});return w&&w.length?[{idx:_,item:f,matches:w}]:[]}const g=[];for(let y=0,v=p.children.length;y<v;y+=1){const w=p.children[y],k=l(w,f,_);if(k.length)g.push(...k);else if(p.operator===ni.AND)return[]}return g},s=this._myIndex.records,i={},c=[];return s.forEach(({$:p,i:f})=>{if(hl(p)){let _=l(a,p,f);_.length&&(i[f]||(i[f]={idx:f,item:p,matches:[]},c.push(i[f])),_.forEach(({matches:g})=>{i[f].matches.push(...g)}))}}),c}_searchObjectList(t){const a=Wr(t,this.options),{keys:l,records:s}=this._myIndex,i=[];return s.forEach(({$:c,i:p})=>{if(!hl(c))return;let f=[];l.forEach((_,g)=>{f.push(...this._findMatches({key:_,value:c[g],searcher:a}))}),f.length&&i.push({idx:p,item:c,matches:f})}),i}_findMatches({key:t,value:a,searcher:l}){if(!hl(a))return[];let s=[];if(ns(a))a.forEach(({v:i,i:c,n:p})=>{if(!hl(i))return;const{isMatch:f,score:_,indices:g}=l.searchIn(i);f&&s.push({score:_,key:t,value:i,idx:c,norm:p,indices:g})});else{const{v:i,n:c}=a,{isMatch:p,score:f,indices:_}=l.searchIn(i);p&&s.push({score:f,key:t,value:i,norm:c,indices:_})}return s}}mn.version="7.1.0";mn.createIndex=Tf;mn.parseIndex=g0e;mn.config=Et;mn.parseQuery=Of;D0e(Q0e);const P0e=(ze.get("payment_routes")||[]).filter(e=>!e.upcoming).map(e=>{const t=e.meta.admin_title||e.meta.title||e.meta.label||e.name;return{title:t,subtitle:u("Manage %1$s",t),path:"/settings/payments/"+e.path}}),H0e=[{title:u("Dashboard"),path:"/"},{title:u("Orders"),path:"/orders"},{title:u("Create Order"),path:"/orders/add"},{title:u("Customers"),path:"/customers"},{title:u("Products"),path:"/products"},{title:u("Product Inventory"),path:"/products/inventory"},{title:u("Bulk Import Products"),path:"/products/bulk-insert"},{title:u("Integrations"),path:"/integrations"},{title:u("Coupons"),path:"/coupons"},{title:u("Logs"),path:"/logs"},{title:u("Taxes"),path:"/taxes"},{title:u("Reports"),path:"/reports/overview"},{title:u("Sales Report"),path:"/reports/sales"},{title:u("Orders Report"),path:"/reports/orders"},{title:u("Revenue Report"),path:"/reports/revenue"},{title:u("Refunds Report"),path:"/reports/refunds"},{title:u("Subscriptions Report"),path:"/reports/subscriptions"},{title:u("Future Renewals Report"),path:"/reports/subscriptions/future-renewals"},{title:u("Product Report"),path:"/reports/products"},{title:u("Customer Report"),path:"/reports/customer"},{title:u("Traffic Sources Report"),path:"/reports/sources"},...P0e],N0e=H0e.map(({title:e,subtitle:t,path:a})=>({title:e,...t?{subtitle:t}:{},data:{type:"action",action:({router:l})=>{l.push({path:a})},show_description:!1}})),K0e=[{title:"Theme",title_resolver:()=>{let t=(Te.isDark()?"dark":"light")==="light"?u("Dark"):u("Light");return u("Change theme to %1$s",t)},data:{type:"action",action:()=>{let t=(Te.isDark()?"dark":"light")==="light"?"dark":"light";Te.apply(t,{fromShortcut:!0})}}}],Rc={"/settings/store-settings":u("Store Setup"),"/settings/store-settings/pages_setup":u("Pages Setup"),"/settings/store-settings/single_product_setup":u("Single Product & Order Setup"),"/settings/store-settings/cart_and_checkout":u("Cart and Checkout"),"/settings/compliance":u("Compliance"),"/settings/store-settings/subscriptions_setup":u("Subscriptions Setup"),"/settings/store-settings/checkout_fields":u("Checkout Fields"),"/settings/store-settings/appearance":u("Appearance"),"/settings/email_notifications":u("Email Notifications"),"/settings/email_mailing_settings":u("Mailing Settings"),"/settings/email_mailing_settings/reminders":u("Reminders"),"/settings/licensing":u("Licensing"),"/settings/payments":u("Payment Settings"),"/settings/invoice-packing":u("Invoice & Packing Slips"),"/settings/pdf-template":u("PDF Templates"),"/settings/roles":u("Role Settings"),"/settings/addons":u("Features & Addons"),"/settings/tax_settings":u("Tax Settings"),"/settings/tax_settings/tax_rates":u("Tax Rates"),"/settings/tax_settings/eu":u("EU VAT Settings"),"/settings/storage":u("Storage Providers"),"/settings/coupons":u("Coupon Settings")};let Pf=[];Object.keys(Rc).forEach(e=>{const t=Rc[e];Pf.push({title:t,data:{type:"action",action:({router:a})=>{a.push({path:e})},description:u("Go to %1$s",t),show_description:!1}})});const G0e=[],z0e={Menu:N0e,Actions:K0e,Settings:Pf,Shortcuts:G0e},Zr=[];Object.entries(z0e).forEach(([e,t])=>{t.forEach((a,l)=>{Zr.push({...a,id:`${e.toString().toLowerCase()}-${l}`,group:[e]})})});const j0e=()=>({shouldSort:!0,threshold:.6,keys:[{name:"title",getFn:e=>e.title},{name:"data.description",getFn:e=>e.data.description},{name:"group",weight:2,getFn:e=>e.group}]}),q0e={class:"navigable-list-container fct-global-search-result-container"},Y0e={key:0,class:"no-results fct-global-search-result-not-found"},W0e={key:1},J0e=["tabindex","onClick","onKeydown"],X0e={__name:"NavigableList",props:{items:{type:Array,required:!0,default:()=>[]},noResultsText:{type:String,default:u("No results found")},onAction:{type:Function,required:!0}},setup(e,{expose:t}){const a=e,l=T(-1),s=td("listContainer"),i=T({}),c=(k,b)=>{b&&(i.value[k]=b)},p=k=>{const b=a.items.length;if(b===0)return;const S=b-1;k==="up"?l.value=l.value<=0?S:l.value-1:k==="down"&&(l.value=l.value>=S?0:l.value+1),f()},f=()=>{const k=s.value,b=i.value[l.value];b&&k&&(b.scrollIntoView({behavior:"smooth",block:"nearest"}),xe(()=>{b.focus()}))},_=k=>{l.value=k,g(k)},g=k=>{k>=0&&k<a.items.length&&a.onAction(a.items[k],k)},y=()=>{l.value=-1};return t({focusList:k=>{k=k??a.items.length-1,k>=0&&(l.value=k,xe(()=>{i.value[k]&&i.value[k].focus()}))},resetSelection:y,performFirstAction:()=>{a.items.length>0?(l.value=0,setTimeout(()=>{g(0)},200)):l.value=-1}}),be(()=>a.items,k=>{y(),k.length>0&&xe(()=>{})},{immediate:!0}),be(l,()=>{}),(k,b)=>(r(),h("div",q0e,[e.items.length===0?(r(),h("div",Y0e,[n(Y,{name:"Empty/GlobalSearch"}),R(" "+m(e.noResultsText),1)])):(r(),h("div",W0e,[o("ul",{ref_key:"listContainer",ref:s,class:"navigable-list fct-global-search-result-list"},[(r(!0),h(P,null,te(e.items,(S,$)=>(r(),h("li",{key:$,ref_for:!0,ref:D=>c($,D),class:de({selected:$===l.value}),tabindex:$,onClick:D=>_($),onKeydown:[b[0]||(b[0]=xa(Ge(D=>p("up"),["prevent"]),["arrow-up"])),b[1]||(b[1]=xa(Ge(D=>p("down"),["prevent"]),["arrow-down"])),xa(D=>g($),["enter"])]},[ga(k.$slots,"default",{item:S,index:$,isSelected:$===l.value},void 0,!0)],42,J0e))),128))],512)]))]))}},ed=nt(X0e,[["__scopeId","data-v-2379fe26"]]),Z0e={class:"fct-search-result-label"},ewe={class:"fct-search-result-title"},twe={key:0,class:"fct-search-result-subtitle"},awe={key:1,class:"fct-search-result-subtitle"},lwe={class:"action-icon"},swe={class:"recent-search-title"},nwe={class:"fct-search-result-label"},owe={class:"fct-search-result-title"},iwe={key:0,class:"fct-search-result-subtitle"},rwe={key:1,class:"fct-search-result-subtitle"},dwe={class:"action-icon"},pr="recent_actions",uwe={__name:"ResultList",props:{query:{type:String,required:!0},searchResults:{type:Array,required:!0,default:()=>[]},onActionPerformed:{type:Function,required:!0},focusInput:{type:Function,required:!0},searchData:{type:Array,required:!0,default:()=>[]}},setup(e,{expose:t}){const a=sl();Jt().ctx;const l=e,s=T(0),i=T({}),c=T(),p=(S,$)=>{const F=S.item.data,B=_(F.type);if(B==="link"){let U=_(F.url);_(F.new_tab)?window.open(U,"_blank"):window.location.href=U}else B==="action"&&_(F.action);f(S),l.onActionPerformed()},f=S=>{const $=S.item.id;let D=Vt.get(pr)||[];D=D.filter(F=>F!==$),D.unshift($),D=D.slice(0,5),Vt.set(pr,D)},_=S=>typeof S=="function"?g(S):S,g=async S=>await S({query:l.query,router:a}),y=()=>{var S;(S=c.value)==null||S.resetSelection()},v=()=>{var S;(S=c.value)==null||S.focusList(0)},w=()=>{var S;(S=c.value)==null||S.performFirstAction()};be(()=>l.searchResults,async()=>{i.value={},i.value=l.searchResults??{},s.value=Object.keys(i.value).length-1;let S=i.value;for(const $ of Object.keys(S)){const D=S[$];D.item.title_resolver&&(S[$].item.title=await _(D.item.title_resolver))}i.value={...S}});const k=T([]),b=async()=>{const S=Vt.get(pr)||[];let $=dt.whereIn(l.searchData,"id",S),D=[];for(const F of $)typeof F.title_resolver=="function"&&(F.title=await _(F.title_resolver)),D.push({item:F});k.value=D};return Ie(()=>{b()}),t({focusList:v,resetSelection:y,performFirstAction:w,fetchRecentActions:b}),(S,$)=>(r(),h(P,null,[e.query||k.value.length<1?(r(),E(ed,{key:0,items:e.searchResults,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:D,index:F,isSelected:B})=>{var U,Q,V;return[o("span",Z0e,[o("span",ewe,m(D.item.title),1),(U=D.item)!=null&&U.subtitle?(r(),h("span",twe,m(D.item.subtitle),1)):((V=(Q=D.item)==null?void 0:Q.data)==null?void 0:V.show_description)===!0?(r(),h("span",awe,m(D.item.data.description),1)):x("",!0)]),o("div",lwe,[n(Y,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])):x("",!0),!e.query&&k.value.length>0?(r(),h(P,{key:1},[o("span",swe,m(A(u)("Recent Actions")),1),n(ed,{items:k.value,"on-action":p,"no-results-text":A(u)("No matches found"),ref_key:"navigableList",ref:c},{default:d(({item:D,index:F,isSelected:B})=>{var U,Q,V;return[o("span",nwe,[o("span",owe,m(D.item.title),1),(U=D.item)!=null&&U.subtitle?(r(),h("span",iwe,m(D.item.subtitle),1)):((V=(Q=D.item)==null?void 0:Q.data)==null?void 0:V.show_description)===!0?(r(),h("span",rwe,m(D.item.data.description),1)):x("",!0)]),o("div",dwe,[n(Y,{name:"Enter"})])]}),_:1},8,["items","no-results-text"])],64)):x("",!0)],64))}},cwe=nt(uwe,[["__scopeId","data-v-ccb0ebef"]]),Awe={class:"fct-global-search-product-wrap"},pwe={class:"fct-global-search-product-left-info"},fwe={key:0,class:"type"},mwe={key:0,class:"price-and-status"},hwe={__name:"Product",props:{product:{type:Object,required:!0}},setup(e){const t=l=>l.min_price===l.max_price?Kt(l.min_price,!0):`${Kt(l.min_price,!0)} - ${Kt(l.max_price,!0)}`,a=l=>l==="publish"?u("published"):l==="future"?u("scheduled"):l;return(l,s)=>(r(),h("div",Awe,[o("div",pwe,[n(id,{product:e.product},null,8,["product"]),e.product.detail?(r(),h("span",fwe,[R(m(A(da).headline(e.product.detail.variation_type))+" ",1),s[0]||(s[0]=o("br",null,null,-1)),R(" "+m(A(da).headline(e.product.detail.fulfillment_type)),1)])):x("",!0)]),e.product.detail?(r(),h("span",mwe,[R(m(t(e.product.detail))+" ",1),(r(),E(fa,{key:e.product.ID,status:e.product.post_status},{default:d(()=>[R(m(a(e.product.post_status)),1)]),_:1},8,["status"]))])):x("",!0)]))}},_we={class:"fct-global-search-order-wrap"},vwe={class:"fct-global-search-order-header"},gwe={class:"fct-global-search-order-id"},ywe={class:"items"},bwe={class:"fct-global-search-order-header-meta"},wwe={class:"date"},Cwe=["innerHTML"],kwe={class:"customer-name"},Bwe={class:"fct-global-search-order-status-wrapper"},xwe=["src","alt"],Swe={__name:"Order",props:{order:{type:Object,required:!0}},setup(e){const t=a=>dt.get(window,"fluentCartAdminApp.payment_logos."+a);return(a,l)=>{var i;const s=C("el-tag");return r(),h("div",_we,[o("div",vwe,[o("div",gwe,[R(" #"+m(e.order.id)+" ",1),o("span",ywe,m(A(u)("%s Items",e.order.order_items.length)),1)]),o("div",bwe,[o("span",wwe,[n(Pa,{"date-time":e.order.created_at},null,8,["date-time"])]),l[0]||(l[0]=o("span",{class:"circle"},null,-1)),o("span",{class:"total-price",innerHTML:A(Kt)(e.order.total_amount,!0,!1,e.order.currency)},null,8,Cwe),l[1]||(l[1]=o("span",{class:"circle"},null,-1)),o("span",kwe,m(((i=e.order.customer)==null?void 0:i.full_name)||A(u)("No Name")),1)])]),o("div",Bwe,[n(fa,{status:e.order.payment_status,"hide-icon":!0},null,8,["status"]),t(e.order.payment_method)?(r(),h("img",{key:0,src:t(e.order.payment_method),alt:A(da).headline(e.order.payment_method)},null,8,xwe)):(r(),E(s,{key:1,type:"info",round:"",size:"small",class:"capitalize"},{default:d(()=>[R(m(A(da).headline(e.order.payment_method)),1)]),_:1}))])])}}},Fwe={class:"fct-global-search-customer-wrap"},$we={class:"fct-customer-card"},Ewe={class:"fct-customer-avatar"},Uwe=["src"],Iwe={class:"fct-customer-details"},Qwe={class:"fct-customer-name"},Dwe={class:"fct-customer-id"},Vwe={class:"fct-customer-email"},Twe={class:"purchase-count"},Mwe={class:"date"},Lwe={__name:"Customer",props:{customer:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Fwe,[o("div",$we,[o("div",Ewe,[o("img",{src:e.customer.photo,alt:"avatar"},null,8,Uwe)]),o("div",Iwe,[o("div",Qwe,[R(m(e.customer.full_name||t.$t("No Name"))+" ",1),o("span",Dwe,"#"+m(e.customer.id),1)]),o("div",Vwe,[R(m(e.customer.email)+" ",1),a[0]||(a[0]=o("span",{class:"circle"},null,-1)),a[1]||(a[1]=R()),o("span",Twe,"Purchase: "+m(e.customer.purchase_count),1)])])]),o("span",Mwe,[n(Pa,{"date-time":e.customer.last_purchase_date},null,8,["date-time"])])]))}},Rwe={class:"fct-global-search-coupon-wrap"},Owe={class:"amount"},Pwe={__name:"Coupon",props:{coupon:{type:Object,required:!0}},setup(e){return(t,a)=>(r(),h("div",Rwe,[o("span",null,m(e.coupon.title),1),o("span",null,m(e.coupon.code),1),o("span",Owe,m(A(Kt)(e.coupon.amount,!0)),1)]))}},Hwe={class:"fct-global-remote-result-container"},Nwe={class:"fct-global-remote-result-label"},Kwe={class:"text"},Gwe={class:"navigable-content"},zwe={class:"action-icon"},jwe={__name:"RemoteResult",emits:["close-modal","onRemoteSearchStateChange"],setup(e,{expose:t,emit:a}){const l=a,s=sl(),i=T({}),c=T(""),p=T(),f=T({}),_=T([]),g=V=>{y.value=!1,_.value=S.data.tableData,l("onRemoteSearchStateChange",!1)},y=T(!1),v={orders:_A({fetch:!1}),products:tf({fetch:!1}),customers:hA({fetch:!1}),coupons:kf({fetch:!1})},w=()=>{},k=()=>{var V;(V=p.value)==null||V.focusList(0)},b=()=>{var V;(V=p.value)==null||V.performFirstAction()};Ds(()=>{for(const V of Object.keys(v))v[V].onDataLoaded(g)});let S=null;const $=()=>{S=v[i.value.key],S.data.search=c.value,y.value=!0,S.fetch(),l("onRemoteSearchStateChange",!0)},D=cd.debounce($,800),F=(V,I)=>{if(_.value=[],S&&(S.data.search=""),i.value=I,f.value={title:I.title,key:I.key},!V){c.value="";return}c.value=V,D()},B=()=>{s.push({name:f.value.key,query:{search:c.value}}),l("close-modal")},U={orders:{name:"view_order",key:"order_id"},products:{name:"product_edit",key:"product_id"},customers:{name:"view_customer",key:"customer_id"},coupons:{name:"edit_coupon",key:"coupon_id"}},Q=V=>{i.value.key in U&&(s.push({name:U[i.value.key].name,params:{[U[i.value.key].key]:V.id||V.ID,action:"edit"}}),l("close-modal"))};return t({fetchData:F,focusList:k,resetSelection:w,performFirstAction:b}),(V,I)=>(r(),h("div",Hwe,[o("div",Nwe,[o("span",Kwe,m(i.value.title),1),f.value.key?(r(),h("span",{key:0,class:"view-all",onClick:B},m(c.value?A(u)('Search "%1$s" in %2$s',c.value,f.value.title):A(u)("See All %s",f.value.title)),1)):x("",!0)]),n(ed,{items:_.value,"on-action":M=>{Q(M)},"no-results-text":c.value?A(u)("No matches found for %s",i.value.title):A(u)("Type something to find %s",i.value.title),ref_key:"navigableList",ref:p},{default:d(({item:M,index:O,isSelected:L})=>[o("div",Gwe,[i.value.key==="products"?(r(),E(hwe,{key:0,product:M},null,8,["product"])):x("",!0),i.value.key==="orders"?(r(),E(Swe,{key:1,order:M},null,8,["order"])):x("",!0),i.value.key==="customers"?(r(),E(Lwe,{key:2,customer:M},null,8,["customer"])):x("",!0),i.value.key==="coupons"?(r(),E(Pwe,{key:3,coupon:M},null,8,["coupon"])):x("",!0)]),o("div",zwe,[n(Y,{name:"Enter"})])]),_:1},8,["items","on-action","no-results-text"])]))}},qwe={class:"fct-global-search-input-wrap"},Ywe=["aria-label"],Wwe={class:"fct-setting-search-icon"},Jwe={class:"fct-global-search-input-container"},Xwe={key:0,class:"searched-item"},Zwe={class:"fct-global-searching-for"},eCe={class:"fct-global-searching-for-label"},tCe={class:"fct-global-searching-suggestion-list"},aCe=["onClick"],lCe={class:"dialog-footer is-border"},sCe={class:"fct-search-commands"},nCe={class:"command-key"},oCe={class:"command-key"},iCe={class:"label"},rCe={class:"command-key"},dCe={class:"label"},uCe={class:"label"},cCe={__name:"GlobalSearch",setup(e){Jt().ctx,sl();const t=T(!1),a=T(""),l=T({}),s=T(),i=T(""),c=T([u("orders"),u("products"),u("customers"),u("coupons"),u("settings"),u("menus"),u("shortcuts...")]),p=T(0),f=T(!0),_=T(0),g=T(null),y=T(null),v=T(70),w=T(40),k=T(1700),b=()=>{xe(()=>{$()})},S=()=>{var ie,J;Q.value?(ie=W.value)==null||ie.resetSelection():(J=F.value)==null||J.resetSelection(),Q.value=!1,H.value=!1,D()},$=()=>{var ie;(ie=s.value)==null||ie.focus()},D=()=>{Q.value=!1,l.value=[],t.value=!1,a.value="",V.value=null},F=T(),B=ie=>{let J=ie.includes(","),N={},ae=[];(J?ie.split(","):[ie]).forEach(re=>{re.includes(":")?U(re,N,ae):ae.push(re)});let fe=[];return Object.keys(N).forEach(re=>{const Ee=N[re];Ee.length>0?Ee.forEach(ye=>{ye.length>0?fe.push({group:"'"+re,title:ye}):fe.push({group:"'"+re})}):fe.push({group:"'"+re})}),ae.forEach(re=>{re.length>0&&fe.push({title:re})}),fe},U=(ie,J,N)=>{if(ie.length===1)return;let ae=ie.split(":"),oe=ae[0],fe=ae[1];oe.length>0?(J.hasOwnProperty(oe)||(J[oe]=[]),fe.length>0&&J[oe].push(fe)):N.push(fe)},Q=T(!1),V=T(null),I=T({o:{key:"orders",title:u("Orders")},p:{key:"products",title:u("Products")},c:{key:"customers",title:u("Customers")},d:{key:"coupons",title:u("Coupons")}}),M=ie=>{V.value=ie,Q.value=!0,l.value={},xe(()=>{var J,N;(J=W.value)==null||J.fetchData(a.value,ie),(N=s.value)==null||N.focus()})},O=()=>{var ie;l.value=[],V.value=null,a.value="",Q.value=!1,(ie=s.value)==null||ie.focus(),H.value=!1},L=()=>{var ie;(ie=W.value)==null||ie.fetchData(a.value,V.value)},H=T(!1),j=ie=>{H.value=ie,xe(()=>{var J;(J=s.value)==null||J.focus()})},W=T(),G=bs(),Z=()=>{if(t.value){$();return}const ie=["o","p","c","d"];G.bind(ie,J=>{J.preventDefault();const N=I.value[J.key];N&&M(N)}),t.value=!0,xe(()=>{var J;(J=F.value)==null||J.fetchRecentActions()}),setTimeout(()=>{G.unbind(ie)},800)};G.bind(["/"],ie=>{!t.value&&ne()||(ie.preventDefault(),Z())});const ne=()=>{const ie=document.activeElement;if(!ie)return!1;const J=ie.tagName;return J==="INPUT"||J==="TEXTAREA"||J==="SELECT"||ie.isContentEditable},ce=()=>{if(g.value)return;const ie=()=>{if(s.value&&s.value.length>0)return;const N=c.value[p.value];if(f.value)_.value<N.length?(i.value=N.slice(0,_.value+1),_.value++):(f.value=!1,clearTimeout(y.value),y.value=setTimeout(()=>{y.value=null},k.value));else{if(y.value)return;_.value>0?(_.value--,i.value=N.slice(0,_.value)):(f.value=!0,p.value=(p.value+1)%c.value.length)}},J=()=>{ie();const N=f.value?v.value:y.value?120:w.value;g.value=setTimeout(J,N)};J()},z=T(!1);let ue;return Ie(()=>{ce(),ue=new mn(Zr,j0e());const ie=document.getElementById("fct_admin_menu_search");if(ie){const J=ie.querySelector(".fct-global-search-input-wrap");J&&J.remove()}z.value=!!ie,window.fluentCart=window.fluentCart||{},window.fluentCart.openSearch=Z}),Bt(()=>{window.fluentCart&&delete window.fluentCart.openSearch}),(ie,J)=>{const N=C("el-input"),ae=C("el-dialog");return r(),h(P,null,[z.value?(r(),E(ii,{key:0,to:"#fct_admin_menu_search"},[o("div",qwe,[o("button",{onClick:Z,type:"button",class:"fct-setting-search-button","aria-label":A(u)("Search")},[o("span",Wwe,[n(Y,{name:"Search"})]),J[6]||(J[6]=o("span",{class:"fct-global-search-button-keys"},[o("kbd",{class:"fct-global-search-button-key"},"/")],-1))],8,Ywe)])])):x("",!0),n(ae,{modelValue:t.value,"onUpdate:modelValue":J[5]||(J[5]=oe=>t.value=oe),onOpened:b,onClosed:S,class:"fct-global-search-container","append-to-body":!0},{header:d(()=>[o("div",Jwe,[n(Y,{name:"Search",class:"search-icon"}),V.value!=null?(r(),h("div",Xwe,[R(m(V.value.title)+" ",1),n(Y,{name:"Cross",class:"searched-item-remove",onClick:O})])):x("",!0),n(N,{class:"mousetrap",placeholder:A(u)("Search for %1$s",i.value),autofocus:"",ref_key:"searchRef",ref:s,id:"fct-global-search-input",disabled:H.value,onKeydown:[J[0]||(J[0]=xa(Ge(()=>{var oe,fe;if(Q.value){(oe=W.value)==null||oe.focusList();return}(fe=F.value)==null||fe.focusList()},["prevent"]),["arrow-down"])),J[1]||(J[1]=xa(Ge(()=>{var oe,fe;if(Q.value){(oe=W.value)==null||oe.performFirstAction();return}(fe=F.value)==null||fe.performFirstAction()},["prevent"]),["enter"])),J[2]||(J[2]=xa(()=>{a.value.length===0&&(V.value=null,Q.value=!1)},["backspace"]))],onInput:J[3]||(J[3]=()=>{if(Q.value){L();return}let oe=a.value.includes(","),fe=a.value.includes(":");if(!oe&&!fe)l.value.value=A(ue).search(a.value);else{const re=B(a.value);l.value.value=A(ue).search({$or:re})}}),modelValue:a.value,"onUpdate:modelValue":J[4]||(J[4]=oe=>a.value=oe),clearable:""},null,8,["placeholder","disabled","modelValue"])])]),default:d(()=>[n(ya,{visible:!V.value&&a.value.length===0,accordion:""},{default:d(()=>[o("div",Zwe,[o("div",eCe,m(A(u)("Searching for")),1),o("div",tCe,[(r(!0),h(P,null,te(I.value,oe=>{var fe;return r(),h("div",{key:oe.key,onClick:re=>M(oe),class:de(["fct-global-searching-suggestion",((fe=V.value)==null?void 0:fe.key)===oe.key?"active":""])},m(oe.title),11,aCe)}),128))])])]),_:1},8,["visible"]),Q.value?(r(),E(jwe,{key:0,ref_key:"remoteResultRef",ref:W,query:a.value,tag:V.value,onCloseModal:D,onOnRemoteSearchStateChange:j},null,8,["query","tag"])):(r(),E(cwe,{key:1,ref_key:"resultListRef",ref:F,query:a.value,"search-results":l.value.value,onActionPerformed:D,focusInput:$,searchData:A(Zr)},null,8,["query","search-results","searchData"])),o("div",lCe,[o("ul",sCe,[o("li",null,[o("span",nCe,[n(Y,{name:"ArrowUp"})]),o("span",oCe,[n(Y,{name:"ArrowDown"})]),o("span",iCe,m(A(u)("To navigate")),1)]),o("li",null,[o("span",rCe,[n(Y,{name:"Enter"})]),o("span",dCe,m(A(u)("To select")),1)]),o("li",null,[J[7]||(J[7]=o("kbd",{class:"command-key"},"esc",-1)),o("span",uCe,m(A(u)("To close")),1)])])])]),_:1},8,["modelValue"])],64)}}},ACe={class:"fl_app fluent-cart-admin-pages"},pCe=Object.assign({name:"DashboardApplication"},{__name:"Application",setup(e){const t=T("");Ie(()=>{jQuery(".notice:not(.fluent-cart), .error:not(.fluent-cart), #ehp-admin-cb").remove(),t.value=a(),l.value=!!document.getElementById("theme-button-container");const c=document.querySelector(".fct_admin_menu_wrap"),p=()=>{window.scrollY>10?c==null||c.classList.add("scroll-header"):c==null||c.classList.remove("scroll-header")};window.addEventListener("scroll",p)});const a=()=>window.location.href,l=T(!1),s=nl();be(()=>s.fullPath,()=>{t.value=a()});const i=K(()=>!(s.fullPath.includes("reports")||s.fullPath.includes("settings")));return(c,p)=>{const f=C("router-view");return r(),h("div",null,[n(cCe),i.value?(r(),E(Ia,{key:0})):x("",!0),o("div",ACe,[n(f)]),l.value?(r(),E(ii,{key:1,to:"#theme-button-container"},[n(t0e)])):x("",!0)])}}});let Oc=!1;function fCe(e){return{data:function(){return{appVars:window.fluentCartAdminApp}},methods:{$get:Ae.get,$post:Ae.post,$put:Ae.put,$del:Ae.delete,$t:u,$n:Io,formatMoney(t,a,l=!1){return!t&&l?"":(t||(t="0.00"),ze.get("shop.currency_sign")+" "+t)},formatCents(t,a,l=!1){return!t&&l?"":(t?t=(t*100).toFixed(2):t="0.00",a?(t=new Intl.NumberFormat("en-US").format(t),ze.get("shop.currency_sign")+" "+t):t)},formatNumber(t,a=!0,l=!1,s){return ft.formatNumber(t,a,l,s)},formatNumberForOrder(t,a,l=!0,s=!1){return ft.formatForOrder(t,a,l,s)},getAddress(t,a="billing"){let l=[t[a+"_address_1"],t[a+"_address_2"],t[a+"_city"],t[a+"_city"],t[a+"_state"],t[a+"_zip"],t[a+"_country"]];return l=l.filter(s=>!!s).join(", "),l||"no "+a+" address"},getOrderAddress(t,a="billing",l=!1){return xm(t,a,l)},changeTitle(t){jQuery("head title").text(t+" - FluentCart")},handleError(t){if(!t)return;let a="";typeof t=="string"?a=t:t&&t.message?a=t.message:a=t,typeof t=="object"&&(a=this.convertToText(t)),a||(a="Something is wrong!"),this.$notify({type:"error",title:"Error",message:a,dangerouslyUseHTMLString:!0})},convertToText(t){const a=[];if(typeof t=="object"&&t.join===void 0)for(const l in t)a.push(this.convertToText(t[l]));else if(typeof t=="object"&&t.join!==void 0)for(const l in t)a.push(this.convertToText(t[l]));else typeof t=="function"||typeof t=="string"&&a.push(t);return a.join("<br />")},handleSuccess:t=>{q.success(t)},handleMessage:(t,a="info",l=40,s=1e3)=>{qc.show(t,a,l,s)},Storage:()=>Vt,buildFormRendererValue(t,a){let l={};return Object.keys(t).forEach(s=>{let i=t[s];["grid"].includes(i.type??"")?l[s]=this.buildFormRendererValue(i.schema??{},a[s]??{}):l[s]=a[s]??""}),l},registerCopyAction(){Oc||(Oc=!0,document.addEventListener("click",t=>{t.target.matches(".copyable-content")&&as.copy(t.target.textContent)}))},currencySign(){return ze.get("shop.currency_sign")},getPlaceholderImage(){return gs.getUrl("images/placeholder.svg")},saveLocal(t,a){Vt.set(t,a)},getLocal(t){return Vt.get(t)},hasPermission(t){return Vn.hasPermission(t)}}}}function mCe(e){e.beforeEach((t,a,l)=>{const s=dt.get(t,"meta.permission");return s?Vn.resolve({permission:s,permissionType:dt.get(t,"meta.permissionType")})?l():l({name:"unauthorized"}):(ze.get("app_config.env"),l())})}function hCe(e){const t={fluent_cart_products:["fluent_cart_inventory","fluent_cart_attributes"]},a=l=>{if(!l)return;const s="fluent_cart_"+l;Object.entries(t).forEach(([i,c])=>{const p=s===i;c.forEach(f=>{const _=jQuery(".toplevel_page_fluent-cart li."+f);p?_.show():_.hide()})})};e.afterEach((l,s)=>{const i=l.meta.active_menu;jQuery(".fct_menu li").removeClass("active_admin_menu"),jQuery(".fct_menu li.fct_menu_item_"+i).addClass("active_admin_menu"),jQuery(".toplevel_page_fluent-cart li").removeClass("current"),jQuery(".toplevel_page_fluent-cart li.fluent_cart_"+i).addClass("current"),a(i),l.meta.title&&jQuery("head title").text(l.meta.title+" - FluentCart")})}const _Ce={mounted(e,t){const a=t.value,l=1e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,f=Math.min(p/l,1),_=(s+f*(a-s)).toFixed(2);e.textContent=_,f<1&&requestAnimationFrame(c)};c()},updated(e,t){const a=t.value,l=2e3,s=0,i=performance.now(),c=()=>{const p=performance.now()-i,f=Math.min(p/l,1),_=(s+f*(a-s)).toFixed(2);e.textContent=_,f<1&&requestAnimationFrame(c)};c()}},vCe={__name:"Unauthorized",setup(e){return(t,a)=>(r(),h("span",null,m(A(u)("You are not allowed")),1))}},gCe=window.fluent_cart_admin.hooks.applyFilters("fluent_cart_routes",Xbe);let Pc=!1;document.addEventListener("fcart_renew_rest_nonce",function(e){Pc||Fl.alert(u("Your session has expired due to inactivity. Please refresh the page to continue."),u("Session Expired"),{confirmButtonText:u("Reload"),callback:t=>{Pc=!1,window.location.reload()}})});const yCe=[rm,dm,um,Wc,cm,ld,Am,pm,sd,fm,mm,Xc],ql=Zf(pCe);ql.config.globalProperties.appVars=ze.get();ql.provide("appVars",ze.get());ql.mixin(fCe());ql.directive("loading",Um);ql.directive("animate",_Ce);Xm(ql);const Ld=em({routes:[...Object.values(gCe),{path:"/unauthorized",name:"unauthorized",component:vCe,props:!0},{path:"/:path(.*)*",name:"NotFound",component:ci,props:!0}],history:tm(),scrollBehavior(e,t,a){return a||{top:0,behavior:"smooth"}}});ql.use(Ld);mCe(Ld);hCe(Ld);yCe.forEach(e=>{ql.component(e.name,e)});const Rd=ze.get("el_strings"),Hf=ze.get("datei18");Rd.el.datepicker.weeks=Hf.weekdaysShort;Rd.el.datepicker.months=Hf.monthsShort;ql.use(Im,{locale:Rd});ql.mount("#fluent_cart_plugin_app");if(ze.get("has_data_migrations")){let e=0;const t=()=>{Ae.post("data-backfills/run").then(a=>{a&&a.status==="running"&&++e<100&&t()}).catch(()=>{})};t()}export{jn as E,kd as _}; | |